diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 08f496ad..979c9bd6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,8 +1,8 @@ name: Java CI with Gradle on: -# push: -# branches: [ "master", "v4" ] + pull_request: + branches: [ "master", "v4" ] workflow_dispatch: jobs: @@ -36,61 +36,3 @@ jobs: with: name: v1.8.9 path: v1.8.9/build/libs/ - - - name: Upload artifact - run: | - cd v1.8.9 - - plain_version=$(awk -F'=' '/^version[[:space:]]*=/ {print $2}' gradle.properties | tr -d '[:space:]') - sha=$(git rev-parse --short=6 HEAD) - version="${plain_version}-${sha}" - - mkdir -p build/libs - cd build/libs - - export JAR=$(find . -name "*.jar") - mkdir -p zip - cp "$JAR" zip/fpsmaster.jar - cd zip - zip -r fpsmaster.zip * - - # 创建存储目录 - RESPONSE=$(curl --location --request POST "https://api.kstore.space/api/v1/file/create" \ - --header "X-GitHub-Event: workflow_run" \ - --header "User-Agent: Apifox/1.0.0 (https://apifox.com)" \ - --form "access_token=${{ secrets.OSS }}" \ - --form "fileId=0" \ - --form "name=action-${{ github.event.head_commit.id }}") - - DIR_ID=$(echo "$RESPONSE" | jq -r '.data.id') - echo "DirectoryId: $DIR_ID" - - # 上传文件 - UPLOAD_RESPONSE=$(curl --location --request POST "https://upload.kstore.space/upload/$DIR_ID?access_token=${{ secrets.OSS }}" \ - -F "file=@fpsmaster.zip") - - DOWNLOAD_URL=$(echo "$UPLOAD_RESPONSE" | jq -r '.data.downloadUrl') - FILE_ID=$(echo "$UPLOAD_RESPONSE" | jq -r '.data.id') - - echo "FileId: $FILE_ID" - echo "URL: $DOWNLOAD_URL" - - # 设为直接下载 - RESPONSE=$(curl --location --request POST "https://api.kstore.cc/api/v1/file/direct?access_token=${{ secrets.OSS }}" \ - --form "fileId=$FILE_ID" \ - --form "isDirect=1") - - echo "$RESPONSE" - - echo "$(date -u +%Y-%m-%dT%H:%M:%SZ)" - - # 版本推送 - curl --get \ - --data-urlencode "key=${{ secrets.API_KEY }}" \ - --data-urlencode "commit=${{ github.sha }}" \ - --data-urlencode "branch=${{ github.ref }}" \ - --data-urlencode "version=$version" \ - --data-urlencode "date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \ - --data-urlencode "link=$DOWNLOAD_URL" \ - --data-urlencode "release=false" \ - "https://service.fpsmaster.top/api/github/push" diff --git a/docs/tasks.md b/docs/tasks.md index f3e8df00..46b9f5c8 100644 --- a/docs/tasks.md +++ b/docs/tasks.md @@ -14,7 +14,7 @@ FPSMaster v4将会在此列表任务大部分完成后发布 - [x] 迁移优化代码 - [x] HitMarker - [ ] 优化代码结构 -- [ ] 重构MusicPlayer界面 +- [x] 重构MusicPlayer界面 - [ ] 支持播放无损/VIP音乐 - [ ] 添加界面自动对齐 - [ ] 添加翻译功能 @@ -22,14 +22,14 @@ FPSMaster v4将会在此列表任务大部分完成后发布 - [ ] 攻击音效 - [ ] 组件更加自定义化(按键显示等) - [ ] 修改notification,添加更多样式和自定义 -- [ ] RawInput兼容和优化 +- [x] RawInput兼容和优化 - [ ] FPS Hurt Cam - [ ] World Color - [ ] 跨版本框架 - [ ] 自定义客户端字体 - [ ] 自定义动画速率、曲线等 - [ ] 全局搜索 -- [ ] 新的OOBE +- [x] 新的OOBE - [ ] 功能完整的饰品界面 - [ ] AutoText - [ ] 饱和度显示 diff --git a/shared/java/top/fpsmaster/Constants.java b/shared/java/top/fpsmaster/Constants.java new file mode 100644 index 00000000..d59e6c55 --- /dev/null +++ b/shared/java/top/fpsmaster/Constants.java @@ -0,0 +1,9 @@ +package top.fpsmaster; + +public final class Constants { + public static final String EDITION = "1.8.9"; + public static final String VERSION = "v1.8.9"; + + private Constants() { + } +} diff --git a/shared/java/top/fpsmaster/FPSMaster.java b/shared/java/top/fpsmaster/FPSMaster.java index ee35cb82..1eaf1e0b 100644 --- a/shared/java/top/fpsmaster/FPSMaster.java +++ b/shared/java/top/fpsmaster/FPSMaster.java @@ -7,8 +7,6 @@ import top.fpsmaster.features.impl.interfaces.ClientSettings; import top.fpsmaster.features.manager.ModuleManager; import top.fpsmaster.font.FontManager; -import top.fpsmaster.modules.account.AccountManager; -import top.fpsmaster.modules.client.ClientUsersManager; import top.fpsmaster.modules.client.thread.ClientThreadPool; import top.fpsmaster.modules.config.ConfigManager; import top.fpsmaster.modules.i18n.Language; @@ -16,27 +14,17 @@ import top.fpsmaster.modules.lua.LuaManager; import top.fpsmaster.modules.music.MusicPlayer; import top.fpsmaster.modules.music.netease.NeteaseApi; -import top.fpsmaster.ui.click.music.MusicPanel; -import top.fpsmaster.ui.click.music.NewMusicPanel; import top.fpsmaster.ui.custom.ComponentsManager; -import top.fpsmaster.ui.screens.oobe.OOBEScreen; import top.fpsmaster.utils.GitInfo; import top.fpsmaster.utils.os.FileUtils; -import top.fpsmaster.utils.os.HttpRequest; -import top.fpsmaster.utils.thirdparty.github.UpdateChecker; -import top.fpsmaster.websocket.client.WsClient; -import top.fpsmaster.wrapper.Constants; import java.io.File; public class FPSMaster { public boolean hasOptifine; - public boolean loggedIn; - public WsClient wsClient; public static final String phase = "pre-release"; - public static final String SERVICE_API = "https://service.fpsmaster.top"; public static final String EDITION = Constants.EDITION; public static final String COPYRIGHT = "Copyright ©2020-2025 FPSMaster Team All Rights Reserved."; @@ -49,9 +37,6 @@ public class FPSMaster { public static ModuleManager moduleManager = new ModuleManager(); public static FontManager fontManager = new FontManager(); public static ConfigManager configManager = new ConfigManager(); - public static OOBEScreen oobeScreen = new OOBEScreen(); - public static AccountManager accountManager = new AccountManager(); - public static ClientUsersManager clientUsersManager = new ClientUsersManager(); public static GlobalListener submitter = new GlobalListener(); public static CommandManager commandManager = new CommandManager(); public static ComponentsManager componentsManager = new ComponentsManager(); @@ -81,8 +66,7 @@ private void initializeFonts() { // add more fonts and add fallback font File file = new File(FileUtils.fonts, "harmony_bold.ttf"); if (!file.exists()) { - ClientLogger.info("Downloading Fonts..."); - HttpRequest.downloadFile("https://13430.kstore.space/harmony_bold.ttf", file.getAbsolutePath()); + ClientLogger.warn("Missing font file: " + file.getAbsolutePath()); } fontManager.load(); @@ -102,9 +86,6 @@ private void initializeConfigures() throws Exception { configManager.loadConfig("default"); MusicPlayer.setVolume(Float.parseFloat(configManager.configure.getOrCreate("volume", "1"))); NeteaseApi.cookies = FileUtils.readTempValue("cookies"); - MusicPanel.nickname = FileUtils.readTempValue("nickname"); - NewMusicPanel.nickname = FileUtils.readTempValue("nickname"); - accountManager.autoLogin(); } private void initializeMusic() { @@ -157,25 +138,9 @@ private void checkOptifine() { } private void checkUpdate() { - if (development) { - isLatest = true; - return; - } - async.runnable(() -> { - String s = UpdateChecker.getLatestVersion(); - if (s == null || s.isEmpty()) { - s = UpdateChecker.getLatestVersion(); - if (s == null || s.isEmpty()) { - isLatest = false; - updateFailed = true; - ClientLogger.error("获取最新版本信息失败"); - return; - } - } - s = s.trim(); - latest = s; - isLatest = GitInfo.getCommitId().equals(s); - }); + isLatest = true; + updateFailed = false; + latest = GitInfo.getCommitId(); } public void initialize() { @@ -200,11 +165,8 @@ public void shutdown() { try { ClientLogger.info("Saving configs"); configManager.saveConfig("default"); - if (wsClient != null && wsClient.isOpen()) { - wsClient.close(200, "Shutdown"); - } } catch (FileException e) { throw new RuntimeException(e); } } -} \ No newline at end of file +} diff --git a/shared/java/top/fpsmaster/api/APIProvider.java b/shared/java/top/fpsmaster/api/APIProvider.java deleted file mode 100644 index 7b45e014..00000000 --- a/shared/java/top/fpsmaster/api/APIProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -package top.fpsmaster.api; - -import top.fpsmaster.api.domain.client.IClientAPI; -import top.fpsmaster.api.domain.entity.IEntityAPI; -import top.fpsmaster.api.domain.world.IWorldAPI; -import top.fpsmaster.api.domain.render.IRenderAPI; -import top.fpsmaster.api.domain.network.INetworkAPI; -import top.fpsmaster.api.domain.gui.IGuiAPI; -import top.fpsmaster.api.domain.sound.ISoundAPI; - -/** - * API Provider 接口 - * 由各个版本的实现模块提供具体实现 - * - * 实现类应该位于版本特定的包中: - * - v1.8.9: top.fpsmaster.impl.APIProviderImpl - * - v1.12.2: top.fpsmaster.impl.APIProviderImpl - */ -public interface APIProvider { - - /** - * 获取客户端 API 实现 - */ - IClientAPI getClientAPI(); - - /** - * 获取世界 API 实现 - */ - IWorldAPI getWorldAPI(); - - /** - * 获取渲染 API 实现 - */ - IRenderAPI getRenderAPI(); - - /** - * 获取网络 API 实现 - */ - INetworkAPI getNetworkAPI(); - - /** - * 获取 GUI API 实现 - */ - IGuiAPI getGuiAPI(); - - /** - * 获取音效 API 实现 - */ - ISoundAPI getSoundAPI(); - - /** - * 获取实体 API 实现 - */ - IEntityAPI getEntityAPI(); -} diff --git a/shared/java/top/fpsmaster/api/MinecraftAPI.java b/shared/java/top/fpsmaster/api/MinecraftAPI.java deleted file mode 100644 index 81c27c30..00000000 --- a/shared/java/top/fpsmaster/api/MinecraftAPI.java +++ /dev/null @@ -1,134 +0,0 @@ -package top.fpsmaster.api; - -import top.fpsmaster.api.domain.client.IClientAPI; -import top.fpsmaster.api.domain.entity.IEntityAPI; -import top.fpsmaster.api.domain.world.IWorldAPI; -import top.fpsmaster.api.domain.render.IRenderAPI; -import top.fpsmaster.api.domain.network.INetworkAPI; -import top.fpsmaster.api.domain.gui.IGuiAPI; -import top.fpsmaster.api.domain.sound.ISoundAPI; - -/** - * FPSMaster 跨版本 API 统一访问入口 - * 所有业务代码应该通过此类访问 Minecraft 相关功能 - * - * 使用示例: - *
- * IClientPlayer player = MinecraftAPI.client().getPlayer();
- * IWorld world = MinecraftAPI.world().getWorld();
- * 
- */ -public final class MinecraftAPI { - - private static volatile APIProvider provider; - - /** - * 私有构造函数,防止实例化 - */ - private MinecraftAPI() { - throw new UnsupportedOperationException("Utility class"); - } - - /** - * 初始化 API Provider (由各版本的入口调用) - * - * @param apiProvider API 提供者实现 - * @throws IllegalStateException 如果已经初始化 - */ - public static void initialize(APIProvider apiProvider) { - if (provider != null) { - throw new IllegalStateException("MinecraftAPI already initialized"); - } - if (apiProvider == null) { - throw new IllegalArgumentException("APIProvider cannot be null"); - } - provider = apiProvider; - } - - /** - * 检查 API 是否已初始化 - */ - public static boolean isInitialized() { - return provider != null; - } - - /** - * 获取 Provider(内部使用) - */ - private static APIProvider getProvider() { - if (provider == null) { - throw new IllegalStateException("MinecraftAPI not initialized. Call MinecraftAPI.initialize() first."); - } - return provider; - } - - /** - * 客户端相关 API - * 包括: Minecraft实例、玩家、设置、会话等 - * - * @return 客户端 API 实例 - */ - public static IClientAPI client() { - return getProvider().getClientAPI(); - } - - /** - * 世界相关 API - * 包括: 方块、实体、时间、天气等 - * - * @return 世界 API 实例 - */ - public static IWorldAPI world() { - return getProvider().getWorldAPI(); - } - - /** - * 渲染相关 API - * 包括: RenderManager、粒子效果、字体渲染等 - * - * @return 渲染 API 实例 - */ - public static IRenderAPI render() { - return getProvider().getRenderAPI(); - } - - /** - * 网络包相关 API - * 包括: 数据包解析、发送等 - * - * @return 网络 API 实例 - */ - public static INetworkAPI network() { - return getProvider().getNetworkAPI(); - } - - /** - * GUI 相关 API - * 包括: 主菜单、聊天、游戏内GUI等 - * - * @return GUI API 实例 - */ - public static IGuiAPI gui() { - return getProvider().getGuiAPI(); - } - - /** - * 音效相关 API - * 包括: 声音播放、音效管理等 - * - * @return 音效 API 实例 - */ - public static ISoundAPI sound() { - return getProvider().getSoundAPI(); - } - - /** - * 实体相关 API - * 包括: 实体查找、实体信息等 - * - * @return 实体 API 实例 - */ - public static IEntityAPI entity() { - return getProvider().getEntityAPI(); - } -} diff --git a/shared/java/top/fpsmaster/api/ProviderManager.java b/shared/java/top/fpsmaster/api/ProviderManager.java deleted file mode 100644 index caa26acf..00000000 --- a/shared/java/top/fpsmaster/api/ProviderManager.java +++ /dev/null @@ -1,137 +0,0 @@ -package top.fpsmaster.api; - -import top.fpsmaster.api.provider.client.IConstantsProvider; -import top.fpsmaster.api.provider.game.*; -import top.fpsmaster.api.provider.gui.IGuiIngameProvider; -import top.fpsmaster.api.provider.gui.IGuiMainMenuProvider; -import top.fpsmaster.api.provider.gui.IGuiNewChatProvider; -import top.fpsmaster.api.provider.packets.IAddPlayerData; -import top.fpsmaster.api.provider.packets.IPacketChat; -import top.fpsmaster.api.provider.packets.IPacketPlayerList; -import top.fpsmaster.api.provider.packets.IPacketTimeUpdate; -import top.fpsmaster.api.provider.render.IEffectRendererProvider; -import top.fpsmaster.api.provider.render.IRenderManagerProvider; -import top.fpsmaster.api.provider.sound.ISoundProvider; -import top.fpsmaster.api.wrapper.packets.PlayerListItemAddWrap; -import top.fpsmaster.wrapper.*; -import top.fpsmaster.wrapper.packets.SPacketChatProvider; -import top.fpsmaster.wrapper.packets.SPacketPlayerListProvider; -import top.fpsmaster.wrapper.packets.SPacketTimeUpdateProvider; -import top.fpsmaster.wrapper.packets.WrapperAddPlayerData; -import top.fpsmaster.wrapper.sound.SoundProvider; - -import java.util.List; - -public class ProviderManager { - public static final IConstantsProvider constants = new IConstantsProvider() { - private final Constants impl = new Constants(); - public String getVersion() { return impl.getVersion(); } - public String getEdition() { return impl.getEdition(); } - }; - - public static final IUtilityProvider utilityProvider = new IUtilityProvider() { - private final UtilityProvider impl = new UtilityProvider(); - public String getResourcePath(net.minecraft.util.ResourceLocation rl) { return impl.getResourcePath(rl); } - public double getDistanceToEntity(net.minecraft.entity.Entity e1, net.minecraft.entity.Entity e2) { return impl.getDistanceToEntity(e1, e2); } - public boolean isItemEnhancementEmpty(net.minecraft.item.ItemStack i) { return impl.isItemEnhancementEmpty(i); } - public int getPotionIconIndex(net.minecraft.potion.PotionEffect effect) { return impl.getPotionIconIndex(effect); } - public Object makeChatComponent(String msg) { return impl.makeChatComponent(msg); } - }; - - public static final ILegacyMinecraftProvider mcProvider = new ILegacyMinecraftProvider() { - private final MinecraftProvider impl = new MinecraftProvider(); - public Object getCurrentScreen() { return impl.getCurrentScreen(); } - public java.io.File getGameDir() { return impl.getGameDir(); } - public net.minecraft.client.gui.FontRenderer getFontRenderer() { return impl.getFontRenderer(); } - public net.minecraft.client.entity.EntityPlayerSP getPlayer() { return impl.getPlayer(); } - public boolean isHoveringOverBlock() { return impl.isHoveringOverBlock(); } - public net.minecraft.item.ItemStack getPlayerHeldItem() { return impl.getPlayerHeldItem(); } - public net.minecraft.client.multiplayer.WorldClient getWorld() { return impl.getWorld(); } - public net.minecraft.item.ItemStack[] getArmorInventory() { return impl.getArmorInventory(); } - public void setSession(net.minecraft.util.Session mojang) { impl.setSession(mojang); } - public Integer getRespondTime() { return impl.getRespondTime(); } - public void drawString(String text, float x, float y, int color) { impl.drawString(text, x, y, color); } - public String getServerAddress() { return impl.getServerAddress(); } - public void removeClickDelay() { impl.removeClickDelay(); } - public void printChatMessage(Object message) { impl.printChatMessage(message); } - public java.util.Collection getPlayerInfoMap() { return impl.getPlayerInfoMap(); } - }; - - public static final IGuiMainMenuProvider mainmenuProvider = new IGuiMainMenuProvider() { - private final GuiMainMenuProvider impl = new GuiMainMenuProvider(); - public void initGui() { impl.initGui(); } - public void renderSkybox(int mouseX, int mouseY, float partialTicks, int width, int height, float zLevel) { impl.renderSkybox(mouseX, mouseY, partialTicks, width, height, zLevel); } - public void showSinglePlayer(net.minecraft.client.gui.GuiScreen screen) { impl.showSinglePlayer(screen); } - }; - - - public static final IWorldClientProvider worldClientProvider = new IWorldClientProvider() { - private final WorldClientProvider impl = new WorldClientProvider(); - public net.minecraft.block.state.IBlockState getBlockState(top.fpsmaster.wrapper.blockpos.WrapperBlockPos pos) { return impl.getBlockState(pos); } - public net.minecraft.block.Block getBlock(top.fpsmaster.wrapper.blockpos.WrapperBlockPos pos) { return impl.getBlock(pos); } - public top.fpsmaster.wrapper.util.WrapperAxisAlignedBB getBlockBoundingBox(top.fpsmaster.wrapper.blockpos.WrapperBlockPos pos, net.minecraft.block.state.IBlockState state) { return impl.getBlockBoundingBox(pos, state); } - public void addWeatherEffect(net.minecraft.entity.effect.EntityLightningBolt entityLightningBolt) { impl.addWeatherEffect(entityLightningBolt); } - public net.minecraft.client.multiplayer.WorldClient getWorld() { return impl.getWorld(); } - public void setWorldTime(long l) { impl.setWorldTime(l); } - }; - - public static final ITimerProvider timerProvider = new ITimerProvider() { - private final TimerProvider impl = new TimerProvider(); - public float getRenderPartialTicks() { return impl.getRenderPartialTicks(); } - }; - - public static final IRenderManagerProvider renderManagerProvider = new IRenderManagerProvider() { - private final RenderManagerProvider impl = new RenderManagerProvider(); - public double renderPosX() { return impl.renderPosX(); } - public double renderPosY() { return impl.renderPosY(); } - public double renderPosZ() { return impl.renderPosZ(); } - }; - - public static final IGameSettings gameSettings = new IGameSettings() { - private final GameSettingsProvider impl = new GameSettingsProvider(); - public void setKeyPress(net.minecraft.client.settings.KeyBinding key, boolean value) { impl.setKeyPress(key, value); } - }; - - // Packets - public static final IPacketChat packetChat = new IPacketChat() { - private final SPacketChatProvider impl = new SPacketChatProvider(); - public String getUnformattedText(Object packet) { return impl.getUnformattedText(packet); } - public net.minecraft.util.IChatComponent getChatComponent(Object packet) { return impl.getChatComponent(packet); } - public int getType(Object p) { return impl.getType(p); } - public void appendTranslation(Object p) { impl.appendTranslation(p); } - public boolean isPacket(Object packet) { return impl.isPacket(packet); } - }; - - public static final IPacketPlayerList packetPlayerList = new IPacketPlayerList() { - private final SPacketPlayerListProvider impl = new SPacketPlayerListProvider(); - public boolean isPacket(Object packet) { return impl.isPacket(packet); } - public boolean isActionJoin(Object p) { return impl.isActionJoin(p); } - public boolean isActionLeave(Object p) { return impl.isActionLeave(p); } - public List getEntries(Object p) { - List entries = impl.getEntries(p); - return entries; - } - }; - - public static final IPacketTimeUpdate packetTimeUpdate = new IPacketTimeUpdate() { - private final SPacketTimeUpdateProvider impl = new SPacketTimeUpdateProvider(); - public boolean isPacket(Object packet) { return impl.isPacket(packet); } - }; - - public static final IGuiIngameProvider guiIngameProvider = new IGuiIngameProvider() { - private final GuiIngameProvider impl = new GuiIngameProvider(); - public void drawHealth(net.minecraft.entity.Entity entityIn) { impl.drawHealth(entityIn); } - }; - - public static final ISoundProvider soundProvider = new ISoundProvider() { - private final SoundProvider impl = new SoundProvider(); - public void playLightning(double posX, double posY, double posZ, float i, float v, boolean b) { impl.playLightning(posX, posY, posZ, i, v, b); } - public void playExplosion(double posX, double posY, double posZ, float i, float v, boolean b) { impl.playExplosion(posX, posY, posZ, i, v, b); } - public void playRedStoneBreak(double posX, double posY, double posZ, float i, float v, boolean b) { impl.playRedStoneBreak(posX, posY, posZ, i, v, b); } - }; - - public static final IEffectRendererProvider effectManager = new IEffectRendererProvider() { - private final EffectRendererProvider impl = new EffectRendererProvider(); - public void addRedStoneBreak(top.fpsmaster.wrapper.blockpos.WrapperBlockPos pos) { impl.addRedStoneBreak(pos); } - }; -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/Wrappers.java b/shared/java/top/fpsmaster/api/Wrappers.java deleted file mode 100644 index 0d4f72f0..00000000 --- a/shared/java/top/fpsmaster/api/Wrappers.java +++ /dev/null @@ -1,42 +0,0 @@ -package top.fpsmaster.api; - -import top.fpsmaster.api.wrapper.*; -import top.fpsmaster.api.wrapper.packets.*; -import top.fpsmaster.wrapper.*; -import top.fpsmaster.wrapper.packets.*; -import top.fpsmaster.wrapper.sound.SoundProvider; -import top.fpsmaster.wrapper.SkinProvider; - -/** - * @deprecated Use {@link MinecraftAPI} instead for better cross-version compatibility. - * This class is kept for backward compatibility but may be removed in future versions. - *

- * Migration guide: - *

    - *
  • {@code Wrappers.minecraft()} → {@code MinecraftAPI.client()}
  • - *
  • {@code Wrappers.world()} → {@code MinecraftAPI.world()}
  • - *
  • {@code Wrappers.timer()} → {@code MinecraftAPI.render().getPartialTicks()}
  • - *
  • {@code Wrappers.renderManager()} → {@code MinecraftAPI.render().getRenderManager()}
  • - *
  • {@code Wrappers.sound()} → {@code MinecraftAPI.sound()}
  • - *
  • {@code Wrappers.effects()} → {@code MinecraftAPI.render().getParticleManager()}
  • - *
- */ -@Deprecated -public final class Wrappers { - private Wrappers() {} - - public static MinecraftWrap minecraft() { return new MinecraftProvider(); } - public static WorldWrap world() { return new WorldClientProvider(); } - public static RenderManagerWrap renderManager() { return new RenderManagerProvider(); } - public static TimerWrap timer() { return new TimerProvider(); } - public static GameSettingsWrap gameSettings() { return new GameSettingsProvider(); } - public static GuiIngameWrap guiIngame() { return new GuiIngameProvider(); } - public static MainMenuWrap mainMenu() { return new GuiMainMenuProvider(); } - public static SoundWrap sound() { return new SoundProvider(); } - public static EffectRendererWrap effects() { return new EffectRendererProvider(); } - public static SkinWrap skin() { return new SkinProvider(); } - - public static ChatPacketWrap chatPacket() { return new SPacketChatProvider(); } - public static PlayerListItemWrap playerListPacket() { return new SPacketPlayerListProvider(); } - public static TimeUpdatePacketWrap timeUpdatePacket() { return new SPacketTimeUpdateProvider(); } -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/domain/client/IClientAPI.java b/shared/java/top/fpsmaster/api/domain/client/IClientAPI.java deleted file mode 100644 index b733f119..00000000 --- a/shared/java/top/fpsmaster/api/domain/client/IClientAPI.java +++ /dev/null @@ -1,70 +0,0 @@ -package top.fpsmaster.api.domain.client; - -import org.jetbrains.annotations.Nullable; -import top.fpsmaster.api.model.GameMode; - -import java.io.File; - -/** - * 客户端 API - * 提供客户端相关的所有功能 - */ -public interface IClientAPI { - - /** - * 获取 Minecraft 实例接口 - * - * @return Minecraft 实例 - */ - IMinecraft getMinecraft(); - - /** - * 获取当前客户端玩家 - * - * @return 玩家实例,可能为 null(未加入世界时) - */ - @Nullable - IClientPlayer getPlayer(); - - /** - * 获取游戏设置 - * - * @return 游戏设置实例 - */ - IGameSettings getSettings(); - - /** - * 移除点击延迟(用于 NoHitDelay 等优化功能) - * 将 Minecraft 的点击计数器重置为 0 - */ - void removeClickDelay(); - - /** - * 获取游戏目录 - * - * @return 游戏根目录 - */ - File getGameDirectory(); - - /** - * 获取当前打开的屏幕 - * - * @return GUI屏幕对象,可能为 null(没有打开任何界面时) - */ - @Nullable - Object getCurrentScreen(); - - /** - * 获取服务器地址 - * - * @return 服务器地址,单人游戏返回 "localhost" - */ - String getServerAddress(); - - /** - * 是否单人游戏 - * - * @return true 如果是单人游戏 - */ - boolean isSingleplayer(); -} diff --git a/shared/java/top/fpsmaster/api/domain/client/IClientPlayer.java b/shared/java/top/fpsmaster/api/domain/client/IClientPlayer.java deleted file mode 100644 index 95412e2a..00000000 --- a/shared/java/top/fpsmaster/api/domain/client/IClientPlayer.java +++ /dev/null @@ -1,158 +0,0 @@ -package top.fpsmaster.api.domain.client; - -import org.jetbrains.annotations.Nullable; -import top.fpsmaster.api.model.Vec3; - -import java.util.List; -import java.util.UUID; - -/** - * 客户端玩家接口 - * 注意:不直接返回 Minecraft 的 EntityPlayerSP 等类型 - */ -public interface IClientPlayer { - - /** - * 获取玩家名称 - * - * @return 玩家名称 - */ - String getName(); - - /** - * 获取玩家 UUID - * - * @return 玩家唯一 ID - */ - UUID getUniqueId(); - - /** - * 获取玩家 UUID 字符串 - * - * @return UUID 字符串 - */ - String getUUID(); - - /** - * 获取玩家位置 - * - * @return 位置向量 - */ - Vec3 getPosition(); - - /** - * 获取玩家视角方向(Yaw) - * - * @return Yaw 角度 - */ - float getYaw(); - - /** - * 获取玩家视角俯仰角(Pitch) - * - * @return Pitch 角度 - */ - float getPitch(); - - /** - * 获取玩家生命值 - * - * @return 当前生命值 - */ - float getHealth(); - - /** - * 获取玩家最大生命值 - * - * @return 最大生命值 - */ - float getMaxHealth(); - - /** - * 获取玩家饥饿值 - * - * @return 饥饿值 (0-20) - */ - int getFoodLevel(); - - /** - * 是否在地面上 - * - * @return true 如果在地面上 - */ - boolean isOnGround(); - - /** - * 是否在潜行 - * - * @return true 如果在潜行 - */ - boolean isSneaking(); - - /** - * 是否在疾跑 - * - * @return true 如果在疾跑 - */ - boolean isSprinting(); - - /** - * 获取手持物品(使用简化的物品数据) - * - * @return 物品数据,可能为 null - */ - @Nullable - IItemStack getHeldItem(); - - /** - * 获取护甲栏物品列表 - * 索引 0-3 分别对应:靴子、护腿、胸甲、头盔 - * - * @return 护甲物品列表(固定4个元素,可能包含null) - */ - List getArmorItems(); - - /** - * 获取网络延迟(ms) - * - * @return 延迟毫秒数 - */ - int getPing(); - - /** - * 发送聊天消息 - * - * @param message 消息内容 - */ - void sendChatMessage(String message); - - /** - * 获取玩家的移动速度 - * - * @return 速度向量 - */ - Vec3 getMotion(); - - /** - * 获取下落距离(用于摔落伤害计算) - * - * @return 下落距离 - */ - float getFallDistance(); - - /** - * 获取实体 ID - * - * @return 实体 ID - */ - int getEntityId(); - - /** - * 获取原始 Minecraft 玩家实体(用于需要底层访问的功能) - * 注意:这是版本相关的原生类型,仅在必要时使用(如战斗机制) - * 返回类型为 EntityPlayerSP 在 1.8.9/1.12.2 - * - * @return Minecraft 原生玩家实体 - */ - Object getRawPlayer(); -} diff --git a/shared/java/top/fpsmaster/api/domain/client/IGameSettings.java b/shared/java/top/fpsmaster/api/domain/client/IGameSettings.java deleted file mode 100644 index 9dcc470a..00000000 --- a/shared/java/top/fpsmaster/api/domain/client/IGameSettings.java +++ /dev/null @@ -1,79 +0,0 @@ -package top.fpsmaster.api.domain.client; - -/** - * 游戏设置接口 - * 注意:不直接暴露 KeyBinding 等 Minecraft 内部类 - */ -public interface IGameSettings { - - /** - * 设置按键按下状态(通过按键名称) - * - * @param keyName 按键名称,如 "key.forward", "key.attack" 等 - * @param pressed 是否按下 - */ - void setKeyPressed(String keyName, boolean pressed); - - /** - * 获取视距(区块数) - * - * @return 渲染距离(区块数) - */ - int getRenderDistance(); - - /** - * 设置视距 - * - * @param chunks 区块数 - */ - void setRenderDistance(int chunks); - - /** - * 获取鼠标灵敏度 (0.0 - 1.0) - * - * @return 灵敏度值 - */ - float getMouseSensitivity(); - - /** - * 设置鼠标灵敏度 - * - * @param sensitivity 灵敏度值 (0.0 - 1.0) - */ - void setMouseSensitivity(float sensitivity); - - /** - * 是否显示调试信息(F3) - * - * @return true 如果显示调试信息 - */ - boolean isShowDebugInfo(); - - /** - * 获取 GUI 缩放级别 - * - * @return GUI 缩放级别 - */ - int getGuiScale(); - - /** - * 获取 FOV 设置值 - * - * @return FOV 值 - */ - float getFov(); - - /** - * 是否启用 VSync - * - * @return true 如果启用垂直同步 - */ - boolean isVsyncEnabled(); - - /** - * 获取帧率限制 - * - * @return 帧率限制值 - */ - int getFramerateLimit(); -} diff --git a/shared/java/top/fpsmaster/api/domain/client/IItemStack.java b/shared/java/top/fpsmaster/api/domain/client/IItemStack.java deleted file mode 100644 index 73074c47..00000000 --- a/shared/java/top/fpsmaster/api/domain/client/IItemStack.java +++ /dev/null @@ -1,83 +0,0 @@ -package top.fpsmaster.api.domain.client; - -import org.jetbrains.annotations.Nullable; - -import java.util.Map; - -/** - * 物品堆接口 - * 使用简化数据结构,不直接暴露 ItemStack - */ -public interface IItemStack { - - /** - * 获取物品 ID - * - * @return 资源位置,如 "minecraft:diamond_sword" - */ - String getItemId(); - - /** - * 获取物品显示名称 - * - * @return 显示名称 - */ - String getDisplayName(); - - /** - * 获取数量 - * - * @return 物品数量 - */ - int getCount(); - - /** - * 获取耐久度(当前/最大) - * - * @return 数组 [current, max],如果不可损坏则返回 null - */ - @Nullable - int[] getDurability(); - - /** - * 是否有附魔 - * - * @return true 如果物品有附魔 - */ - boolean isEnchanted(); - - /** - * 获取附魔列表 - * - * @return Map<附魔ID, 等级>,如 {"minecraft:sharpness": 5} - */ - Map getEnchantments(); - - /** - * 获取物品标签数据(简化的 NBT) - * - * @return 键值对,只包含基础类型 - */ - Map getNbtData(); - - /** - * 是否为空 - * - * @return true 如果物品为空或数量为0 - */ - boolean isEmpty(); - - /** - * 是否可堆叠 - * - * @return true 如果可堆叠 - */ - boolean isStackable(); - - /** - * 获取最大堆叠数量 - * - * @return 最大堆叠数 - */ - int getMaxStackSize(); -} diff --git a/shared/java/top/fpsmaster/api/domain/client/IMinecraft.java b/shared/java/top/fpsmaster/api/domain/client/IMinecraft.java deleted file mode 100644 index 385dc1fb..00000000 --- a/shared/java/top/fpsmaster/api/domain/client/IMinecraft.java +++ /dev/null @@ -1,49 +0,0 @@ -package top.fpsmaster.api.domain.client; - -/** - * Minecraft 实例接口 - * 提供 Minecraft 客户端的核心功能 - */ -public interface IMinecraft { - - /** - * 是否单人游戏 - * - * @return true 如果是单人游戏 - */ - boolean isSingleplayer(); - - /** - * 获取帧率限制 - * - * @return 帧率限制值 - */ - int getFramerateLimit(); - - /** - * 获取渲染部分刻 - * - * @return 部分刻值 (0.0 - 1.0) - */ - float getPartialTicks(); - - /** - * 移除左键点击延迟 - */ - void removeLeftClickDelay(); - - /** - * 打印聊天消息(使用文本字符串) - * - * @param message 消息文本 - */ - void printChatMessage(String message); - - /** - * 获取字体渲染器(渲染文字用) - * 注意:返回 Minecraft 原生类型,用于渲染功能 - * - * @return FontRenderer 实例 - */ - Object getFontRenderer(); -} diff --git a/shared/java/top/fpsmaster/api/domain/entity/IEntity.java b/shared/java/top/fpsmaster/api/domain/entity/IEntity.java deleted file mode 100644 index 7d49b7a5..00000000 --- a/shared/java/top/fpsmaster/api/domain/entity/IEntity.java +++ /dev/null @@ -1,139 +0,0 @@ -package top.fpsmaster.api.domain.entity; - -import top.fpsmaster.api.model.Vec3; - -import java.util.List; - -/** - * 实体接口 - * 代表游戏中的任意实体(玩家、生物、物品等) - */ -public interface IEntity { - - /** - * 获取实体唯一ID - * - * @return 实体ID - */ - int getEntityId(); - - /** - * 获取实体UUID - * - * @return UUID字符串 - */ - String getUUID(); - - /** - * 获取实体位置 - * - * @return 位置向量 - */ - Vec3 getPosition(); - - /** - * 获取实体名称 - * - * @return 实体名称 - */ - String getName(); - - /** - * 获取自定义名称 - * - * @return 自定义名称,如果没有则返回 null - */ - String getCustomName(); - - /** - * 是否有自定义名称 - * - * @return true 如果有自定义名称 - */ - boolean hasCustomName(); - - /** - * 获取实体视角方向(yaw) - * - * @return yaw角度 - */ - float getYaw(); - - /** - * 获取实体俯仰角(pitch) - * - * @return pitch角度 - */ - float getPitch(); - - /** - * 获取实体速度 - * - * @return 速度向量 - */ - Vec3 getMotion(); - - /** - * 实体是否在地面上 - * - * @return true 如果在地面 - */ - boolean isOnGround(); - - /** - * 实体是否在水中 - * - * @return true 如果在水中 - */ - boolean isInWater(); - - /** - * 实体是否在岩浆中 - * - * @return true 如果在岩浆中 - */ - boolean isInLava(); - - /** - * 实体是否燃烧 - * - * @return true 如果燃烧 - */ - boolean isBurning(); - - /** - * 实体是否潜行 - * - * @return true 如果潜行 - */ - boolean isSneaking(); - - /** - * 实体是否疾跑 - * - * @return true 如果疾跑 - */ - boolean isSprinting(); - - /** - * 实体是否隐身 - * - * @return true 如果隐身 - */ - boolean isInvisible(); - - /** - * 获取实体到另一个位置的距离 - * - * @param pos 目标位置 - * @return 距离 - */ - double getDistanceTo(Vec3 pos); - - /** - * 获取实体的眼睛高度 - * - * @return 眼睛高度 - */ - float getEyeHeight(); -} diff --git a/shared/java/top/fpsmaster/api/domain/entity/IEntityAPI.java b/shared/java/top/fpsmaster/api/domain/entity/IEntityAPI.java deleted file mode 100644 index 4dfa0f35..00000000 --- a/shared/java/top/fpsmaster/api/domain/entity/IEntityAPI.java +++ /dev/null @@ -1,44 +0,0 @@ -package top.fpsmaster.api.domain.entity; - -import top.fpsmaster.api.model.Vec3; - -import java.util.List; - -/** - * 实体 API - * 提供实体相关的所有功能 - */ -public interface IEntityAPI { - - /** - * 获取所有加载的实体 - * - * @return 实体列表 - */ - List getAllEntities(); - - /** - * 根据ID获取实体 - * - * @param entityId 实体ID - * @return 实体对象,未找到则返回 null - */ - IEntity getEntityById(int entityId); - - /** - * 获取玩家附近的实体 - * - * @param radius 半径 - * @return 实体列表 - */ - List getNearbyEntities(double radius); - - /** - * 获取指定位置附近的实体 - * - * @param pos 中心位置 - * @param radius 半径 - * @return 实体列表 - */ - List getNearbyEntities(Vec3 pos, double radius); -} diff --git a/shared/java/top/fpsmaster/api/domain/gui/IGuiAPI.java b/shared/java/top/fpsmaster/api/domain/gui/IGuiAPI.java deleted file mode 100644 index 548c8e5b..00000000 --- a/shared/java/top/fpsmaster/api/domain/gui/IGuiAPI.java +++ /dev/null @@ -1,15 +0,0 @@ -package top.fpsmaster.api.domain.gui; - -/** - * GUI API - * 提供 GUI 相关的所有功能 - */ -public interface IGuiAPI { - - /** - * 获取游戏内 GUI 管理器 - * - * @return GUI Ingame 实例 - */ - IGuiIngame getGuiIngame(); -} diff --git a/shared/java/top/fpsmaster/api/domain/gui/IGuiIngame.java b/shared/java/top/fpsmaster/api/domain/gui/IGuiIngame.java deleted file mode 100644 index 950a61e7..00000000 --- a/shared/java/top/fpsmaster/api/domain/gui/IGuiIngame.java +++ /dev/null @@ -1,14 +0,0 @@ -package top.fpsmaster.api.domain.gui; - -/** - * 游戏内 GUI 接口 - */ -public interface IGuiIngame { - - /** - * 打印聊天消息 - * - * @param message 消息文本 - */ - void printChatMessage(String message); -} diff --git a/shared/java/top/fpsmaster/api/domain/network/IChatPacketHandler.java b/shared/java/top/fpsmaster/api/domain/network/IChatPacketHandler.java deleted file mode 100644 index 0c7e3a11..00000000 --- a/shared/java/top/fpsmaster/api/domain/network/IChatPacketHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -package top.fpsmaster.api.domain.network; - -import org.jetbrains.annotations.NotNull; - -/** - * 聊天包处理器 - */ -public interface IChatPacketHandler { - - /** - * 判断是否为聊天包 - * - * @param packet 数据包对象 - * @return true 如果是聊天包 - */ - boolean isChatPacket(@NotNull Object packet); - - /** - * 从包中获取未格式化的文本 - * - * @param packet 数据包对象 - * @return 未格式化的文本 - */ - @NotNull - String getUnformattedText(@NotNull Object packet); - - /** - * 获取聊天类型 - * - * @param packet 数据包对象 - * @return 聊天类型(0=聊天,1=系统消息,2=游戏信息) - */ - int getChatType(@NotNull Object packet); -} diff --git a/shared/java/top/fpsmaster/api/domain/network/INetworkAPI.java b/shared/java/top/fpsmaster/api/domain/network/INetworkAPI.java deleted file mode 100644 index d089c7ed..00000000 --- a/shared/java/top/fpsmaster/api/domain/network/INetworkAPI.java +++ /dev/null @@ -1,29 +0,0 @@ -package top.fpsmaster.api.domain.network; - -/** - * 网络 API - * 提供网络包相关的所有功能 - */ -public interface INetworkAPI { - - /** - * 获取聊天包解析器 - * - * @return 聊天包处理器 - */ - IChatPacketHandler getChatPacketHandler(); - - /** - * 获取玩家列表包处理器 - * - * @return 玩家列表包处理器 - */ - IPlayerListPacketHandler getPlayerListPacketHandler(); - - /** - * 获取时间更新包处理器 - * - * @return 时间更新包处理器 - */ - ITimeUpdatePacketHandler getTimeUpdatePacketHandler(); -} diff --git a/shared/java/top/fpsmaster/api/domain/network/IPlayerListPacketHandler.java b/shared/java/top/fpsmaster/api/domain/network/IPlayerListPacketHandler.java deleted file mode 100644 index 6435fd13..00000000 --- a/shared/java/top/fpsmaster/api/domain/network/IPlayerListPacketHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -package top.fpsmaster.api.domain.network; - -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -/** - * 玩家列表包处理器 - */ -public interface IPlayerListPacketHandler { - - /** - * 判断是否为玩家列表包 - * - * @param packet 数据包对象 - * @return true 如果是玩家列表包 - */ - boolean isPlayerListPacket(@NotNull Object packet); - - /** - * 判断是否为加入动作 - * - * @param packet 数据包对象 - * @return true 如果是加入动作 - */ - boolean isActionAdd(@NotNull Object packet); - - /** - * 判断是否为离开动作 - * - * @param packet 数据包对象 - * @return true 如果是离开动作 - */ - boolean isActionRemove(@NotNull Object packet); - - /** - * 获取玩家名称列表 - * - * @param packet 数据包对象 - * @return 玩家名称列表 - */ - List getPlayerNames(@NotNull Object packet); -} diff --git a/shared/java/top/fpsmaster/api/domain/network/ITimeUpdatePacketHandler.java b/shared/java/top/fpsmaster/api/domain/network/ITimeUpdatePacketHandler.java deleted file mode 100644 index c71dd2fa..00000000 --- a/shared/java/top/fpsmaster/api/domain/network/ITimeUpdatePacketHandler.java +++ /dev/null @@ -1,25 +0,0 @@ -package top.fpsmaster.api.domain.network; - -import org.jetbrains.annotations.NotNull; - -/** - * 时间更新包处理器 - */ -public interface ITimeUpdatePacketHandler { - - /** - * 判断是否为时间更新包 - * - * @param packet 数据包对象 - * @return true 如果是时间更新包 - */ - boolean isTimeUpdatePacket(@NotNull Object packet); - - /** - * 获取世界时间 - * - * @param packet 数据包对象 - * @return 世界时间 - */ - long getWorldTime(@NotNull Object packet); -} diff --git a/shared/java/top/fpsmaster/api/domain/render/IParticleManager.java b/shared/java/top/fpsmaster/api/domain/render/IParticleManager.java deleted file mode 100644 index ffab4e5b..00000000 --- a/shared/java/top/fpsmaster/api/domain/render/IParticleManager.java +++ /dev/null @@ -1,24 +0,0 @@ -package top.fpsmaster.api.domain.render; - -import top.fpsmaster.api.model.BlockPos; - -/** - * 粒子管理器接口 - */ -public interface IParticleManager { - - /** - * 添加红石破碎粒子效果 - * - * @param pos 方块位置 - */ - void addRedstoneBreakParticle(BlockPos pos); - - /** - * 添加方块破坏粒子 - * - * @param pos 方块位置 - * @param blockId 方块ID - */ - void addBlockBreakParticle(BlockPos pos, String blockId); -} diff --git a/shared/java/top/fpsmaster/api/domain/render/IRenderAPI.java b/shared/java/top/fpsmaster/api/domain/render/IRenderAPI.java deleted file mode 100644 index 708321c9..00000000 --- a/shared/java/top/fpsmaster/api/domain/render/IRenderAPI.java +++ /dev/null @@ -1,29 +0,0 @@ -package top.fpsmaster.api.domain.render; - -/** - * 渲染 API - * 提供渲染相关的所有功能 - */ -public interface IRenderAPI { - - /** - * 获取渲染管理器 - * - * @return 渲染管理器实例 - */ - IRenderManager getRenderManager(); - - /** - * 获取渲染部分刻 - * - * @return 部分刻值 (0.0 - 1.0) - */ - float getPartialTicks(); - - /** - * 获取粒子管理器 - * - * @return 粒子管理器实例 - */ - IParticleManager getParticleManager(); -} diff --git a/shared/java/top/fpsmaster/api/domain/render/IRenderManager.java b/shared/java/top/fpsmaster/api/domain/render/IRenderManager.java deleted file mode 100644 index 7f774a68..00000000 --- a/shared/java/top/fpsmaster/api/domain/render/IRenderManager.java +++ /dev/null @@ -1,28 +0,0 @@ -package top.fpsmaster.api.domain.render; - -/** - * 渲染管理器接口 - */ -public interface IRenderManager { - - /** - * 获取渲染位置 X - * - * @return 渲染偏移 X 坐标 - */ - double getRenderPosX(); - - /** - * 获取渲染位置 Y - * - * @return 渲染偏移 Y 坐标 - */ - double getRenderPosY(); - - /** - * 获取渲染位置 Z - * - * @return 渲染偏移 Z 坐标 - */ - double getRenderPosZ(); -} diff --git a/shared/java/top/fpsmaster/api/domain/sound/ISoundAPI.java b/shared/java/top/fpsmaster/api/domain/sound/ISoundAPI.java deleted file mode 100644 index 4e9172b6..00000000 --- a/shared/java/top/fpsmaster/api/domain/sound/ISoundAPI.java +++ /dev/null @@ -1,41 +0,0 @@ -package top.fpsmaster.api.domain.sound; - -/** - * 音效 API - * 提供音效相关的所有功能 - */ -public interface ISoundAPI { - - /** - * 播放雷电音效 - * - * @param x 位置 X - * @param y 位置 Y - * @param z 位置 Z - * @param volume 音量 - * @param pitch 音调 - */ - void playLightningSound(double x, double y, double z, float volume, float pitch); - - /** - * 播放爆炸音效 - * - * @param x 位置 X - * @param y 位置 Y - * @param z 位置 Z - * @param volume 音量 - * @param pitch 音调 - */ - void playExplosionSound(double x, double y, double z, float volume, float pitch); - - /** - * 播放红石破碎音效 - * - * @param x 位置 X - * @param y 位置 Y - * @param z 位置 Z - * @param volume 音量 - * @param pitch 音调 - */ - void playRedstoneBreakSound(double x, double y, double z, float volume, float pitch); -} diff --git a/shared/java/top/fpsmaster/api/domain/world/IWorld.java b/shared/java/top/fpsmaster/api/domain/world/IWorld.java deleted file mode 100644 index cdcf74e0..00000000 --- a/shared/java/top/fpsmaster/api/domain/world/IWorld.java +++ /dev/null @@ -1,103 +0,0 @@ -package top.fpsmaster.api.domain.world; - -import org.jetbrains.annotations.Nullable; -import top.fpsmaster.api.model.BlockPos; -import top.fpsmaster.api.model.WeatherType; - -/** - * 世界接口 - * 注意:完全不依赖 Minecraft 原生类型 - */ -public interface IWorld { - - /** - * 获取世界名称 - * - * @return 世界名称 - */ - String getWorldName(); - - /** - * 获取世界时间(tick) - * - * @return 世界时间 - */ - long getWorldTime(); - - /** - * 设置世界时间 - * - * @param time 新的世界时间 - */ - void setWorldTime(long time); - - /** - * 获取方块 ID - * - * @param pos 方块位置 - * @return 方块的资源位置,如 "minecraft:stone" - */ - String getBlockId(BlockPos pos); - - /** - * 检查是否为空气方块 - * - * @param pos 方块位置 - * @return true 如果是空气 - */ - boolean isAirBlock(BlockPos pos); - - /** - * 获取世界出生点 - * - * @return 出生点位置 - */ - BlockPos getSpawnPoint(); - - /** - * 获取天气状态 - * - * @return 天气类型 - */ - WeatherType getWeatherType(); - - /** - * 获取雨强度 - * - * @return 雨强度 (0.0 - 1.0) - */ - float getRainStrength(); - - /** - * 获取方块光照等级 - * - * @param pos 方块位置 - * @return 光照等级 (0-15) - */ - int getLightLevel(BlockPos pos); - - /** - * 获取天空光照等级 - * - * @param pos 方块位置 - * @return 天空光照等级 (0-15) - */ - int getSkyLightLevel(BlockPos pos); - - /** - * 获取方块发出的光照等级 - * - * @param pos 方块位置 - * @return 方块光照等级 (0-15) - */ - int getBlockLightLevel(BlockPos pos); - - /** - * 获取原始 Minecraft 世界对象(用于需要底层访问的功能) - * 注意:这是版本相关的原生类型,仅在必要时使用 - * 返回类型为 WorldClient 在 1.8.9/1.12.2 - * - * @return Minecraft 原生世界对象 - */ - Object getRawWorld(); -} diff --git a/shared/java/top/fpsmaster/api/domain/world/IWorldAPI.java b/shared/java/top/fpsmaster/api/domain/world/IWorldAPI.java deleted file mode 100644 index 046e370f..00000000 --- a/shared/java/top/fpsmaster/api/domain/world/IWorldAPI.java +++ /dev/null @@ -1,18 +0,0 @@ -package top.fpsmaster.api.domain.world; - -import org.jetbrains.annotations.Nullable; - -/** - * 世界 API - * 提供世界相关的所有功能 - */ -public interface IWorldAPI { - - /** - * 获取当前客户端世界 - * - * @return 世界实例,可能为 null(未加入世界时) - */ - @Nullable - IWorld getWorld(); -} diff --git a/shared/java/top/fpsmaster/api/interfaces/IWorld.java b/shared/java/top/fpsmaster/api/interfaces/IWorld.java deleted file mode 100644 index 2c4e536f..00000000 --- a/shared/java/top/fpsmaster/api/interfaces/IWorld.java +++ /dev/null @@ -1,4 +0,0 @@ -package top.fpsmaster.api.interfaces; - -public interface IWorld { -} diff --git a/shared/java/top/fpsmaster/api/interfaces/client/IClientPlayerEntity.java b/shared/java/top/fpsmaster/api/interfaces/client/IClientPlayerEntity.java deleted file mode 100644 index 319f5e30..00000000 --- a/shared/java/top/fpsmaster/api/interfaces/client/IClientPlayerEntity.java +++ /dev/null @@ -1,6 +0,0 @@ -package top.fpsmaster.api.interfaces.client; - -import top.fpsmaster.api.interfaces.entity.IPlayerEntity; - -public interface IClientPlayerEntity extends IPlayerEntity { -} diff --git a/shared/java/top/fpsmaster/api/interfaces/client/IMinecraft.java b/shared/java/top/fpsmaster/api/interfaces/client/IMinecraft.java deleted file mode 100644 index c24d0e48..00000000 --- a/shared/java/top/fpsmaster/api/interfaces/client/IMinecraft.java +++ /dev/null @@ -1,13 +0,0 @@ -package top.fpsmaster.api.interfaces.client; - -import org.jetbrains.annotations.Nullable; -import top.fpsmaster.api.interfaces.client.settings.IGameSettings; -import top.fpsmaster.api.interfaces.client.settings.IKeyBinding; - -public interface IMinecraft { - @Nullable IClientPlayerEntity getClientPlayer(); - - IKeyBinding getKeyBinding(); - - IGameSettings getGameSettings(); -} diff --git a/shared/java/top/fpsmaster/api/interfaces/client/settings/IGameSettings.java b/shared/java/top/fpsmaster/api/interfaces/client/settings/IGameSettings.java deleted file mode 100644 index c8546e6a..00000000 --- a/shared/java/top/fpsmaster/api/interfaces/client/settings/IGameSettings.java +++ /dev/null @@ -1,5 +0,0 @@ -package top.fpsmaster.api.interfaces.client.settings; - -public interface IGameSettings { - IKeyBinding getKeyBindSprint(); -} diff --git a/shared/java/top/fpsmaster/api/interfaces/client/settings/IKeyBinding.java b/shared/java/top/fpsmaster/api/interfaces/client/settings/IKeyBinding.java deleted file mode 100644 index 5dceca81..00000000 --- a/shared/java/top/fpsmaster/api/interfaces/client/settings/IKeyBinding.java +++ /dev/null @@ -1,7 +0,0 @@ -package top.fpsmaster.api.interfaces.client.settings; - -public interface IKeyBinding { - void setKeyBindState(int keyCode, boolean state); - - int getKeyCode(); -} diff --git a/shared/java/top/fpsmaster/api/interfaces/entity/IPlayerEntity.java b/shared/java/top/fpsmaster/api/interfaces/entity/IPlayerEntity.java deleted file mode 100644 index 95b143f9..00000000 --- a/shared/java/top/fpsmaster/api/interfaces/entity/IPlayerEntity.java +++ /dev/null @@ -1,15 +0,0 @@ -package top.fpsmaster.api.interfaces.entity; - -import org.jetbrains.annotations.NotNull; - -import java.util.UUID; - -public interface IPlayerEntity { - @NotNull String getName(); - - @NotNull UUID getUniqueId(); - - boolean isSprinting(); - - void setSprinting(boolean sprinting); -} diff --git a/shared/java/top/fpsmaster/api/model/AxisAlignedBB.java b/shared/java/top/fpsmaster/api/model/AxisAlignedBB.java deleted file mode 100644 index 22668a42..00000000 --- a/shared/java/top/fpsmaster/api/model/AxisAlignedBB.java +++ /dev/null @@ -1,158 +0,0 @@ -package top.fpsmaster.api.model; - -import java.util.Objects; - -/** - * 轴对齐包围盒(值对象) - * 不可变对象,线程安全 - * - * 注意: 这是自定义的 AxisAlignedBB,不依赖 Minecraft 的 AxisAlignedBB - */ -public final class AxisAlignedBB { - public final double minX; - public final double minY; - public final double minZ; - public final double maxX; - public final double maxY; - public final double maxZ; - - public AxisAlignedBB(double minX, double minY, double minZ, - double maxX, double maxY, double maxZ) { - this.minX = Math.min(minX, maxX); - this.minY = Math.min(minY, maxY); - this.minZ = Math.min(minZ, maxZ); - this.maxX = Math.max(minX, maxX); - this.maxY = Math.max(minY, maxY); - this.maxZ = Math.max(minZ, maxZ); - } - - /** - * 从方块位置创建 - */ - public static AxisAlignedBB fromBlock(BlockPos pos) { - return new AxisAlignedBB( - pos.getX(), pos.getY(), pos.getZ(), - pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1 - ); - } - - /** - * 从两个点创建 - */ - public static AxisAlignedBB fromPoints(Vec3 pos1, Vec3 pos2) { - return new AxisAlignedBB(pos1.x, pos1.y, pos1.z, pos2.x, pos2.y, pos2.z); - } - - /** - * 扩展包围盒 - */ - public AxisAlignedBB expand(double x, double y, double z) { - return new AxisAlignedBB( - minX - x, minY - y, minZ - z, - maxX + x, maxY + y, maxZ + z - ); - } - - /** - * 统一扩展 - */ - public AxisAlignedBB expand(double value) { - return expand(value, value, value); - } - - /** - * 收缩包围盒 - */ - public AxisAlignedBB contract(double x, double y, double z) { - return new AxisAlignedBB( - minX + x, minY + y, minZ + z, - maxX - x, maxY - y, maxZ - z - ); - } - - /** - * 偏移包围盒 - */ - public AxisAlignedBB offset(double x, double y, double z) { - return new AxisAlignedBB( - minX + x, minY + y, minZ + z, - maxX + x, maxY + y, maxZ + z - ); - } - - /** - * 偏移包围盒 - */ - public AxisAlignedBB offset(Vec3 vec) { - return offset(vec.x, vec.y, vec.z); - } - - /** - * 检查是否相交 - */ - public boolean intersects(AxisAlignedBB other) { - return maxX > other.minX && minX < other.maxX && - maxY > other.minY && minY < other.maxY && - maxZ > other.minZ && minZ < other.maxZ; - } - - /** - * 检查是否包含点 - */ - public boolean contains(Vec3 point) { - return point.x >= minX && point.x <= maxX && - point.y >= minY && point.y <= maxY && - point.z >= minZ && point.z <= maxZ; - } - - /** - * 检查是否包含点(带容差) - */ - public boolean contains(double x, double y, double z) { - return x >= minX && x <= maxX && - y >= minY && y <= maxY && - z >= minZ && z <= maxZ; - } - - /** - * 获取中心点 - */ - public Vec3 getCenter() { - return new Vec3( - (minX + maxX) / 2.0, - (minY + maxY) / 2.0, - (minZ + maxZ) / 2.0 - ); - } - - /** - * 获取体积 - */ - public double getVolume() { - return (maxX - minX) * (maxY - minY) * (maxZ - minZ); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - AxisAlignedBB that = (AxisAlignedBB) o; - return Double.compare(that.minX, minX) == 0 && - Double.compare(that.minY, minY) == 0 && - Double.compare(that.minZ, minZ) == 0 && - Double.compare(that.maxX, maxX) == 0 && - Double.compare(that.maxY, maxY) == 0 && - Double.compare(that.maxZ, maxZ) == 0; - } - - @Override - public int hashCode() { - return Objects.hash(minX, minY, minZ, maxX, maxY, maxZ); - } - - @Override - public String toString() { - return String.format("AABB{min=(%.2f,%.2f,%.2f), max=(%.2f,%.2f,%.2f)}", - minX, minY, minZ, maxX, maxY, maxZ); - } -} diff --git a/shared/java/top/fpsmaster/api/model/BlockPos.java b/shared/java/top/fpsmaster/api/model/BlockPos.java deleted file mode 100644 index 01435c77..00000000 --- a/shared/java/top/fpsmaster/api/model/BlockPos.java +++ /dev/null @@ -1,107 +0,0 @@ -package top.fpsmaster.api.model; - -import java.util.Objects; - -/** - * 方块位置(值对象) - * 不可变对象,线程安全 - * - * 注意: 这是自定义的 BlockPos,不依赖 Minecraft 的 BlockPos - */ -public final class BlockPos { - private final int x; - private final int y; - private final int z; - - public BlockPos(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - public int getX() { - return x; - } - - public int getY() { - return y; - } - - public int getZ() { - return z; - } - - /** - * 创建新的偏移位置 - */ - public BlockPos add(int dx, int dy, int dz) { - return new BlockPos(x + dx, y + dy, z + dz); - } - - /** - * 向指定方向偏移 - */ - public BlockPos offset(Direction direction) { - return add(direction.getOffsetX(), direction.getOffsetY(), direction.getOffsetZ()); - } - - /** - * 向上偏移 - */ - public BlockPos up() { - return add(0, 1, 0); - } - - /** - * 向下偏移 - */ - public BlockPos down() { - return add(0, -1, 0); - } - - /** - * 向北偏移 - */ - public BlockPos north() { - return add(0, 0, -1); - } - - /** - * 向南偏移 - */ - public BlockPos south() { - return add(0, 0, 1); - } - - /** - * 向西偏移 - */ - public BlockPos west() { - return add(-1, 0, 0); - } - - /** - * 向东偏移 - */ - public BlockPos east() { - return add(1, 0, 0); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - BlockPos blockPos = (BlockPos) o; - return x == blockPos.x && y == blockPos.y && z == blockPos.z; - } - - @Override - public int hashCode() { - return Objects.hash(x, y, z); - } - - @Override - public String toString() { - return "BlockPos{x=" + x + ", y=" + y + ", z=" + z + "}"; - } -} diff --git a/shared/java/top/fpsmaster/api/model/Difficulty.java b/shared/java/top/fpsmaster/api/model/Difficulty.java deleted file mode 100644 index d732a1d4..00000000 --- a/shared/java/top/fpsmaster/api/model/Difficulty.java +++ /dev/null @@ -1,51 +0,0 @@ -package top.fpsmaster.api.model; - -/** - * 难度枚举 - */ -public enum Difficulty { - /** - * 和平 - */ - PEACEFUL(0, "peaceful"), - - /** - * 简单 - */ - EASY(1, "easy"), - - /** - * 普通 - */ - NORMAL(2, "normal"), - - /** - * 困难 - */ - HARD(3, "hard"); - - private final int id; - private final String name; - - Difficulty(int id, String name) { - this.id = id; - this.name = name; - } - - public int getId() { - return id; - } - - public String getName() { - return name; - } - - public static Difficulty fromId(int id) { - for (Difficulty difficulty : values()) { - if (difficulty.id == id) { - return difficulty; - } - } - return NORMAL; - } -} diff --git a/shared/java/top/fpsmaster/api/model/Direction.java b/shared/java/top/fpsmaster/api/model/Direction.java deleted file mode 100644 index 87541f83..00000000 --- a/shared/java/top/fpsmaster/api/model/Direction.java +++ /dev/null @@ -1,56 +0,0 @@ -package top.fpsmaster.api.model; - -/** - * 方向枚举 - */ -public enum Direction { - DOWN(0, -1, 0, "down"), - UP(0, 1, 0, "up"), - NORTH(0, 0, -1, "north"), - SOUTH(0, 0, 1, "south"), - WEST(-1, 0, 0, "west"), - EAST(1, 0, 0, "east"); - - private final int offsetX; - private final int offsetY; - private final int offsetZ; - private final String name; - - Direction(int offsetX, int offsetY, int offsetZ, String name) { - this.offsetX = offsetX; - this.offsetY = offsetY; - this.offsetZ = offsetZ; - this.name = name; - } - - public int getOffsetX() { - return offsetX; - } - - public int getOffsetY() { - return offsetY; - } - - public int getOffsetZ() { - return offsetZ; - } - - public String getName() { - return name; - } - - /** - * 获取相反方向 - */ - public Direction getOpposite() { - switch (this) { - case DOWN: return UP; - case UP: return DOWN; - case NORTH: return SOUTH; - case SOUTH: return NORTH; - case WEST: return EAST; - case EAST: return WEST; - default: return this; - } - } -} diff --git a/shared/java/top/fpsmaster/api/model/GameMode.java b/shared/java/top/fpsmaster/api/model/GameMode.java deleted file mode 100644 index 2f11beb0..00000000 --- a/shared/java/top/fpsmaster/api/model/GameMode.java +++ /dev/null @@ -1,51 +0,0 @@ -package top.fpsmaster.api.model; - -/** - * 游戏模式枚举 - */ -public enum GameMode { - /** - * 生存模式 - */ - SURVIVAL(0, "survival"), - - /** - * 创造模式 - */ - CREATIVE(1, "creative"), - - /** - * 冒险模式 - */ - ADVENTURE(2, "adventure"), - - /** - * 旁观者模式 - */ - SPECTATOR(3, "spectator"); - - private final int id; - private final String name; - - GameMode(int id, String name) { - this.id = id; - this.name = name; - } - - public int getId() { - return id; - } - - public String getName() { - return name; - } - - public static GameMode fromId(int id) { - for (GameMode mode : values()) { - if (mode.id == id) { - return mode; - } - } - return SURVIVAL; - } -} diff --git a/shared/java/top/fpsmaster/api/model/ParticleType.java b/shared/java/top/fpsmaster/api/model/ParticleType.java deleted file mode 100644 index 4d840feb..00000000 --- a/shared/java/top/fpsmaster/api/model/ParticleType.java +++ /dev/null @@ -1,50 +0,0 @@ -package top.fpsmaster.api.model; - -/** - * 粒子类型枚举 - * 注意: 这是自定义枚举,不依赖 Minecraft 的 EnumParticleTypes - */ -public enum ParticleType { - EXPLOSION_NORMAL, - EXPLOSION_LARGE, - EXPLOSION_HUGE, - FIREWORKS_SPARK, - WATER_BUBBLE, - WATER_SPLASH, - WATER_WAKE, - SUSPENDED, - SUSPENDED_DEPTH, - CRIT, - CRIT_MAGIC, - SMOKE_NORMAL, - SMOKE_LARGE, - SPELL, - SPELL_INSTANT, - SPELL_MOB, - SPELL_MOB_AMBIENT, - SPELL_WITCH, - DRIP_WATER, - DRIP_LAVA, - VILLAGER_ANGRY, - VILLAGER_HAPPY, - TOWN_AURA, - NOTE, - PORTAL, - ENCHANTMENT_TABLE, - FLAME, - LAVA, - FOOTSTEP, - CLOUD, - REDSTONE, - SNOWBALL, - SNOW_SHOVEL, - SLIME, - HEART, - BARRIER, - ITEM_CRACK, - BLOCK_CRACK, - BLOCK_DUST, - WATER_DROP, - ITEM_TAKE, - MOB_APPEARANCE -} diff --git a/shared/java/top/fpsmaster/api/model/Vec3.java b/shared/java/top/fpsmaster/api/model/Vec3.java deleted file mode 100644 index 71623acc..00000000 --- a/shared/java/top/fpsmaster/api/model/Vec3.java +++ /dev/null @@ -1,134 +0,0 @@ -package top.fpsmaster.api.model; - -import java.util.Objects; - -/** - * 三维向量(值对象) - * 不可变对象,线程安全 - * - * 注意: 这是自定义的 Vec3,不依赖 Minecraft 的 Vec3 - */ -public final class Vec3 { - public final double x; - public final double y; - public final double z; - - public Vec3(double x, double y, double z) { - this.x = x; - this.y = y; - this.z = z; - } - - /** - * 零向量 - */ - public static final Vec3 ZERO = new Vec3(0, 0, 0); - - /** - * 向量加法 - */ - public Vec3 add(Vec3 other) { - return new Vec3(x + other.x, y + other.y, z + other.z); - } - - /** - * 向量加法 - */ - public Vec3 add(double dx, double dy, double dz) { - return new Vec3(x + dx, y + dy, z + dz); - } - - /** - * 向量减法 - */ - public Vec3 subtract(Vec3 other) { - return new Vec3(x - other.x, y - other.y, z - other.z); - } - - /** - * 向量缩放 - */ - public Vec3 scale(double factor) { - return new Vec3(x * factor, y * factor, z * factor); - } - - /** - * 计算到另一个向量的距离 - */ - public double distanceTo(Vec3 other) { - double dx = x - other.x; - double dy = y - other.y; - double dz = z - other.z; - return Math.sqrt(dx * dx + dy * dy + dz * dz); - } - - /** - * 计算距离的平方(避免开方运算,性能更好) - */ - public double distanceSquared(Vec3 other) { - double dx = x - other.x; - double dy = y - other.y; - double dz = z - other.z; - return dx * dx + dy * dy + dz * dz; - } - - /** - * 向量长度 - */ - public double length() { - return Math.sqrt(x * x + y * y + z * z); - } - - /** - * 向量长度的平方 - */ - public double lengthSquared() { - return x * x + y * y + z * z; - } - - /** - * 归一化(单位向量) - */ - public Vec3 normalize() { - double len = length(); - return len < 1e-4 ? ZERO : scale(1.0 / len); - } - - /** - * 点积 - */ - public double dot(Vec3 other) { - return x * other.x + y * other.y + z * other.z; - } - - /** - * 叉积 - */ - public Vec3 cross(Vec3 other) { - return new Vec3( - y * other.z - z * other.y, - z * other.x - x * other.z, - x * other.y - y * other.x - ); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Vec3 vec3 = (Vec3) o; - return Double.compare(vec3.x, x) == 0 && - Double.compare(vec3.y, y) == 0 && - Double.compare(vec3.z, z) == 0; - } - - @Override - public int hashCode() { - return Objects.hash(x, y, z); - } - - @Override - public String toString() { - return String.format("Vec3{x=%.2f, y=%.2f, z=%.2f}", x, y, z); - } -} diff --git a/shared/java/top/fpsmaster/api/model/WeatherType.java b/shared/java/top/fpsmaster/api/model/WeatherType.java deleted file mode 100644 index 9e95d1c2..00000000 --- a/shared/java/top/fpsmaster/api/model/WeatherType.java +++ /dev/null @@ -1,21 +0,0 @@ -package top.fpsmaster.api.model; - -/** - * 天气类型枚举 - */ -public enum WeatherType { - /** - * 晴天 - */ - CLEAR, - - /** - * 雨天 - */ - RAIN, - - /** - * 雷雨 - */ - THUNDER -} diff --git a/shared/java/top/fpsmaster/api/provider/IMinecraftProvider.java b/shared/java/top/fpsmaster/api/provider/IMinecraftProvider.java deleted file mode 100644 index db3f4740..00000000 --- a/shared/java/top/fpsmaster/api/provider/IMinecraftProvider.java +++ /dev/null @@ -1,8 +0,0 @@ -package top.fpsmaster.api.provider; - -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.interfaces.client.IMinecraft; - -public interface IMinecraftProvider { - @NotNull IMinecraft getMinecraft(); -} diff --git a/shared/java/top/fpsmaster/api/provider/IProvider.java b/shared/java/top/fpsmaster/api/provider/IProvider.java deleted file mode 100644 index 1f4407fb..00000000 --- a/shared/java/top/fpsmaster/api/provider/IProvider.java +++ /dev/null @@ -1,4 +0,0 @@ -package top.fpsmaster.api.provider; - -public interface IProvider { -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/ProviderRegistry.java b/shared/java/top/fpsmaster/api/provider/ProviderRegistry.java deleted file mode 100644 index a69467ac..00000000 --- a/shared/java/top/fpsmaster/api/provider/ProviderRegistry.java +++ /dev/null @@ -1,11 +0,0 @@ -package top.fpsmaster.api.provider; - -import lombok.Getter; -import lombok.Setter; - -public class ProviderRegistry { - @Getter - @Setter - private static IMinecraftProvider minecraftProvider; - -} diff --git a/shared/java/top/fpsmaster/api/provider/client/IConstantsProvider.java b/shared/java/top/fpsmaster/api/provider/client/IConstantsProvider.java deleted file mode 100644 index f8ff6bd0..00000000 --- a/shared/java/top/fpsmaster/api/provider/client/IConstantsProvider.java +++ /dev/null @@ -1,8 +0,0 @@ -package top.fpsmaster.api.provider.client; - -import top.fpsmaster.api.provider.IProvider; - -public interface IConstantsProvider extends IProvider { - String getVersion(); - String getEdition(); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/game/IGameSettings.java b/shared/java/top/fpsmaster/api/provider/game/IGameSettings.java deleted file mode 100644 index edb44d78..00000000 --- a/shared/java/top/fpsmaster/api/provider/game/IGameSettings.java +++ /dev/null @@ -1,8 +0,0 @@ -package top.fpsmaster.api.provider.game; - -import net.minecraft.client.settings.KeyBinding; -import top.fpsmaster.api.provider.IProvider; - -public interface IGameSettings extends IProvider { - void setKeyPress(KeyBinding key, boolean value); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/game/ILegacyMinecraftProvider.java b/shared/java/top/fpsmaster/api/provider/game/ILegacyMinecraftProvider.java deleted file mode 100644 index 4ed12357..00000000 --- a/shared/java/top/fpsmaster/api/provider/game/ILegacyMinecraftProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -package top.fpsmaster.api.provider.game; - -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Session; -import top.fpsmaster.api.provider.IProvider; - -import java.io.File; -import java.util.Collection; - -public interface ILegacyMinecraftProvider extends IProvider { - Object getCurrentScreen(); - File getGameDir(); - FontRenderer getFontRenderer(); - EntityPlayerSP getPlayer(); - boolean isHoveringOverBlock(); - ItemStack getPlayerHeldItem(); - WorldClient getWorld(); - ItemStack[] getArmorInventory(); - void setSession(Session mojang); - Integer getRespondTime(); - void drawString(String text, float x, float y, int color); - String getServerAddress(); - void removeClickDelay(); - void printChatMessage(Object message); - Collection getPlayerInfoMap(); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/game/ISkinProvider.java b/shared/java/top/fpsmaster/api/provider/game/ISkinProvider.java deleted file mode 100644 index 27e49ac0..00000000 --- a/shared/java/top/fpsmaster/api/provider/game/ISkinProvider.java +++ /dev/null @@ -1,7 +0,0 @@ -package top.fpsmaster.api.provider.game; - -import top.fpsmaster.api.provider.IProvider; - -public interface ISkinProvider extends IProvider { - void updateSkin(String name, String uuid, String skin); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/game/ITimerProvider.java b/shared/java/top/fpsmaster/api/provider/game/ITimerProvider.java deleted file mode 100644 index 42a0ff24..00000000 --- a/shared/java/top/fpsmaster/api/provider/game/ITimerProvider.java +++ /dev/null @@ -1,7 +0,0 @@ -package top.fpsmaster.api.provider.game; - -import top.fpsmaster.api.provider.IProvider; - -public interface ITimerProvider extends IProvider { - float getRenderPartialTicks(); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/game/IUtilityProvider.java b/shared/java/top/fpsmaster/api/provider/game/IUtilityProvider.java deleted file mode 100644 index 2a534ba1..00000000 --- a/shared/java/top/fpsmaster/api/provider/game/IUtilityProvider.java +++ /dev/null @@ -1,15 +0,0 @@ -package top.fpsmaster.api.provider.game; - -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.ResourceLocation; -import top.fpsmaster.api.provider.IProvider; - -public interface IUtilityProvider extends IProvider { - String getResourcePath(ResourceLocation resourceLocation); - double getDistanceToEntity(Entity e1, Entity e2); - boolean isItemEnhancementEmpty(ItemStack i); - int getPotionIconIndex(PotionEffect effect); - Object makeChatComponent(String msg); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/game/IWorldClientProvider.java b/shared/java/top/fpsmaster/api/provider/game/IWorldClientProvider.java deleted file mode 100644 index ff3fe44a..00000000 --- a/shared/java/top/fpsmaster/api/provider/game/IWorldClientProvider.java +++ /dev/null @@ -1,18 +0,0 @@ -package top.fpsmaster.api.provider.game; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.entity.effect.EntityLightningBolt; -import top.fpsmaster.api.provider.IProvider; -import top.fpsmaster.wrapper.blockpos.WrapperBlockPos; -import top.fpsmaster.wrapper.util.WrapperAxisAlignedBB; - -public interface IWorldClientProvider extends IProvider { - IBlockState getBlockState(WrapperBlockPos pos); - Block getBlock(WrapperBlockPos pos); - WrapperAxisAlignedBB getBlockBoundingBox(WrapperBlockPos pos, IBlockState state); - void addWeatherEffect(EntityLightningBolt entityLightningBolt); - WorldClient getWorld(); - void setWorldTime(long l); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/gui/IGuiIngameProvider.java b/shared/java/top/fpsmaster/api/provider/gui/IGuiIngameProvider.java deleted file mode 100644 index fd5dc1af..00000000 --- a/shared/java/top/fpsmaster/api/provider/gui/IGuiIngameProvider.java +++ /dev/null @@ -1,8 +0,0 @@ -package top.fpsmaster.api.provider.gui; - -import net.minecraft.entity.Entity; -import top.fpsmaster.api.provider.IProvider; - -public interface IGuiIngameProvider extends IProvider { - void drawHealth(Entity entityIn); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/gui/IGuiMainMenuProvider.java b/shared/java/top/fpsmaster/api/provider/gui/IGuiMainMenuProvider.java deleted file mode 100644 index f4a748ba..00000000 --- a/shared/java/top/fpsmaster/api/provider/gui/IGuiMainMenuProvider.java +++ /dev/null @@ -1,10 +0,0 @@ -package top.fpsmaster.api.provider.gui; - -import net.minecraft.client.gui.GuiScreen; -import top.fpsmaster.api.provider.IProvider; - -public interface IGuiMainMenuProvider extends IProvider { - void initGui(); - void renderSkybox(int mouseX, int mouseY, float partialTicks, int width, int height, float zLevel); - void showSinglePlayer(GuiScreen screen); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/gui/IGuiNewChatProvider.java b/shared/java/top/fpsmaster/api/provider/gui/IGuiNewChatProvider.java deleted file mode 100644 index bcb3dd82..00000000 --- a/shared/java/top/fpsmaster/api/provider/gui/IGuiNewChatProvider.java +++ /dev/null @@ -1,11 +0,0 @@ -package top.fpsmaster.api.provider.gui; - -import net.minecraft.client.gui.ChatLine; -import top.fpsmaster.api.provider.IProvider; - -import java.util.List; - -public interface IGuiNewChatProvider extends IProvider { - List getChatLines(); - List getDrawnChatLines(); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/packets/IAddPlayerData.java b/shared/java/top/fpsmaster/api/provider/packets/IAddPlayerData.java deleted file mode 100644 index bb53090d..00000000 --- a/shared/java/top/fpsmaster/api/provider/packets/IAddPlayerData.java +++ /dev/null @@ -1,5 +0,0 @@ -package top.fpsmaster.api.provider.packets; - -public interface IAddPlayerData { - String getName(); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/packets/IPacket.java b/shared/java/top/fpsmaster/api/provider/packets/IPacket.java deleted file mode 100644 index d76e4770..00000000 --- a/shared/java/top/fpsmaster/api/provider/packets/IPacket.java +++ /dev/null @@ -1,7 +0,0 @@ -package top.fpsmaster.api.provider.packets; - -import top.fpsmaster.api.provider.IProvider; - -public interface IPacket extends IProvider { - boolean isPacket(Object packet); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/packets/IPacketChat.java b/shared/java/top/fpsmaster/api/provider/packets/IPacketChat.java deleted file mode 100644 index 0fd43192..00000000 --- a/shared/java/top/fpsmaster/api/provider/packets/IPacketChat.java +++ /dev/null @@ -1,10 +0,0 @@ -package top.fpsmaster.api.provider.packets; - -import net.minecraft.util.IChatComponent; - -public interface IPacketChat extends IPacket { - String getUnformattedText(Object packet); - IChatComponent getChatComponent(Object packet); - int getType(Object p); - void appendTranslation(Object p); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/packets/IPacketPlayerList.java b/shared/java/top/fpsmaster/api/provider/packets/IPacketPlayerList.java deleted file mode 100644 index ce2e4cce..00000000 --- a/shared/java/top/fpsmaster/api/provider/packets/IPacketPlayerList.java +++ /dev/null @@ -1,11 +0,0 @@ -package top.fpsmaster.api.provider.packets; - -import top.fpsmaster.api.wrapper.packets.PlayerListItemAddWrap; - -import java.util.List; - -public interface IPacketPlayerList extends IPacket { - boolean isActionJoin(Object p); - boolean isActionLeave(Object p); - List getEntries(Object p); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/packets/IPacketTimeUpdate.java b/shared/java/top/fpsmaster/api/provider/packets/IPacketTimeUpdate.java deleted file mode 100644 index 9a408286..00000000 --- a/shared/java/top/fpsmaster/api/provider/packets/IPacketTimeUpdate.java +++ /dev/null @@ -1,4 +0,0 @@ -package top.fpsmaster.api.provider.packets; - -public interface IPacketTimeUpdate extends IPacket { -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/render/IEffectRendererProvider.java b/shared/java/top/fpsmaster/api/provider/render/IEffectRendererProvider.java deleted file mode 100644 index 235e74ab..00000000 --- a/shared/java/top/fpsmaster/api/provider/render/IEffectRendererProvider.java +++ /dev/null @@ -1,8 +0,0 @@ -package top.fpsmaster.api.provider.render; - -import top.fpsmaster.api.provider.IProvider; -import top.fpsmaster.wrapper.blockpos.WrapperBlockPos; - -public interface IEffectRendererProvider extends IProvider { - void addRedStoneBreak(WrapperBlockPos pos); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/render/IRenderManagerProvider.java b/shared/java/top/fpsmaster/api/provider/render/IRenderManagerProvider.java deleted file mode 100644 index 26baf5e5..00000000 --- a/shared/java/top/fpsmaster/api/provider/render/IRenderManagerProvider.java +++ /dev/null @@ -1,9 +0,0 @@ -package top.fpsmaster.api.provider.render; - -import top.fpsmaster.api.provider.IProvider; - -public interface IRenderManagerProvider extends IProvider { - double renderPosX(); - double renderPosY(); - double renderPosZ(); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/provider/sound/ISoundProvider.java b/shared/java/top/fpsmaster/api/provider/sound/ISoundProvider.java deleted file mode 100644 index ced03050..00000000 --- a/shared/java/top/fpsmaster/api/provider/sound/ISoundProvider.java +++ /dev/null @@ -1,9 +0,0 @@ -package top.fpsmaster.api.provider.sound; - -import top.fpsmaster.api.provider.IProvider; - -public interface ISoundProvider extends IProvider { - void playLightning(double posX, double posY, double posZ, float i, float v, boolean b); - void playExplosion(double posX, double posY, double posZ, float i, float v, boolean b); - void playRedStoneBreak(double posX, double posY, double posZ, float i, float v, boolean b); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/EffectRendererWrap.java b/shared/java/top/fpsmaster/api/wrapper/EffectRendererWrap.java deleted file mode 100644 index 88a534cc..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/EffectRendererWrap.java +++ /dev/null @@ -1,7 +0,0 @@ -package top.fpsmaster.api.wrapper; - -import top.fpsmaster.wrapper.blockpos.WrapperBlockPos; - -public interface EffectRendererWrap { - void addRedStoneBreak(WrapperBlockPos pos); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/GameSettingsWrap.java b/shared/java/top/fpsmaster/api/wrapper/GameSettingsWrap.java deleted file mode 100644 index 2f09eb5a..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/GameSettingsWrap.java +++ /dev/null @@ -1,7 +0,0 @@ -package top.fpsmaster.api.wrapper; - -import net.minecraft.client.settings.KeyBinding; - -public interface GameSettingsWrap { - void setKeyPress(KeyBinding key, boolean value); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/GuiIngameWrap.java b/shared/java/top/fpsmaster/api/wrapper/GuiIngameWrap.java deleted file mode 100644 index 2250210c..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/GuiIngameWrap.java +++ /dev/null @@ -1,7 +0,0 @@ -package top.fpsmaster.api.wrapper; - -import net.minecraft.entity.Entity; - -public interface GuiIngameWrap { - void drawHealth(Entity entityIn); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/GuiNewChatWrap.java b/shared/java/top/fpsmaster/api/wrapper/GuiNewChatWrap.java deleted file mode 100644 index e18aec38..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/GuiNewChatWrap.java +++ /dev/null @@ -1,10 +0,0 @@ -package top.fpsmaster.api.wrapper; - -import net.minecraft.client.gui.ChatLine; - -import java.util.List; - -public interface GuiNewChatWrap { - List getChatLines(); - List getDrawnChatLines(); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/MainMenuWrap.java b/shared/java/top/fpsmaster/api/wrapper/MainMenuWrap.java deleted file mode 100644 index d3123058..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/MainMenuWrap.java +++ /dev/null @@ -1,9 +0,0 @@ -package top.fpsmaster.api.wrapper; - -import net.minecraft.client.gui.GuiScreen; - -public interface MainMenuWrap { - void initGui(); - void renderSkybox(int mouseX, int mouseY, float partialTicks, int width, int height, float zLevel); - void showSinglePlayer(GuiScreen screen); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/MinecraftWrap.java b/shared/java/top/fpsmaster/api/wrapper/MinecraftWrap.java deleted file mode 100644 index 1a4f3297..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/MinecraftWrap.java +++ /dev/null @@ -1,29 +0,0 @@ -package top.fpsmaster.api.wrapper; - -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Session; - -import java.io.File; -import java.util.Collection; - -public interface MinecraftWrap { - Object getCurrentScreen(); - File getGameDir(); - FontRenderer getFontRenderer(); - EntityPlayerSP getPlayer(); - boolean isHoveringOverBlock(); - ItemStack getPlayerHeldItem(); - WorldClient getWorld(); - ItemStack[] getArmorInventory(); - void setSession(Session mojang); - Integer getRespondTime(); - void drawString(String text, float x, float y, int color); - String getServerAddress(); - void removeClickDelay(); - void printChatMessage(Object message); - Collection getPlayerInfoMap(); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/RenderManagerWrap.java b/shared/java/top/fpsmaster/api/wrapper/RenderManagerWrap.java deleted file mode 100644 index 53ce5f40..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/RenderManagerWrap.java +++ /dev/null @@ -1,7 +0,0 @@ -package top.fpsmaster.api.wrapper; - -public interface RenderManagerWrap { - double renderPosX(); - double renderPosY(); - double renderPosZ(); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/SkinWrap.java b/shared/java/top/fpsmaster/api/wrapper/SkinWrap.java deleted file mode 100644 index ca2215d5..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/SkinWrap.java +++ /dev/null @@ -1,5 +0,0 @@ -package top.fpsmaster.api.wrapper; - -public interface SkinWrap { - void updateSkin(String name, String uuid, String skin); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/SoundWrap.java b/shared/java/top/fpsmaster/api/wrapper/SoundWrap.java deleted file mode 100644 index bc10bda0..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/SoundWrap.java +++ /dev/null @@ -1,7 +0,0 @@ -package top.fpsmaster.api.wrapper; - -public interface SoundWrap { - void playLightning(double posX, double posY, double posZ, float i, float v, boolean b); - void playExplosion(double posX, double posY, double posZ, float i, float v, boolean b); - void playRedStoneBreak(double posX, double posY, double posZ, float i, float v, boolean b); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/TimerWrap.java b/shared/java/top/fpsmaster/api/wrapper/TimerWrap.java deleted file mode 100644 index 87c119d4..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/TimerWrap.java +++ /dev/null @@ -1,5 +0,0 @@ -package top.fpsmaster.api.wrapper; - -public interface TimerWrap { - float getRenderPartialTicks(); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/WorldWrap.java b/shared/java/top/fpsmaster/api/wrapper/WorldWrap.java deleted file mode 100644 index 2ccf5240..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/WorldWrap.java +++ /dev/null @@ -1,17 +0,0 @@ -package top.fpsmaster.api.wrapper; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.entity.effect.EntityLightningBolt; -import top.fpsmaster.wrapper.blockpos.WrapperBlockPos; -import top.fpsmaster.wrapper.util.WrapperAxisAlignedBB; - -public interface WorldWrap { - IBlockState getBlockState(WrapperBlockPos pos); - Block getBlock(WrapperBlockPos pos); - WrapperAxisAlignedBB getBlockBoundingBox(WrapperBlockPos pos, IBlockState state); - void addWeatherEffect(EntityLightningBolt entityLightningBolt); - WorldClient getWorld(); - void setWorldTime(long l); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/packets/ChatPacketWrap.java b/shared/java/top/fpsmaster/api/wrapper/packets/ChatPacketWrap.java deleted file mode 100644 index 71a99128..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/packets/ChatPacketWrap.java +++ /dev/null @@ -1,11 +0,0 @@ -package top.fpsmaster.api.wrapper.packets; - -import net.minecraft.util.IChatComponent; - -public interface ChatPacketWrap { - boolean isPacket(Object packet); - String getUnformattedText(Object packet); - IChatComponent getChatComponent(Object packet); - int getType(Object p); - void appendTranslation(Object p); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/packets/PlayerListItemAddWrap.java b/shared/java/top/fpsmaster/api/wrapper/packets/PlayerListItemAddWrap.java deleted file mode 100644 index 7303c99b..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/packets/PlayerListItemAddWrap.java +++ /dev/null @@ -1,5 +0,0 @@ -package top.fpsmaster.api.wrapper.packets; - -public interface PlayerListItemAddWrap { - String getName(); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/packets/PlayerListItemWrap.java b/shared/java/top/fpsmaster/api/wrapper/packets/PlayerListItemWrap.java deleted file mode 100644 index d25045a6..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/packets/PlayerListItemWrap.java +++ /dev/null @@ -1,10 +0,0 @@ -package top.fpsmaster.api.wrapper.packets; - -import java.util.List; - -public interface PlayerListItemWrap { - boolean isPacket(Object p); - boolean isActionJoin(Object p); - boolean isActionLeave(Object p); - List getEntries(Object p); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/api/wrapper/packets/TimeUpdatePacketWrap.java b/shared/java/top/fpsmaster/api/wrapper/packets/TimeUpdatePacketWrap.java deleted file mode 100644 index 55e154be..00000000 --- a/shared/java/top/fpsmaster/api/wrapper/packets/TimeUpdatePacketWrap.java +++ /dev/null @@ -1,5 +0,0 @@ -package top.fpsmaster.api.wrapper.packets; - -public interface TimeUpdatePacketWrap { - boolean isPacket(Object packet); -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/features/GlobalListener.java b/shared/java/top/fpsmaster/features/GlobalListener.java index e62e255c..67601d87 100644 --- a/shared/java/top/fpsmaster/features/GlobalListener.java +++ b/shared/java/top/fpsmaster/features/GlobalListener.java @@ -1,17 +1,14 @@ package top.fpsmaster.features; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ChatLine; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.network.NetworkPlayerInfo; import net.minecraft.event.ClickEvent; import net.minecraft.event.HoverEvent; import net.minecraft.network.play.client.C01PacketChatMessage; import net.minecraft.network.play.server.S02PacketChat; import net.minecraft.util.ChatComponentText; import net.minecraft.util.IChatComponent; -import org.java_websocket.enums.ReadyState; import org.lwjgl.input.Mouse; import top.fpsmaster.FPSMaster; import top.fpsmaster.event.EventDispatcher; @@ -19,24 +16,10 @@ import top.fpsmaster.event.events.*; import top.fpsmaster.features.impl.interfaces.BetterChat; import top.fpsmaster.features.impl.interfaces.ClientSettings; -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.api.provider.gui.IGuiNewChatProvider; -import top.fpsmaster.modules.account.AccountManager; -import top.fpsmaster.modules.account.Cosmetic; -import top.fpsmaster.modules.client.ClientUser; import top.fpsmaster.ui.notification.NotificationManager; import top.fpsmaster.utils.Utility; import top.fpsmaster.utils.render.StencilUtil; import top.fpsmaster.utils.render.shader.KawaseBlur; -import top.fpsmaster.websocket.client.WsClient; - -import java.net.URISyntaxException; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; import static top.fpsmaster.utils.Utility.mc; @@ -62,15 +45,10 @@ public void onChatSend(EventSendChatMessage e) { } - PlayerInformation playerInformation = null; - - - Map playerInfos = new ConcurrentHashMap<>(); Thread tickThread; - Thread accThread; @Subscribe - public void onTick(EventTick e) throws URISyntaxException { + public void onTick(EventTick e) { if (tickThread == null || !tickThread.isAlive()) { tickThread = new Thread(() -> { try { @@ -86,112 +64,12 @@ public void onTick(EventTick e) throws URISyntaxException { // throw new RuntimeException(ex); // } // } - if (MinecraftAPI.client().getMinecraft() != null && MinecraftAPI.world().getWorld() != null) { + if (mc != null && mc.theWorld != null) { Utility.flush(); } }); tickThread.start(); } - - - if (accThread == null || !accThread.isAlive()) { - accThread = new Thread(() -> { - try { - Thread.sleep(5000); - } catch (InterruptedException ex) { - throw new RuntimeException(ex); - } - if (FPSMaster.INSTANCE.loggedIn) { - if (FPSMaster.INSTANCE.wsClient == null) { - try { - FPSMaster.INSTANCE.wsClient = WsClient.start("wss://service.fpsmaster.top/"); - } catch (URISyntaxException ex) { - throw new RuntimeException(ex); - } - Utility.sendClientDebug("尝试连接"); - } else if (FPSMaster.INSTANCE.wsClient.isClosed() || FPSMaster.INSTANCE.wsClient.getReadyState() != ReadyState.OPEN) { - FPSMaster.INSTANCE.wsClient.close(); - FPSMaster.INSTANCE.wsClient.connect(); - playerInformation = null; - playerInfos.clear(); - Utility.sendClientDebug("尝试重连"); - } else { - FPSMaster.INSTANCE.wsClient.sendPing(); - } - if (mc.getNetHandler() == null) - return; - if (mc.getNetHandler().getPlayerInfoMap() == null) - return; - - Set currentPlayers = mc.getNetHandler().getPlayerInfoMap().stream() - .map(info -> info.getGameProfile().getId()) - .collect(Collectors.toSet()); - - playerInfos.keySet().retainAll(currentPlayers); - - - if (FPSMaster.INSTANCE.wsClient.getReadyState() != ReadyState.OPEN) - return; - - for (NetworkPlayerInfo info : mc.getNetHandler().getPlayerInfoMap()) { - UUID uuid = info.getGameProfile().getId(); - if (!playerInfos.containsKey(uuid)) { - playerInfos.put(uuid, info); - FPSMaster.INSTANCE.wsClient.fetchPlayer(uuid.toString(), info.getGameProfile().getName()); - } - } - - for (ClientUser user : FPSMaster.clientUsersManager.users) { - FPSMaster.INSTANCE.wsClient.fetchPlayer(user.uuid, user.name); - } - - if (playerInformation == null) { - playerInformation = new PlayerInformation(MinecraftAPI.client().getPlayer().getName(), MinecraftAPI.client().getPlayer().getUUID(), MinecraftAPI.client().getServerAddress(), AccountManager.cosmeticsUsing, AccountManager.skin); - FPSMaster.INSTANCE.wsClient.sendInformation(AccountManager.skin, AccountManager.cosmeticsUsing, MinecraftAPI.client().getPlayer().getName(), MinecraftAPI.client().getServerAddress()); - } else if (!playerInformation.serverAddress.equals(MinecraftAPI.client().getServerAddress()) || !playerInformation.name.equals(MinecraftAPI.client().getPlayer().getName()) || !playerInformation.skin.equals(AccountManager.skin) || !playerInformation.uuid.equals(MinecraftAPI.client().getPlayer().getUUID()) || !playerInformation.cosmetics.equals(AccountManager.cosmeticsUsing)) { - playerInformation = new PlayerInformation(MinecraftAPI.client().getPlayer().getName(), MinecraftAPI.client().getPlayer().getUUID(), MinecraftAPI.client().getServerAddress(), AccountManager.cosmeticsUsing, AccountManager.skin); - FPSMaster.INSTANCE.wsClient.sendInformation(AccountManager.skin, AccountManager.cosmeticsUsing, MinecraftAPI.client().getPlayer().getName(), MinecraftAPI.client().getServerAddress()); - } - } - }); - accThread.start(); - } - } - - @Subscribe - public void onCape(EventCapeLoading e) { - String[] cosmetics; - - if (e.player == mc.thePlayer) { - if (AccountManager.cosmeticsUsing.isEmpty()) - return; - cosmetics = AccountManager.cosmeticsUsing.split(","); - } else { - ClientUser clientUser = FPSMaster.clientUsersManager.getClientUser(e.player); - if (clientUser == null) - return; - cosmetics = clientUser.cosmetics.split(","); - } - - for (String cosmetic : cosmetics) { - if (cosmetic.isEmpty()) - continue; - Cosmetic cosmetic1 = AccountManager.cosmetics.get(Integer.valueOf(cosmetic)); - if (cosmetic1.resource.endsWith(".gif")) { - if (cosmetic1.frame < cosmetic1.frames.size() - 1) { - if (System.currentTimeMillis() - cosmetic1.frameTime > cosmetic1.frames.get(cosmetic1.frame).delay) { - cosmetic1.frame++; - cosmetic1.frameTime = System.currentTimeMillis(); - } - } else { - cosmetic1.frame = 0; - cosmetic1.frameTime = System.currentTimeMillis(); - } - e.setCachedCape("ornaments/" + cosmetic + "_resource_" + cosmetic1.frame); - } else { - e.setCachedCape("ornaments/" + cosmetic + "_resource"); - } - } } @Subscribe @@ -212,19 +90,4 @@ public void onRender(EventRender2D e) { NotificationManager.drawNotifications(); } - static class PlayerInformation { - String name; - String uuid; - String serverAddress; - String cosmetics; - String skin; - - public PlayerInformation(String name, String uuid, String serverAddress, String cosmetics, String skin) { - this.name = name; - this.uuid = uuid; - this.serverAddress = serverAddress; - this.cosmetics = cosmetics; - this.skin = skin; - } - } } diff --git a/shared/java/top/fpsmaster/features/command/CommandManager.java b/shared/java/top/fpsmaster/features/command/CommandManager.java index afc8dd4b..3ff4da06 100644 --- a/shared/java/top/fpsmaster/features/command/CommandManager.java +++ b/shared/java/top/fpsmaster/features/command/CommandManager.java @@ -4,10 +4,7 @@ import top.fpsmaster.event.EventDispatcher; import top.fpsmaster.event.Subscribe; import top.fpsmaster.event.events.EventSendChatMessage; -import top.fpsmaster.features.command.impl.AI; import top.fpsmaster.features.command.impl.Dev; -import top.fpsmaster.features.command.impl.IRCChat; -import top.fpsmaster.features.command.impl.TestNewAPICommand; import top.fpsmaster.features.impl.interfaces.ClientSettings; import top.fpsmaster.utils.Utility; @@ -23,9 +20,6 @@ public class CommandManager { public void init() { // add commands commands.add(new Dev()); - commands.add(new AI()); - commands.add(new IRCChat()); - commands.add(new TestNewAPICommand()); EventDispatcher.registerListener(this); } diff --git a/shared/java/top/fpsmaster/features/command/impl/AI.java b/shared/java/top/fpsmaster/features/command/impl/AI.java deleted file mode 100644 index adc4c095..00000000 --- a/shared/java/top/fpsmaster/features/command/impl/AI.java +++ /dev/null @@ -1,122 +0,0 @@ -package top.fpsmaster.features.command.impl; - -import top.fpsmaster.FPSMaster; -import top.fpsmaster.exception.FileException; -import top.fpsmaster.features.command.Command; -import top.fpsmaster.modules.lua.LuaManager; -import top.fpsmaster.modules.lua.LuaScript; -import top.fpsmaster.modules.lua.RawLua; -import top.fpsmaster.utils.Utility; -import top.fpsmaster.utils.os.FileUtils; -import top.fpsmaster.utils.thirdparty.openai.OpenAIClient; - -import java.io.IOException; -import java.util.ArrayList; - -public class AI extends Command { - private final String luaPrompt = "请遵守以下规则:\n" + - "1. 你的角色:作为代码生成机器人\n" + - "2. 你的目标:参考下面的lua示例,完成用户所输入的要求,编写相应的lua代码\n" + - "3. 禁止做:与用户闲聊、生成有危害性的代码\n" + - "4. 牢记:你所能使用的只有lua自带的语法,以及下面的示例中出现的api,不要自己编造。如果有实现不了的功能,则使用注释在相应位置占位。输出代码时不要加```lua和```,否则会导致lua语法错误。\n" + - "\n" + - "```lua\n" + - "-- 这里的代码最先执行\n" + - "function load()\n" + - " -- 在lua加载完成后才执行\n" + - " putI18n(\"testmodule\", \"测试功能\") -- putI18n函数可以向客户端的多语言系统添加字段\n" + - " putI18n(\"testmodule.desc\", \"测试功能描述\")\n" + - "end\n" + - "\n" + - "function unload()\n" + - " -- 在lua卸载后执行\n" + - "end\n" + - "\n" + - "function text(fontSize, text, x, y , color)\n" + - " -- 使用说明: drawString(fontSize, text, x,y,rgb(red,green,blue,alpha), dropShadow)\n" + - " drawString(fontSize, text, x+1 , y+1, rgb(115,155,200,255),false)\n" + - " drawString(fontSize, text, x , y, rgb(255,255,255,255),false)\n" + - "end\n" + - "\n" + - "local module = registerModule(\"TestModule\", \"Optimize\", {\n" + - " on_enable = function()\n" + - " notify(\"module enabled\")\n" + - " end,\n" + - " on_disable = function()\n" + - " notify(\"module disabled\")\n" + - " end,\n" + - " on_draw = function()\n" + - " -- 使用说明: drawRect(x,y,width,height,rgb(red,green,blue,alpha))\n" + - " drawRect(8, 8, 47, 14, 2, rgb(0,0,0,55)) -- 绘制矩形背景\n" + - " drawRect(8, 8, 2, 14, 2, rgb(55,255,255,255)) -- 绘制矩形背景左侧色块\n" + - " text(20, \"Test!\", 12 , 9, rgb(115,155,200,255),false) -- 绘制文字:\n" + - " end\n" + - "})\n" + - "\n" + - "module:toggle() -- 在这里加一个这个可以让lua重载时自动打开功能\n" + - "\n" + - "```"; - - public AI() { - super("ai"); - } - - @Override - public void execute(String[] args) throws Exception { - StringBuilder sb = new StringBuilder(); - if (args.length > 0) { - if (args[0].equals("lua")) { - for (int i = 2; i < args.length; i++) { - sb.append(args[i]); - } - String fileName = args[1]; - Utility.sendClientNotify("[Intelligence Code] Created lua: " + fileName + ".lua"); - FileUtils.saveFile("plugins/" + fileName + ".lua", sb.toString()); - LuaScript luaScript = new LuaScript(null, new RawLua(fileName + ".lua", "")); - LuaManager.scripts.add(luaScript); - - ArrayList messages = new ArrayList<>(); - messages.add(new OpenAIClient.Message("system", luaPrompt)); - messages.add(new OpenAIClient.Message("user", sb.toString())); - Utility.sendClientNotify("[Intelligence Code] Started coding..."); - OpenAIClient.getChatResponseAsync(messages, new OpenAIClient.ResponseCallback() { - @Override - public void onResponse(String response) { - String code = response.replace("```lua", "").replace("```", ""); - luaScript.rawLua.code = code; - luaScript.failedReason = "generating code... (" + code.length() + ")"; - } - - @Override - public void onError(Exception e) { - Utility.sendClientNotify("Fetching AI error"); - } - - @Override - public void onFinish(String string) throws FileException { - FileUtils.saveFile("plugins/" + fileName + ".lua", luaScript.rawLua.code); - luaScript.failedReason = ""; - LuaManager.hotswap(); - } - }); - } else { - for (String arg : args) { - sb.append(arg); - } - FPSMaster.async.execute(() -> { - ArrayList messages = new ArrayList<>(); - messages.add(new OpenAIClient.Message("system", "your name is Ares")); - messages.add(new OpenAIClient.Message("user", sb.toString())); - Utility.sendClientNotify("Fetching AI response..."); - try { - String response = OpenAIClient.getChatResponse(messages); - Utility.sendClientNotify("[AI] " + response); - } catch (IOException e) { - Utility.sendClientNotify("[AI] failed to fetch AI response."); - } - return null; - }); - } - } - } -} diff --git a/shared/java/top/fpsmaster/features/command/impl/IRCChat.java b/shared/java/top/fpsmaster/features/command/impl/IRCChat.java deleted file mode 100644 index d9a6cde3..00000000 --- a/shared/java/top/fpsmaster/features/command/impl/IRCChat.java +++ /dev/null @@ -1,70 +0,0 @@ -package top.fpsmaster.features.command.impl; - -import net.minecraft.client.network.NetworkPlayerInfo; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.features.command.Command; -import top.fpsmaster.features.impl.utility.IRC; -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.modules.account.AccountManager; -import top.fpsmaster.utils.Utility; - -import static top.fpsmaster.utils.Utility.mc; - -public class IRCChat extends Command { - - public IRCChat() { - super("irc"); - } - - @Override - public void execute(String[] args) { - if (!IRC.using) { - Utility.sendClientNotify("IRC is not using"); - return; - } - if (args.length > 0) { - StringBuilder sb = new StringBuilder(); - - if ("cmd".equals(args[0])) { - for (int i = 1; i < args.length; i++) { - if (i == args.length - 1) { - sb.append(args[i]); - } else { - sb.append(args[i]).append(" "); - } - } - String message = sb.toString(); - FPSMaster.INSTANCE.wsClient.sendCommand(message); - } else if ("dm".equals(args[0])) { - for (int i = 2; i < args.length; i++) { - if (i == args.length - 1) { - sb.append(args[i]); - } else { - sb.append(args[i]).append(" "); - } - } - String message = sb.toString(); - FPSMaster.INSTANCE.wsClient.sendDM(args[1], message); - } else if ("update".equals(args[0])) { - FPSMaster.INSTANCE.wsClient.sendInformation(AccountManager.skin, AccountManager.cosmeticsUsing, MinecraftAPI.client().getPlayer().getName(), MinecraftAPI.client().getServerAddress()); - } else if ("fetch".equals(args[0])) { - for (NetworkPlayerInfo networkPlayerInfo : mc.getNetHandler().getPlayerInfoMap()) { - FPSMaster.INSTANCE.wsClient.fetchPlayer(networkPlayerInfo.getGameProfile().getId().toString(), networkPlayerInfo.getGameProfile().getName()); - } - } else { - for (String arg : args) { - if (arg.equals(args[args.length - 1])) { - sb.append(arg); - } else { - sb.append(arg).append(" "); - } - } - String message = sb.toString(); - FPSMaster.INSTANCE.wsClient.sendMessage(message); - } - } else { - Utility.sendClientMessage("Usage: #irc "); - } - } -} diff --git a/shared/java/top/fpsmaster/features/command/impl/TestNewAPICommand.java b/shared/java/top/fpsmaster/features/command/impl/TestNewAPICommand.java deleted file mode 100644 index 06928724..00000000 --- a/shared/java/top/fpsmaster/features/command/impl/TestNewAPICommand.java +++ /dev/null @@ -1,225 +0,0 @@ -package top.fpsmaster.features.command.impl; - -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.domain.client.IClientPlayer; -import top.fpsmaster.api.domain.client.IGameSettings; -import top.fpsmaster.api.domain.client.IItemStack; -import top.fpsmaster.api.domain.render.IRenderManager; -import top.fpsmaster.api.domain.world.IWorld; -import top.fpsmaster.api.model.BlockPos; -import top.fpsmaster.api.model.Vec3; -import top.fpsmaster.api.model.WeatherType; -import top.fpsmaster.features.command.Command; - -/** - * 测试新 API 的命令 - * 使用方法: #testnewapi - */ -public class TestNewAPICommand extends Command { - - public TestNewAPICommand() { - super("testnewapi"); - } - - @Override - public void execute(String[] args) { - printMessage("§a========== 测试新 API =========="); - - // 测试客户端 API - testClientAPI(); - - // 测试世界 API - testWorldAPI(); - - // 测试渲染 API - testRenderAPI(); - - // 测试设置 API - testSettingsAPI(); - - // 测试粒子效果 - testParticles(); - - // 测试光照系统 - testLightLevel(); - - // 测试实体 API - testEntityAPI(); - - printMessage("§a========== 测试完成 =========="); - } - - private void testClientAPI() { - printMessage("§e[客户端 API 测试]"); - - IClientPlayer player = MinecraftAPI.client().getPlayer(); - if (player == null) { - printMessage("§c玩家为 null(未加入世界)"); - return; - } - - // 测试玩家基本信息 - String name = player.getName(); - Vec3 pos = player.getPosition(); - float health = player.getHealth(); - float maxHealth = player.getMaxHealth(); - int foodLevel = player.getFoodLevel(); - int ping = player.getPing(); - - printMessage(String.format("§7玩家: §f%s", name)); - printMessage(String.format("§7位置: §f%.2f, %.2f, %.2f", pos.x, pos.y, pos.z)); - printMessage(String.format("§7生命值: §f%.1f/%.1f", health, maxHealth)); - printMessage(String.format("§7饥饿值: §f%d", foodLevel)); - printMessage(String.format("§7延迟: §f%dms", ping)); - printMessage(String.format("§7在地面: §f%s", player.isOnGround())); - printMessage(String.format("§7潜行: §f%s", player.isSneaking())); - printMessage(String.format("§7疾跑: §f%s", player.isSprinting())); - - // 测试物品 - IItemStack heldItem = player.getHeldItem(); - if (heldItem != null && !heldItem.isEmpty()) { - printMessage(String.format("§7手持物品: §f%s x%d", - heldItem.getDisplayName(), heldItem.getCount())); - printMessage(String.format("§7物品ID: §f%s", heldItem.getItemId())); - if (heldItem.isEnchanted()) { - printMessage(String.format("§7附魔: §f%s", heldItem.getEnchantments())); - } - } else { - printMessage("§7手持物品: §f空"); - } - - // 测试护甲 - java.util.List armor = player.getArmorItems(); - printMessage(String.format("§7护甲装备: §f%d件", - armor.stream().filter(a -> a != null && !a.isEmpty()).count())); - } - - private void testWorldAPI() { - printMessage("§e[世界 API 测试]"); - - IWorld world = MinecraftAPI.world().getWorld(); - if (world == null) { - printMessage("§c世界为 null"); - return; - } - - String worldName = world.getWorldName(); - long worldTime = world.getWorldTime(); - BlockPos spawnPoint = world.getSpawnPoint(); - WeatherType weather = world.getWeatherType(); - - printMessage(String.format("§7世界名称: §f%s", worldName)); - printMessage(String.format("§7世界时间: §f%d", worldTime)); - printMessage(String.format("§7出生点: §f%d, %d, %d", - spawnPoint.getX(), spawnPoint.getY(), spawnPoint.getZ())); - printMessage(String.format("§7天气: §f%s", weather)); - - // 测试方块检测 - IClientPlayer player = MinecraftAPI.client().getPlayer(); - if (player != null) { - Vec3 pos = player.getPosition(); - BlockPos playerPos = new BlockPos((int)pos.x, (int)pos.y, (int)pos.z); - BlockPos feetPos = playerPos.down(); - - String blockId = world.getBlockId(feetPos); - boolean isAir = world.isAirBlock(feetPos); - - printMessage(String.format("§7脚下方块: §f%s", blockId)); - printMessage(String.format("§7是否为空气: §f%s", isAir)); - } - } - - private void testRenderAPI() { - printMessage("§e[渲染 API 测试]"); - - IRenderManager rm = MinecraftAPI.render().getRenderManager(); - float partialTicks = MinecraftAPI.render().getPartialTicks(); - - printMessage(String.format("§7渲染偏移: §f%.2f, %.2f, %.2f", - rm.getRenderPosX(), rm.getRenderPosY(), rm.getRenderPosZ())); - printMessage(String.format("§7部分刻: §f%.3f", partialTicks)); - } - - private void testSettingsAPI() { - printMessage("§e[设置 API 测试]"); - - IGameSettings settings = MinecraftAPI.client().getSettings(); - - printMessage(String.format("§7视距: §f%d 区块", settings.getRenderDistance())); - printMessage(String.format("§7鼠标灵敏度: §f%.2f", settings.getMouseSensitivity())); - printMessage(String.format("§7GUI 缩放: §f%d", settings.getGuiScale())); - printMessage(String.format("§7FOV: §f%.0f", settings.getFov())); - printMessage(String.format("§7VSync: §f%s", settings.isVsyncEnabled())); - printMessage(String.format("§7帧率限制: §f%d", settings.getFramerateLimit())); - printMessage(String.format("§7调试信息: §f%s", settings.isShowDebugInfo())); - } - - private void testParticles() { - printMessage("§e[粒子效果测试]"); - - IClientPlayer player = MinecraftAPI.client().getPlayer(); - if (player == null) { - printMessage("§c玩家为 null"); - return; - } - - Vec3 pos = player.getPosition(); - BlockPos particlePos = new BlockPos((int)pos.x, (int)pos.y + 2, (int)pos.z); - - // 添加红石粒子效果 - MinecraftAPI.render().getParticleManager().addRedstoneBreakParticle(particlePos); - printMessage("§7已在头顶生成红石破碎粒子"); - } - - private void testLightLevel() { - printMessage("§e[光照系统测试]"); - - IClientPlayer player = MinecraftAPI.client().getPlayer(); - IWorld world = MinecraftAPI.world().getWorld(); - - if (player == null || world == null) { - printMessage("§c玩家或世界为 null"); - return; - } - - Vec3 pos = player.getPosition(); - BlockPos playerPos = new BlockPos((int)pos.x, (int)pos.y, (int)pos.z); - - int lightLevel = world.getLightLevel(playerPos); - int skyLight = world.getSkyLightLevel(playerPos); - int blockLight = world.getBlockLightLevel(playerPos); - float rainStrength = world.getRainStrength(); - - printMessage(String.format("§7总光照: §f%d", lightLevel)); - printMessage(String.format("§7天空光照: §f%d", skyLight)); - printMessage(String.format("§7方块光照: §f%d", blockLight)); - printMessage(String.format("§7雨强度: §f%.2f", rainStrength)); - } - - private void testEntityAPI() { - printMessage("§e[实体 API 测试]"); - - // 获取所有实体 - java.util.List allEntities = MinecraftAPI.entity().getAllEntities(); - printMessage(String.format("§7总实体数: §f%d", allEntities.size())); - - // 获取附近的实体 (10格内) - java.util.List nearbyEntities = MinecraftAPI.entity().getNearbyEntities(10.0); - printMessage(String.format("§710格内实体数: §f%d", nearbyEntities.size())); - - // 显示最近3个附近实体的信息 - int count = 0; - for (top.fpsmaster.api.domain.entity.IEntity entity : nearbyEntities) { - if (count >= 3) break; - - Vec3 ePos = entity.getPosition(); - printMessage(String.format("§7 - %s (ID: %d) 位置: %.1f, %.1f, %.1f", - entity.getName(), entity.getEntityId(), ePos.x, ePos.y, ePos.z)); - count++; - } - } - - private void printMessage(String message) { - MinecraftAPI.gui().getGuiIngame().printChatMessage(message); - } -} diff --git a/shared/java/top/fpsmaster/features/impl/interfaces/BetterChat.java b/shared/java/top/fpsmaster/features/impl/interfaces/BetterChat.java index b99718ca..cfeb708f 100644 --- a/shared/java/top/fpsmaster/features/impl/interfaces/BetterChat.java +++ b/shared/java/top/fpsmaster/features/impl/interfaces/BetterChat.java @@ -1,6 +1,7 @@ package top.fpsmaster.features.impl.interfaces; import net.minecraft.client.gui.ChatLine; +import net.minecraft.client.gui.GuiNewChat; import net.minecraft.event.ClickEvent; import net.minecraft.event.HoverEvent; import net.minecraft.network.play.server.S02PacketChat; @@ -12,7 +13,6 @@ import top.fpsmaster.features.impl.InterfaceModule; import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.settings.impl.BooleanSetting; -import top.fpsmaster.api.provider.gui.IGuiNewChatProvider; import static top.fpsmaster.utils.Utility.mc; @@ -22,6 +22,8 @@ public class BetterChat extends InterfaceModule { private final BooleanSetting copyMessage = new BooleanSetting("CopyMessage", false); private IChatComponent lastMessage = null; private int counter = 1; + private static java.lang.reflect.Field chatLinesField; + private static java.lang.reflect.Field drawnChatLinesField; public BetterChat() { @@ -50,19 +52,25 @@ public void onChat(EventPacket e) { .setChatClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "\u0000#COPY" + ((S02PacketChat) e.packet).getChatComponent().getUnformattedText())) .setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(FPSMaster.i18n.get("copy.hover")))); if (foldMessage.getValue()) { - IGuiNewChatProvider chatProvider = (IGuiNewChatProvider) mc.ingameGUI.getChatGUI(); - if (chatProvider.getDrawnChatLines().isEmpty()) { + GuiNewChat chatProvider = mc.ingameGUI.getChatGUI(); + java.util.List drawnChatLines = getDrawnChatLines(chatProvider); + java.util.List chatLines = getChatLines(chatProvider); + if (drawnChatLines.isEmpty()) { counter = 1; lastMessage = packet.getChatComponent().createCopy(); } else if (lastMessage.equals(packet.getChatComponent())) { - ChatLine c = chatProvider.getDrawnChatLines().get(0); + ChatLine c = drawnChatLines.get(0); IChatComponent chatComponent = lastMessage.createCopy().appendSibling(new ChatComponentText("\247r\247f [x" + ++counter + "]")); if (copyMessage.getValue()) { chatComponent.appendSibling(copyText); } c = new ChatLine(c.getUpdatedCounter(), chatComponent, c.getChatLineID()); - chatProvider.getChatLines().set(0, c); - chatProvider.getDrawnChatLines().set(0, c); + if (!chatLines.isEmpty()) { + chatLines.set(0, c); + } + if (!drawnChatLines.isEmpty()) { + drawnChatLines.set(0, c); + } e.cancel(); return; } else { @@ -75,4 +83,28 @@ public void onChat(EventPacket e) { } } } + + private static java.util.List getChatLines(GuiNewChat chat) { + try { + if (chatLinesField == null) { + chatLinesField = GuiNewChat.class.getDeclaredField("chatLines"); + chatLinesField.setAccessible(true); + } + return (java.util.List) chatLinesField.get(chat); + } catch (NoSuchFieldException | IllegalAccessException e) { + return new java.util.ArrayList<>(); + } + } + + private static java.util.List getDrawnChatLines(GuiNewChat chat) { + try { + if (drawnChatLinesField == null) { + drawnChatLinesField = GuiNewChat.class.getDeclaredField("drawnChatLines"); + drawnChatLinesField.setAccessible(true); + } + return (java.util.List) drawnChatLinesField.get(chat); + } catch (NoSuchFieldException | IllegalAccessException e) { + return new java.util.ArrayList<>(); + } + } } diff --git a/shared/java/top/fpsmaster/features/impl/interfaces/ComboDisplay.java b/shared/java/top/fpsmaster/features/impl/interfaces/ComboDisplay.java index 3d21f711..8a6766c7 100644 --- a/shared/java/top/fpsmaster/features/impl/interfaces/ComboDisplay.java +++ b/shared/java/top/fpsmaster/features/impl/interfaces/ComboDisplay.java @@ -7,8 +7,6 @@ import top.fpsmaster.features.impl.InterfaceModule; import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.settings.impl.ColorSetting; -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.Wrappers; import java.awt.*; @@ -26,11 +24,9 @@ public ComboDisplay() { @Subscribe public void onTick(EventTick e) { - if (MinecraftAPI.client().getPlayer() == null) return; - - // Use raw player for combat mechanics - net.minecraft.entity.player.EntityPlayer rawPlayer = - (net.minecraft.entity.player.EntityPlayer) MinecraftAPI.client().getPlayer().getRawPlayer(); + if (net.minecraft.client.Minecraft.getMinecraft().thePlayer == null) return; + net.minecraft.entity.player.EntityPlayer rawPlayer = + net.minecraft.client.Minecraft.getMinecraft().thePlayer; if (rawPlayer.hurtTime == 1 || (target != null && rawPlayer.getDistanceToEntity(target) > 7)) { combo = 0; diff --git a/shared/java/top/fpsmaster/features/impl/interfaces/LyricsDisplay.java b/shared/java/top/fpsmaster/features/impl/interfaces/LyricsDisplay.java deleted file mode 100644 index 4158139f..00000000 --- a/shared/java/top/fpsmaster/features/impl/interfaces/LyricsDisplay.java +++ /dev/null @@ -1,19 +0,0 @@ -package top.fpsmaster.features.impl.interfaces; - -import top.fpsmaster.features.impl.InterfaceModule; -import top.fpsmaster.features.manager.Category; -import top.fpsmaster.features.settings.impl.BooleanSetting; -import top.fpsmaster.features.settings.impl.ColorSetting; - -import java.awt.*; - -public class LyricsDisplay extends InterfaceModule { - public static ColorSetting textColor = new ColorSetting("TextColor", new Color(255, 255, 255)); - public static ColorSetting textBG = new ColorSetting("TextColorBG", new Color(255, 255, 255)); - public BooleanSetting scale = new BooleanSetting("Scale", true); - - public LyricsDisplay() { - super("LyricsDisplay", Category.Interface); - addSettings(backgroundColor, rounded, betterFont, textColor, textBG, bg, rounded, roundRadius, scale); - } -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/features/impl/interfaces/MusicOverlay.java b/shared/java/top/fpsmaster/features/impl/interfaces/MusicOverlay.java deleted file mode 100644 index a9f91f1b..00000000 --- a/shared/java/top/fpsmaster/features/impl/interfaces/MusicOverlay.java +++ /dev/null @@ -1,38 +0,0 @@ -package top.fpsmaster.features.impl.interfaces; - -import top.fpsmaster.FPSMaster; -import top.fpsmaster.event.Subscribe; -import top.fpsmaster.event.events.EventRender2D; -import top.fpsmaster.features.impl.InterfaceModule; -import top.fpsmaster.features.manager.Category; -import top.fpsmaster.features.settings.impl.ColorSetting; -import top.fpsmaster.features.settings.impl.NumberSetting; -import top.fpsmaster.modules.music.IngameOverlay; -import top.fpsmaster.modules.music.JLayerHelper; -import top.fpsmaster.utils.math.MathTimer; - -import java.awt.*; - -public class MusicOverlay extends InterfaceModule { - public static final NumberSetting amplitude = new NumberSetting("Amplitude", 10, 0, 10, 0.1); - public static final ColorSetting progressColor = new ColorSetting("ProgressColor", new Color(255, 255, 255, 100)); - public static final ColorSetting color = new ColorSetting("Visual", new Color(255, 255, 255, 100)); - - private final MathTimer timer = new MathTimer(); - - public MusicOverlay() { - super("MusicDisplay", Category.Interface); - addSettings(amplitude, progressColor, color, betterFont, fontShadow); - } - - Thread updateThread = new Thread(JLayerHelper::updateLoudness); - - @Subscribe - public void onRender(EventRender2D e) { - if (timer.delay(50) && !updateThread.isAlive()) { - updateThread = new Thread(JLayerHelper::updateLoudness); - updateThread.start(); - } - IngameOverlay.onRender(); - } -} diff --git a/shared/java/top/fpsmaster/features/impl/interfaces/ReachDisplay.java b/shared/java/top/fpsmaster/features/impl/interfaces/ReachDisplay.java index 0b9c0a91..defd4c3a 100644 --- a/shared/java/top/fpsmaster/features/impl/interfaces/ReachDisplay.java +++ b/shared/java/top/fpsmaster/features/impl/interfaces/ReachDisplay.java @@ -1,20 +1,11 @@ package top.fpsmaster.features.impl.interfaces; -import com.google.common.base.Predicates; import net.minecraft.entity.Entity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.EntitySelectors; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; import top.fpsmaster.event.Subscribe; import top.fpsmaster.event.events.EventAttack; import top.fpsmaster.features.impl.InterfaceModule; import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.settings.impl.ColorSetting; -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.wrapper.util.WrapperAxisAlignedBB; -import top.fpsmaster.wrapper.util.WrapperVec3; import java.awt.*; import java.util.List; @@ -34,7 +25,7 @@ public ReachDisplay() { @Subscribe public void onAttack(EventAttack e) { Entity entity = mc.getRenderViewEntity(); - if (entity != null && MinecraftAPI.world().getWorld() != null) { + if (entity != null && mc.theWorld != null) { if (mc.objectMouseOver == null || mc.objectMouseOver.entityHit == null) return; reach = Double.parseDouble(String.format("%.2f", distance)); diff --git a/shared/java/top/fpsmaster/features/impl/interfaces/TargetDisplay.java b/shared/java/top/fpsmaster/features/impl/interfaces/TargetDisplay.java index 5c7374a5..1764097b 100644 --- a/shared/java/top/fpsmaster/features/impl/interfaces/TargetDisplay.java +++ b/shared/java/top/fpsmaster/features/impl/interfaces/TargetDisplay.java @@ -1,5 +1,6 @@ package top.fpsmaster.features.impl.interfaces; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -12,8 +13,8 @@ import top.fpsmaster.features.settings.impl.BooleanSetting; import top.fpsmaster.features.settings.impl.ColorSetting; import top.fpsmaster.features.settings.impl.ModeSetting; -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.Wrappers; +import top.fpsmaster.forge.api.IMinecraft; +import top.fpsmaster.forge.api.IRenderManager; import java.awt.*; @@ -55,9 +56,12 @@ private void drawCircle(Entity entity, double rad, boolean shade) { if (shade) GL11.glShadeModel(GL11.GL_SMOOTH); GlStateManager.disableCull(); GL11.glBegin(GL11.GL_TRIANGLE_STRIP); - double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * MinecraftAPI.render().getPartialTicks() - MinecraftAPI.render().getRenderManager().getRenderPosX(); - double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * MinecraftAPI.render().getPartialTicks() - MinecraftAPI.render().getRenderManager().getRenderPosY() + Math.sin(System.currentTimeMillis() / 2E+2) + 1; - double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * MinecraftAPI.render().getPartialTicks() - MinecraftAPI.render().getRenderManager().getRenderPosZ(); + Minecraft mc = Minecraft.getMinecraft(); + float partialTicks = ((IMinecraft) mc).arch$getTimer().renderPartialTicks; + IRenderManager renderManager = (IRenderManager) mc.getRenderManager(); + double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks - renderManager.renderPosX(); + double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks - renderManager.renderPosY() + Math.sin(System.currentTimeMillis() / 2E+2) + 1; + double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks - renderManager.renderPosZ(); Color c; GL11.glColor4f(1f, 0f, 0f, 0f); float i = 0f; diff --git a/shared/java/top/fpsmaster/features/impl/optimizes/NoHitDelay.java b/shared/java/top/fpsmaster/features/impl/optimizes/NoHitDelay.java index 8d172274..3a05b764 100644 --- a/shared/java/top/fpsmaster/features/impl/optimizes/NoHitDelay.java +++ b/shared/java/top/fpsmaster/features/impl/optimizes/NoHitDelay.java @@ -1,6 +1,8 @@ package top.fpsmaster.features.impl.optimizes; -import top.fpsmaster.api.MinecraftAPI; +import net.minecraft.client.Minecraft; + +import java.lang.reflect.Field; import top.fpsmaster.event.Subscribe; import top.fpsmaster.event.events.EventTick; import top.fpsmaster.features.manager.Category; @@ -28,7 +30,16 @@ public void onDisable() { @Subscribe public void onTick(EventTick e) { - MinecraftAPI.client().removeClickDelay(); + resetClickDelay(); + } + + private void resetClickDelay() { + try { + Field field = Minecraft.class.getDeclaredField("leftClickCounter"); + field.setAccessible(true); + field.setInt(Minecraft.getMinecraft(), 0); + } catch (NoSuchFieldException | IllegalAccessException ignored) { + } } public static boolean isUsing() { diff --git a/shared/java/top/fpsmaster/features/impl/optimizes/Performance.java b/shared/java/top/fpsmaster/features/impl/optimizes/Performance.java index bf093ade..184fc977 100644 --- a/shared/java/top/fpsmaster/features/impl/optimizes/Performance.java +++ b/shared/java/top/fpsmaster/features/impl/optimizes/Performance.java @@ -6,7 +6,6 @@ import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.impl.BooleanSetting; import top.fpsmaster.features.settings.impl.NumberSetting; -import top.fpsmaster.wrapper.mods.WrapperPerformance; import java.util.ArrayList; @@ -64,7 +63,7 @@ public static void setUsing(boolean using) { } public static boolean isVisible(CheckEntity entity) { - return WrapperPerformance.isVisible(entity); + return true; } public static boolean isVisible( @@ -72,6 +71,6 @@ public static boolean isVisible( double minX, double minY, double minZ, double maxX, double maxY, double maxZ, double cameraX, double cameraY, double cameraZ) { - return WrapperPerformance.isVisible(world, minX, minY, minZ, maxX, maxY, maxZ, cameraX, cameraY, cameraZ); + return true; } } diff --git a/shared/java/top/fpsmaster/features/impl/render/BlockOverlay.java b/shared/java/top/fpsmaster/features/impl/render/BlockOverlay.java index 45aa2397..67a8a17d 100644 --- a/shared/java/top/fpsmaster/features/impl/render/BlockOverlay.java +++ b/shared/java/top/fpsmaster/features/impl/render/BlockOverlay.java @@ -6,6 +6,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; import org.lwjgl.opengl.GL11; import top.fpsmaster.event.Subscribe; import top.fpsmaster.event.events.EventRender3D; @@ -14,11 +15,7 @@ import top.fpsmaster.features.settings.impl.BooleanSetting; import top.fpsmaster.features.settings.impl.ColorSetting; import top.fpsmaster.features.settings.impl.NumberSetting; -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.utils.render.Render3DUtils; -import top.fpsmaster.wrapper.blockpos.WrapperBlockPos; -import top.fpsmaster.wrapper.util.WrapperAxisAlignedBB; import java.awt.*; @@ -52,13 +49,9 @@ public void onDisable() { public void onRender3D(EventRender3D e) { if (Minecraft.getMinecraft().objectMouseOver != null) { // Use raw world for block state access - if (MinecraftAPI.world().getWorld() != null && Minecraft.getMinecraft().objectMouseOver != null) { - // Get raw world through casting (this is a bridge pattern) - Object rawWorldObj = MinecraftAPI.world().getWorld().getRawWorld(); - net.minecraft.client.multiplayer.WorldClient rawWorld = (net.minecraft.client.multiplayer.WorldClient) rawWorldObj; - - net.minecraft.util.BlockPos mcPos = Minecraft.getMinecraft().objectMouseOver.getBlockPos(); - IBlockState state = rawWorld.getBlockState(mcPos); + if (Minecraft.getMinecraft().theWorld != null && Minecraft.getMinecraft().objectMouseOver != null) { + BlockPos mcPos = Minecraft.getMinecraft().objectMouseOver.getBlockPos(); + IBlockState state = Minecraft.getMinecraft().theWorld.getBlockState(mcPos); Block block = state.getBlock(); if (!block.getMaterial().isReplaceable()) { @@ -75,11 +68,17 @@ public void onRender3D(EventRender3D e) { GL11.glDisable(2929); } GL11.glDepthMask(false); - WrapperAxisAlignedBB blockBoundingBox = new WrapperAxisAlignedBB(block.getBlockBoundsMinX(), block.getBlockBoundsMinY(), block.getBlockBoundsMinZ(), - block.getBlockBoundsMaxX(), block.getBlockBoundsMaxY(), block.getBlockBoundsMaxZ()); - double minX = block instanceof BlockStairs ? 0.0 : blockBoundingBox.minX(); - double minY = block instanceof BlockStairs ? 0.0 : blockBoundingBox.minY(); - double minZ = block instanceof BlockStairs ? 0.0 : blockBoundingBox.minZ(); + AxisAlignedBB blockBoundingBox = new AxisAlignedBB( + block.getBlockBoundsMinX(), + block.getBlockBoundsMinY(), + block.getBlockBoundsMinZ(), + block.getBlockBoundsMaxX(), + block.getBlockBoundsMaxY(), + block.getBlockBoundsMaxZ() + ); + double minX = block instanceof BlockStairs ? 0.0 : blockBoundingBox.minX; + double minY = block instanceof BlockStairs ? 0.0 : blockBoundingBox.minY; + double minZ = block instanceof BlockStairs ? 0.0 : blockBoundingBox.minZ; if (fill.getValue()) { Color color = color1.getValue().getColor(); GL11.glPushMatrix(); @@ -90,13 +89,13 @@ public void onRender3D(EventRender3D e) { color.getAlpha() / 255.0f ); Render3DUtils.drawBoundingBox( - new WrapperAxisAlignedBB( + new AxisAlignedBB( x + minX - 0.01, y + minY - 0.01, z + minZ - 0.01, - x + blockBoundingBox.maxX() + 0.01, - y + blockBoundingBox.maxY() + 0.01, - z + blockBoundingBox.maxZ() + 0.01 + x + blockBoundingBox.maxX + 0.01, + y + blockBoundingBox.maxY + 0.01, + z + blockBoundingBox.maxZ + 0.01 ) ); GL11.glPopMatrix(); @@ -112,13 +111,13 @@ public void onRender3D(EventRender3D e) { ); GL11.glLineWidth(width.getValue().floatValue()); Render3DUtils.drawBoundingBoxOutline( - new WrapperAxisAlignedBB( + new AxisAlignedBB( x + minX - 0.005, y + minY - 0.005, z + minZ - 0.005, - x + blockBoundingBox.maxX() + 0.005, - y + blockBoundingBox.maxY() + 0.005, - z + blockBoundingBox.maxZ() + 0.005 + x + blockBoundingBox.maxX + 0.005, + y + blockBoundingBox.maxY + 0.005, + z + blockBoundingBox.maxZ + 0.005 ) ); GL11.glPopMatrix(); diff --git a/shared/java/top/fpsmaster/features/impl/render/Crosshair.java b/shared/java/top/fpsmaster/features/impl/render/Crosshair.java index 176155ea..28c7d788 100644 --- a/shared/java/top/fpsmaster/features/impl/render/Crosshair.java +++ b/shared/java/top/fpsmaster/features/impl/render/Crosshair.java @@ -13,8 +13,6 @@ import top.fpsmaster.features.settings.impl.BooleanSetting; import top.fpsmaster.features.settings.impl.ColorSetting; import top.fpsmaster.features.settings.impl.NumberSetting; -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.utils.math.animation.AnimationUtils; import top.fpsmaster.utils.render.Render2DUtils; @@ -123,14 +121,14 @@ private boolean isEnemy(Object entity) { } private boolean isTeammate(EntityPlayer e) { - if (MinecraftAPI.client().getPlayer() == null) return false; - EntityPlayer player = (EntityPlayer) MinecraftAPI.client().getPlayer().getRawPlayer(); + if (Minecraft.getMinecraft().thePlayer == null) return false; + EntityPlayer player = Minecraft.getMinecraft().thePlayer; return player != null && e.getTeam() != null && e.getTeam().isSameTeam(player.getTeam()); } private boolean isMoving() { - if (MinecraftAPI.client().getPlayer() == null) return false; - EntityPlayer player = (EntityPlayer) MinecraftAPI.client().getPlayer().getRawPlayer(); + if (Minecraft.getMinecraft().thePlayer == null) return false; + EntityPlayer player = Minecraft.getMinecraft().thePlayer; return player != null && player.isSprinting(); } diff --git a/shared/java/top/fpsmaster/features/impl/render/DamageIndicator.java b/shared/java/top/fpsmaster/features/impl/render/DamageIndicator.java index 54f36001..7880021c 100644 --- a/shared/java/top/fpsmaster/features/impl/render/DamageIndicator.java +++ b/shared/java/top/fpsmaster/features/impl/render/DamageIndicator.java @@ -10,8 +10,7 @@ import top.fpsmaster.event.events.EventUpdate; import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.manager.Module; -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.Wrappers; +import top.fpsmaster.forge.api.IRenderManager; import top.fpsmaster.utils.math.MathTimer; import java.awt.*; @@ -83,16 +82,16 @@ public void doRender(Damage indicator) { GlStateManager.enableBlend(); GL11.glBlendFunc(770, 771); GL11.glDisable(3553); - float partialTicks = MinecraftAPI.render().getPartialTicks(); - double x = indicator.x + 1 - MinecraftAPI.render().getRenderManager().getRenderPosX(); - double y = indicator.y - MinecraftAPI.render().getRenderManager().getRenderPosY() + 1; - double z = indicator.z + 1 - MinecraftAPI.render().getRenderManager().getRenderPosZ(); + IRenderManager renderManager = (IRenderManager) mc.getRenderManager(); + double x = indicator.x + 1 - renderManager.renderPosX(); + double y = indicator.y - renderManager.renderPosY() + 1; + double z = indicator.z + 1 - renderManager.renderPosZ(); float scale = 0.065f; GlStateManager.translate(x, y + 1 + 0.5f - 1 / 2.0f, z); GL11.glNormal3f(0.0f, 1.0f, 0.0f); GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0f, 1.0f, 0.0f); GL11.glScalef(-scale / 2, -scale, -scale); - float width = ((net.minecraft.client.gui.FontRenderer)MinecraftAPI.client().getMinecraft().getFontRenderer()).getStringWidth(damage) / 2.0f; + float width = mc.fontRendererObj.getStringWidth(damage) / 2.0f; GlStateManager.disableDepth(); GlStateManager.disableBlend(); GlStateManager.disableLighting(); @@ -107,7 +106,7 @@ public void doRender(Damage indicator) { GL11.glDisable(3042); GL11.glDisable(2848); GlStateManager.enableBlend(); - ((net.minecraft.client.gui.FontRenderer)MinecraftAPI.client().getMinecraft().getFontRenderer()).drawStringWithShadow(damage, -width + 5, indicator.animation * 10, color.getRGB()); + mc.fontRendererObj.drawStringWithShadow(damage, -width + 5, indicator.animation * 10, color.getRGB()); GlStateManager.enableLighting(); GlStateManager.enableDepth(); GlStateManager.disableBlend(); @@ -133,4 +132,4 @@ public Damage(float damage, float x, float y, float z, float animation) { this.animation = animation; } } -} \ No newline at end of file +} diff --git a/shared/java/top/fpsmaster/features/impl/render/DragonWings.java b/shared/java/top/fpsmaster/features/impl/render/DragonWings.java index f9a9a1a3..cb1feceb 100644 --- a/shared/java/top/fpsmaster/features/impl/render/DragonWings.java +++ b/shared/java/top/fpsmaster/features/impl/render/DragonWings.java @@ -15,8 +15,6 @@ import top.fpsmaster.features.settings.impl.BooleanSetting; import top.fpsmaster.features.settings.impl.ColorSetting; import top.fpsmaster.features.settings.impl.NumberSetting; -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.Wrappers; import java.awt.*; @@ -98,7 +96,7 @@ public RenderWings() { public void onRenderPlayer(EventRender3D event) { EntityPlayer player; - player = (EntityPlayer) MinecraftAPI.client().getPlayer().getRawPlayer(); + player = Minecraft.getMinecraft().thePlayer; if (player == null) return; if (!player.isInvisible() && mc.gameSettings.thirdPersonView != 0) // Should render wings onto this player? @@ -155,4 +153,4 @@ private float interpolate(float yaw1, float yaw2, float percent) { return f; } } -} \ No newline at end of file +} diff --git a/shared/java/top/fpsmaster/features/impl/render/FreeLook.java b/shared/java/top/fpsmaster/features/impl/render/FreeLook.java index 937057a2..a8470d1c 100644 --- a/shared/java/top/fpsmaster/features/impl/render/FreeLook.java +++ b/shared/java/top/fpsmaster/features/impl/render/FreeLook.java @@ -2,14 +2,12 @@ import net.minecraft.client.Minecraft; import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.Display; import top.fpsmaster.event.Subscribe; import top.fpsmaster.event.events.EventRender3D; import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.impl.BindSetting; -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.wrapper.mods.WrapperFreeLook; public class FreeLook extends Module { private final BindSetting bind = new BindSetting("bind", Keyboard.KEY_LMENU); @@ -36,11 +34,11 @@ public void onRender3D(EventRender3D e) { if (Minecraft.getMinecraft().currentScreen != null) return; if (!perspectiveToggled) { - if (Keyboard.isKeyDown(bind.getValue())) { - perspectiveToggled = true; - if (MinecraftAPI.client().getPlayer() != null) { - cameraYaw = MinecraftAPI.client().getPlayer().getYaw(); - cameraPitch = MinecraftAPI.client().getPlayer().getPitch(); + if (Keyboard.isKeyDown(bind.getValue())) { + perspectiveToggled = true; + if (Minecraft.getMinecraft().thePlayer != null) { + cameraYaw = Minecraft.getMinecraft().thePlayer.rotationYaw; + cameraPitch = Minecraft.getMinecraft().thePlayer.rotationPitch; } previousPerspective = Minecraft.getMinecraft().gameSettings.hideGUI; Minecraft.getMinecraft().gameSettings.thirdPersonView = 1; @@ -58,22 +56,41 @@ public void onRender3D(EventRender3D e) { private static boolean previousPerspective = false; public static float getCameraYaw() { - return WrapperFreeLook.getCameraYaw(); + return perspectiveToggled ? cameraYaw : Minecraft.getMinecraft().getRenderViewEntity().rotationYaw; } public static float getCameraPitch() { - return WrapperFreeLook.getCameraPitch(); + return perspectiveToggled ? cameraPitch : Minecraft.getMinecraft().getRenderViewEntity().rotationPitch; } public static float getCameraPrevYaw() { - return WrapperFreeLook.getCameraPrevYaw(); + return perspectiveToggled ? cameraYaw : Minecraft.getMinecraft().getRenderViewEntity().prevRotationYaw; } public static float getCameraPrevPitch() { - return WrapperFreeLook.getCameraPrevPitch(); + return perspectiveToggled ? cameraPitch : Minecraft.getMinecraft().getRenderViewEntity().prevRotationPitch; } public static boolean overrideMouse() { - return WrapperFreeLook.overrideMouse(); + Minecraft mc = Minecraft.getMinecraft(); + if (mc.inGameHasFocus && Display.isActive()) { + if (!perspectiveToggled) { + return true; + } + mc.mouseHelper.mouseXYChange(); + float f1 = mc.gameSettings.mouseSensitivity * 0.6f + 0.2f; + float f2 = f1 * f1 * f1 * 8.0f; + float f3 = mc.mouseHelper.deltaX * f2; + float f4 = mc.mouseHelper.deltaY * f2; + cameraYaw += f3 * 0.15f; + cameraPitch += f4 * 0.15f; + if (cameraPitch > 90.0f) { + cameraPitch = 90.0f; + } + if (cameraPitch < -90.0f) { + cameraPitch = -90.0f; + } + } + return false; } } diff --git a/shared/java/top/fpsmaster/features/impl/render/Hitboxes.java b/shared/java/top/fpsmaster/features/impl/render/Hitboxes.java index 01dc27ee..d9d75a9e 100644 --- a/shared/java/top/fpsmaster/features/impl/render/Hitboxes.java +++ b/shared/java/top/fpsmaster/features/impl/render/Hitboxes.java @@ -1,11 +1,16 @@ package top.fpsmaster.features.impl.render; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.Entity; +import net.minecraft.util.AxisAlignedBB; +import org.lwjgl.opengl.GL11; import top.fpsmaster.event.Subscribe; import top.fpsmaster.event.events.EventRender3D; import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.impl.ColorSetting; -import top.fpsmaster.wrapper.mods.WrapperHitboxes; +import top.fpsmaster.forge.api.IRenderManager; +import top.fpsmaster.utils.render.Render3DUtils; import java.awt.*; @@ -31,6 +36,36 @@ public void onEnable() { @Subscribe public void onRender(EventRender3D event) { - WrapperHitboxes.render(event, color); + if (!using) { + return; + } + Minecraft mc = Minecraft.getMinecraft(); + if (mc.theWorld == null) { + return; + } + GL11.glPushMatrix(); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + GL11.glLineWidth(1.0f); + Color outline = color.getColor(); + GL11.glColor4f( + outline.getRed() / 255f, + outline.getGreen() / 255f, + outline.getBlue() / 255f, + outline.getAlpha() / 255f + ); + IRenderManager renderManager = (IRenderManager) mc.getRenderManager(); + for (Entity entity : mc.theWorld.loadedEntityList) { + if (entity == mc.thePlayer) { + continue; + } + AxisAlignedBB bb = entity.getEntityBoundingBox() + .offset(-renderManager.renderPosX(), -renderManager.renderPosY(), -renderManager.renderPosZ()); + Render3DUtils.drawBoundingBoxOutline(bb); + } + GL11.glDisable(GL11.GL_BLEND); + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glPopMatrix(); } } diff --git a/shared/java/top/fpsmaster/features/impl/render/MoreParticles.java b/shared/java/top/fpsmaster/features/impl/render/MoreParticles.java index fa26cb7a..941ae90e 100644 --- a/shared/java/top/fpsmaster/features/impl/render/MoreParticles.java +++ b/shared/java/top/fpsmaster/features/impl/render/MoreParticles.java @@ -12,11 +12,6 @@ import top.fpsmaster.features.settings.impl.BooleanSetting; import top.fpsmaster.features.settings.impl.ModeSetting; import top.fpsmaster.features.settings.impl.NumberSetting; -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.model.BlockPos; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.wrapper.WrapperEntityLightningBolt; -import top.fpsmaster.wrapper.blockpos.WrapperBlockPos; import static top.fpsmaster.utils.Utility.mc; @@ -45,32 +40,38 @@ public void onUpdate(EventUpdate event) { if (lastEffect != target && (entityLivingBase.getHealth() <= 0 || !entityLivingBase.isEntityAlive())) { if (killEffect.getValue() == 1) { // Use raw world for lightning effect - net.minecraft.client.multiplayer.WorldClient rawWorld = - (net.minecraft.client.multiplayer.WorldClient) MinecraftAPI.world().getWorld().getRawWorld(); - rawWorld.addWeatherEffect( - new net.minecraft.entity.effect.EntityLightningBolt( - rawWorld, + if (mc.theWorld != null) { + mc.theWorld.addWeatherEffect( + new net.minecraft.entity.effect.EntityLightningBolt( + mc.theWorld, + entityLivingBase.posX, + entityLivingBase.posY, + entityLivingBase.posZ + ) + ); + mc.theWorld.playSound( entityLivingBase.posX, entityLivingBase.posY, - entityLivingBase.posZ - ) - ); - MinecraftAPI.sound().playExplosionSound( - entityLivingBase.posX, - entityLivingBase.posY, - entityLivingBase.posZ, - 1f, - 1.0f - ); + entityLivingBase.posZ, + "random.explode", + 1f, + 1.0f, + false + ); + } } else if (killEffect.getValue() == 2) { Minecraft.getMinecraft().effectRenderer.emitParticleAtEntity(target, EnumParticleTypes.EXPLOSION_LARGE); - MinecraftAPI.sound().playExplosionSound( - entityLivingBase.posX, - entityLivingBase.posY, - entityLivingBase.posZ, - 1f, - 1.0f - ); + if (mc.theWorld != null) { + mc.theWorld.playSound( + entityLivingBase.posX, + entityLivingBase.posY, + entityLivingBase.posZ, + "random.explode", + 1f, + 1.0f, + false + ); + } } lastEffect = target; target = null; @@ -81,18 +82,16 @@ public void onUpdate(EventUpdate event) { public void onAttack(EventAttack event) { if (event.target.isEntityAlive()) { target = event.target; - if (MinecraftAPI.client().getPlayer().getFallDistance() != 0f || alwaysCrit.getValue()) { + if (mc.thePlayer != null && (mc.thePlayer.fallDistance != 0f || alwaysCrit.getValue())) { for (int i = 0; i < crit.getValue().intValue(); i++) { Minecraft.getMinecraft().effectRenderer.emitParticleAtEntity(event.target, EnumParticleTypes.CRIT); } } boolean needSharpness = false; - net.minecraft.entity.player.EntityPlayer rawPlayer = - (net.minecraft.entity.player.EntityPlayer) MinecraftAPI.client().getPlayer().getRawPlayer(); - if (rawPlayer.inventory.getCurrentItem() != null) { - needSharpness = rawPlayer.inventory.getCurrentItem().getEnchantmentTagList() != null - && !rawPlayer.inventory.getCurrentItem().getEnchantmentTagList().hasNoTags() - && rawPlayer.inventory.getCurrentItem().getEnchantmentTagList().toString().contains("id:16s"); + if (mc.thePlayer != null && mc.thePlayer.inventory.getCurrentItem() != null) { + needSharpness = mc.thePlayer.inventory.getCurrentItem().getEnchantmentTagList() != null + && !mc.thePlayer.inventory.getCurrentItem().getEnchantmentTagList().hasNoTags() + && mc.thePlayer.inventory.getCurrentItem().getEnchantmentTagList().toString().contains("id:16s"); } if (needSharpness || alwaysSharpness.getValue()) { for (int i = 0; i < sharpness.getValue().intValue(); i++) { @@ -106,20 +105,26 @@ public void onAttack(EventAttack event) { } else if (special.getValue() == 3) { if (mc.objectMouseOver.hitVec != null && event.target.hurtResistantTime <= 10) { System.out.println(); - MinecraftAPI.sound().playRedstoneBreakSound( - mc.objectMouseOver.hitVec.xCoord, - mc.objectMouseOver.hitVec.yCoord, - mc.objectMouseOver.hitVec.zCoord, - 1f, - 1f - ); - MinecraftAPI.render().getParticleManager().addRedstoneBreakParticle( - new BlockPos( - (int)mc.objectMouseOver.hitVec.xCoord, - (int)mc.objectMouseOver.hitVec.yCoord, - (int)mc.objectMouseOver.hitVec.zCoord - ) - ); + if (mc.theWorld != null) { + mc.theWorld.playSound( + mc.objectMouseOver.hitVec.xCoord, + mc.objectMouseOver.hitVec.yCoord, + mc.objectMouseOver.hitVec.zCoord, + "dig.stone", + 1f, + 1f, + false + ); + mc.theWorld.spawnParticle( + EnumParticleTypes.REDSTONE, + mc.objectMouseOver.hitVec.xCoord, + mc.objectMouseOver.hitVec.yCoord, + mc.objectMouseOver.hitVec.zCoord, + 0.0, + 0.0, + 0.0 + ); + } } } } diff --git a/shared/java/top/fpsmaster/features/impl/render/MotionBlur.java b/shared/java/top/fpsmaster/features/impl/render/MotionBlur.java index b450f1e1..b224fdb4 100644 --- a/shared/java/top/fpsmaster/features/impl/render/MotionBlur.java +++ b/shared/java/top/fpsmaster/features/impl/render/MotionBlur.java @@ -6,9 +6,11 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.shader.Framebuffer; import net.minecraft.client.shader.Shader; +import net.minecraft.client.shader.ShaderGroup; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import top.fpsmaster.FPSMaster; @@ -18,11 +20,8 @@ import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.impl.ModeSetting; import top.fpsmaster.features.settings.impl.NumberSetting; -import top.fpsmaster.forge.api.IShaderGroup; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.utils.OptifineUtil; import top.fpsmaster.utils.Utility; -import top.fpsmaster.wrapper.renderEngine.bufferbuilder.WrapperBufferBuilder; import java.util.List; @@ -67,7 +66,7 @@ private static void drawTexturedRectNoBlend(float x, float y, float width, float GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filter); Tessellator tessellator = Tessellator.getInstance(); - WrapperBufferBuilder worldrenderer = new WrapperBufferBuilder(tessellator); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); worldrenderer.pos(x, y + height, 0.0).tex(uMin, vMax).endVertex(); worldrenderer.pos(x + width, y + height, 0.0).tex(uMax, vMax).endVertex(); @@ -80,7 +79,7 @@ private static void drawTexturedRectNoBlend(float x, float y, float width, float @Subscribe public void renderOverlay(EventMotionBlur event) { - if (Wrappers.minecraft().getWorld() == null) + if (mc.theWorld == null) return; if (mode.isMode("Old")) { @@ -97,10 +96,16 @@ public void renderOverlay(EventMotionBlur event) { mc.entityRenderer.loadShader(new ResourceLocation("shaders/post/motionblur_core.json")); } float strength = 0.7f + multiplier.getValue().floatValue() / 100.0f * 3.0f - 0.01f; - IShaderGroup shaderGroup = (IShaderGroup) mc.entityRenderer.getShaderGroup(); + ShaderGroup shaderGroup = mc.entityRenderer.getShaderGroup(); if (shaderGroup == null) return; - List listShaders = shaderGroup.getListShaders(); + List listShaders = null; + try { + java.lang.reflect.Field field = ShaderGroup.class.getDeclaredField("listShaders"); + field.setAccessible(true); + listShaders = (List) field.get(shaderGroup); + } catch (NoSuchFieldException | IllegalAccessException ignored) { + } if (listShaders == null) return; listShaders.forEach(it -> { diff --git a/shared/java/top/fpsmaster/features/impl/utility/AutoGG.java b/shared/java/top/fpsmaster/features/impl/utility/AutoGG.java index 1e70852c..e336c2e8 100644 --- a/shared/java/top/fpsmaster/features/impl/utility/AutoGG.java +++ b/shared/java/top/fpsmaster/features/impl/utility/AutoGG.java @@ -1,6 +1,7 @@ package top.fpsmaster.features.impl.utility; import net.minecraft.event.ClickEvent; +import net.minecraft.network.play.server.S02PacketChat; import net.minecraft.util.IChatComponent; import net.minecraft.util.StringUtils; import top.fpsmaster.FPSMaster; @@ -12,7 +13,6 @@ import top.fpsmaster.features.settings.impl.ModeSetting; import top.fpsmaster.features.settings.impl.NumberSetting; import top.fpsmaster.features.settings.impl.TextSetting; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.utils.Utility; import top.fpsmaster.utils.math.MathTimer; @@ -32,8 +32,9 @@ public AutoGG() { @Subscribe public void onPacket(EventPacket event) { - if (event.type == EventPacket.PacketType.RECEIVE && Wrappers.chatPacket().isPacket(event.packet)) { - IChatComponent componentValue = Wrappers.chatPacket().getChatComponent(event.packet); + if (event.type == EventPacket.PacketType.RECEIVE && event.packet instanceof S02PacketChat) { + S02PacketChat packet = (S02PacketChat) event.packet; + IChatComponent componentValue = packet.getChatComponent(); String chatMessage = componentValue.getUnformattedText(); switch (servers.getValue()) { case 0: diff --git a/shared/java/top/fpsmaster/features/impl/utility/ChatBot.java b/shared/java/top/fpsmaster/features/impl/utility/ChatBot.java deleted file mode 100644 index c4d02955..00000000 --- a/shared/java/top/fpsmaster/features/impl/utility/ChatBot.java +++ /dev/null @@ -1,108 +0,0 @@ -package top.fpsmaster.features.impl.utility; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.event.Subscribe; -import top.fpsmaster.event.events.EventPacket; -import top.fpsmaster.event.events.EventSendChatMessage; -import top.fpsmaster.features.manager.Category; -import top.fpsmaster.features.manager.Module; -import top.fpsmaster.features.settings.impl.BooleanSetting; -import top.fpsmaster.features.settings.impl.ModeSetting; -import top.fpsmaster.features.settings.impl.NumberSetting; -import top.fpsmaster.features.settings.impl.TextSetting; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.ui.notification.NotificationManager; -import top.fpsmaster.utils.Utility; -import top.fpsmaster.utils.math.MathTimer; -import top.fpsmaster.utils.thirdparty.openai.OpenAI; - -import java.util.ArrayList; -import java.util.regex.Pattern; - - -public class ChatBot extends Module { - - ModeSetting mode = new ModeSetting("Mode", 0, "Internal", "Custom"); - TextSetting apiKey = new TextSetting("apiKey", "", () -> mode.isMode("Custom")); - TextSetting apiUrl = new TextSetting("apiUrl", "https://api.openai.com/v1", () -> mode.isMode("Custom")); - TextSetting prompt = new TextSetting("prompt", "You are a chat bot in a Minecraft server"); - NumberSetting maxContext = new NumberSetting("maxContext", 6, 0, 10, 1); - NumberSetting cooldown = new NumberSetting("cooldown", 500, 0, 10000, 100); - String lastMsg = ""; - BooleanSetting ignoreSelf = new BooleanSetting("ignoreself", true); - TextSetting model = new TextSetting("model", "gpt3.5-turbo"); - TextSetting regex = new TextSetting("regex", "<[^>]+> .*|[^>]+: .*"); - NumberSetting delay = new NumberSetting("responddelay", 500, 0, 5000, 10); - MathTimer timer = new MathTimer(); - - private final ArrayList msgs = new ArrayList<>(); - - public ChatBot() { - super("ChatBot", Category.Utility); - addSettings(mode, apiUrl, apiKey, model, maxContext, ignoreSelf, regex, prompt, delay, cooldown); - } - - @Subscribe - public void onSend(EventSendChatMessage e) { - if (ignoreSelf.getValue()) { - String s = e.msg; - lastMsg = s.length() > 20 ? s.substring(0, 20) : s; - } - } - - @Subscribe - public void onChat(EventPacket e) { - if (Wrappers.chatPacket().isPacket(e.packet) && timer.delay(cooldown.getValue().longValue())) { - String formattedText = Wrappers.chatPacket().getUnformattedText(e.packet); - if (formattedText.contains(lastMsg) && lastMsg.length() > 1) { - System.out.println(lastMsg); - return; - } - FPSMaster.async.runnable(() -> { - Pattern pattern = Pattern.compile(regex.getValue()); - if (pattern.matcher(formattedText).find()) { - OpenAI openAi; - NotificationManager.addNotification("ChatGPT", formattedText, 1f); - String s; - JsonObject userRole = new JsonObject(); - userRole.addProperty("role", "user"); - userRole.addProperty("content", formattedText); - msgs.add(userRole); - if (mode.isMode("Custom")) { - openAi = new OpenAI(apiUrl.getValue(), apiKey.getValue(), model.getValue(), prompt.getValue()); - JsonArray msgs1 = new JsonArray(); - msgs.forEach(msgs1::add); - s = openAi.requestNewAnswer(formattedText, msgs1).replace("\n", "").trim(); - } else { - JsonArray msgs1 = new JsonArray(); - msgs.forEach(msgs1::add); - String[] requestClientAI = OpenAI.requestClientAI(prompt.getValue(), model.getValue(), msgs1); - if ("200".equals(requestClientAI[0])) { - s = requestClientAI[1]; - } else { - Utility.sendClientMessage("ChatGPT failed: " + requestClientAI[0]); - return; - } - } - lastMsg = s.length() > 20 ? s.substring(0, 20) : s; - JsonObject aiRole = new JsonObject(); - aiRole.addProperty("role", "assistant"); - aiRole.addProperty("content", s); - msgs.add(aiRole); - if (msgs.size() > maxContext.getValue().intValue()) { - // remove the oldest message - msgs.remove(0); - } - try { - Thread.sleep(delay.getValue().longValue()); - } catch (InterruptedException e1) { - e1.printStackTrace(); - } - Utility.sendChatMessage(s); - } - }); - } - } -} diff --git a/shared/java/top/fpsmaster/features/impl/utility/IRC.java b/shared/java/top/fpsmaster/features/impl/utility/IRC.java deleted file mode 100644 index 281f1ee3..00000000 --- a/shared/java/top/fpsmaster/features/impl/utility/IRC.java +++ /dev/null @@ -1,27 +0,0 @@ -package top.fpsmaster.features.impl.utility; - -import top.fpsmaster.features.manager.Category; -import top.fpsmaster.features.manager.Module; -import top.fpsmaster.features.settings.impl.BooleanSetting; - -public class IRC extends Module { - public static boolean using = false; - public static final BooleanSetting showMates = new BooleanSetting("showMates", true); - - public IRC() { - super("IRC", Category.Utility); - addSettings(showMates); - } - - @Override - public void onEnable() { - super.onEnable(); - using = true; - } - - @Override - public void onDisable() { - super.onDisable(); - using = false; - } -} diff --git a/shared/java/top/fpsmaster/features/impl/utility/LevelTag.java b/shared/java/top/fpsmaster/features/impl/utility/LevelTag.java index fa3781e9..5146d2b0 100644 --- a/shared/java/top/fpsmaster/features/impl/utility/LevelTag.java +++ b/shared/java/top/fpsmaster/features/impl/utility/LevelTag.java @@ -9,12 +9,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; -import top.fpsmaster.FPSMaster; import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.impl.BooleanSetting; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.modules.client.ClientUsersManager; import top.fpsmaster.utils.render.Render2DUtils; import static top.fpsmaster.utils.Utility.mc; @@ -56,7 +53,6 @@ else if (mc.gameSettings.thirdPersonView == 1) GlStateManager.disableDepth(); GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - Wrappers.guiIngame().drawHealth(entityIn); GlStateManager.disableTexture2D(); GlStateManager.enableTexture2D(); GlStateManager.enableLighting(); @@ -96,7 +92,7 @@ else if (mc.gameSettings.thirdPersonView == 1) i = -10; } - boolean isMate = ((entityIn == mc.thePlayer) && str.contains(entityIn.getName())) || FPSMaster.clientUsersManager.getClientUser(entityIn) != null; + boolean isMate = entityIn == mc.thePlayer && str.contains(entityIn.getName()); int j = fontRenderer.getStringWidth(str) / 2; diff --git a/shared/java/top/fpsmaster/features/impl/utility/NameProtect.java b/shared/java/top/fpsmaster/features/impl/utility/NameProtect.java index 06d2d09d..c8bd3408 100644 --- a/shared/java/top/fpsmaster/features/impl/utility/NameProtect.java +++ b/shared/java/top/fpsmaster/features/impl/utility/NameProtect.java @@ -5,7 +5,7 @@ import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.impl.TextSetting; -import top.fpsmaster.api.Wrappers; +import top.fpsmaster.utils.Utility; public class NameProtect extends Module { private static boolean using = false; @@ -32,14 +32,14 @@ public void onDisable() { @Subscribe public void onTick(EventTick e) { - if (Wrappers.minecraft().getPlayer() != null) { - playerName = Wrappers.minecraft().getPlayer().getName(); + if (Utility.mc.thePlayer != null) { + playerName = Utility.mc.thePlayer.getName(); replacement = name.getValue().replace("&", "§"); } } public static String filter(String s) { - if (using && Wrappers.minecraft().getPlayer() != null) { + if (using && Utility.mc.thePlayer != null) { if (playerName == null) return s; if (replacement == null) return s; return s.replaceAll(playerName, replacement); diff --git a/shared/java/top/fpsmaster/features/impl/utility/SkinChanger.java b/shared/java/top/fpsmaster/features/impl/utility/SkinChanger.java deleted file mode 100644 index ec0cf2f8..00000000 --- a/shared/java/top/fpsmaster/features/impl/utility/SkinChanger.java +++ /dev/null @@ -1,83 +0,0 @@ -package top.fpsmaster.features.impl.utility; - -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.network.login.server.S02PacketLoginSuccess; -import net.minecraft.network.play.server.S0CPacketSpawnPlayer; -import net.minecraft.world.World; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.event.Subscribe; -import top.fpsmaster.event.events.EventPacket; -import top.fpsmaster.event.events.EventTick; -import top.fpsmaster.features.manager.Category; -import top.fpsmaster.features.manager.Module; -import top.fpsmaster.features.settings.impl.TextSetting; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.modules.account.AccountManager; - -import static top.fpsmaster.utils.Utility.mc; - -public class SkinChanger extends Module { - - private final TextSetting skinName = new TextSetting("Skin", ""); - private Thread updateThread = new Thread(() -> { - while (true) { - update(); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - }); - - public static boolean using = false; - private WorldClient world; - - public SkinChanger() { - super("SkinChanger", Category.Utility); - addSettings(skinName); - } - - @Override - public void onEnable() { - super.onEnable(); - using = true; - if (Wrappers.minecraft().getPlayer() != null) { - if (!updateThread.isAlive()) { - updateThread = new Thread(this::update); - updateThread.start(); - } - } - } - - - @Subscribe - public void onTick(EventTick e) { - if (Wrappers.minecraft().getPlayer() != null && Wrappers.minecraft().getPlayer().ticksExisted % 30 == 0) { - if (AccountManager.skin.equals(skinName.getValue()) && world == mc.theWorld) - return; - world = mc.theWorld; - AccountManager.skin = skinName.getValue(); - FPSMaster.async.runnable(this::update); - } - } - - public void update() { - Wrappers.skin().updateSkin( - Wrappers.minecraft().getPlayer().getName(), - Wrappers.minecraft().getPlayer().getUniqueID().toString(), - skinName.getValue() - ); - } - - @Override - public void onDisable() { - super.onDisable(); - FPSMaster.async.runnable(() -> Wrappers.skin().updateSkin( - Wrappers.minecraft().getPlayer().getName(), - Wrappers.minecraft().getPlayer().getUniqueID().toString(), - Wrappers.minecraft().getPlayer().getName() - )); - using = false; - } -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/features/impl/utility/Sprint.java b/shared/java/top/fpsmaster/features/impl/utility/Sprint.java index a38fdb9a..8765130a 100644 --- a/shared/java/top/fpsmaster/features/impl/utility/Sprint.java +++ b/shared/java/top/fpsmaster/features/impl/utility/Sprint.java @@ -1,6 +1,7 @@ package top.fpsmaster.features.impl.utility; -import top.fpsmaster.api.provider.ProviderRegistry; +import net.minecraft.client.Minecraft; +import net.minecraft.client.settings.KeyBinding; import top.fpsmaster.event.Subscribe; import top.fpsmaster.event.events.EventKey; import top.fpsmaster.event.events.EventUpdate; @@ -34,11 +35,11 @@ public void onUpdate(EventUpdate e) { @Subscribe public void onKey(EventKey e) { - if (toggleSprint.getValue() && e.key == ProviderRegistry.getMinecraftProvider().getMinecraft().getGameSettings().getKeyBindSprint().getKeyCode()) { + if (toggleSprint.getValue() && e.key == Minecraft.getMinecraft().gameSettings.keyBindSprint.getKeyCode()) { sprint = !sprint; if (!sprint) { - if (ProviderRegistry.getMinecraftProvider().getMinecraft().getClientPlayer() != null) { - ProviderRegistry.getMinecraftProvider().getMinecraft().getClientPlayer().setSprinting(false); + if (Minecraft.getMinecraft().thePlayer != null) { + Minecraft.getMinecraft().thePlayer.setSprinting(false); } } } @@ -47,10 +48,10 @@ public void onKey(EventKey e) { @Override public void onDisable() { super.onDisable(); - ProviderRegistry.getMinecraftProvider().getMinecraft().getKeyBinding().setKeyBindState(ProviderRegistry.getMinecraftProvider().getMinecraft().getGameSettings().getKeyBindSprint().getKeyCode(), false); - if (ProviderRegistry.getMinecraftProvider().getMinecraft().getClientPlayer() != null) { - ProviderRegistry.getMinecraftProvider().getMinecraft().getClientPlayer().setSprinting(false); + KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSprint.getKeyCode(), false); + if (Minecraft.getMinecraft().thePlayer != null) { + Minecraft.getMinecraft().thePlayer.setSprinting(false); } using = false; } -} \ No newline at end of file +} diff --git a/shared/java/top/fpsmaster/features/impl/utility/TNTTimer.java b/shared/java/top/fpsmaster/features/impl/utility/TNTTimer.java index 330352e5..4cb1391a 100644 --- a/shared/java/top/fpsmaster/features/impl/utility/TNTTimer.java +++ b/shared/java/top/fpsmaster/features/impl/utility/TNTTimer.java @@ -7,8 +7,8 @@ import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.impl.NumberSetting; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.wrapper.entities.EntityTNTPrimedUtil; +import top.fpsmaster.forge.api.IMinecraft; +import top.fpsmaster.forge.api.IRenderManager; import java.awt.*; import java.text.DecimalFormat; @@ -46,10 +46,11 @@ public static void doRender(EntityTNTPrimed entity) { GlStateManager.enableBlend(); GL11.glBlendFunc(770, 771); GL11.glDisable(3553); - float partialTicks = Wrappers.timer().getRenderPartialTicks(); - double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks - Wrappers.renderManager().renderPosX(); - double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks - Wrappers.renderManager().renderPosY(); - double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks - Wrappers.renderManager().renderPosZ(); + float partialTicks = ((IMinecraft) mc).arch$getTimer().renderPartialTicks; + IRenderManager renderManager = (IRenderManager) mc.getRenderManager(); + double x = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * partialTicks - renderManager.renderPosX(); + double y = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * partialTicks - renderManager.renderPosY(); + double z = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * partialTicks - renderManager.renderPosZ(); float scale = 0.065f; GlStateManager.translate(x, y + entity.height + 0.5f - entity.height / 2.0f, z); GL11.glNormal3f(0.0f, 1.0f, 0.0f); @@ -72,20 +73,20 @@ public static void doRender(EntityTNTPrimed entity) { } private static void drawTime(EntityTNTPrimed entity) { - float width = Wrappers.minecraft().getFontRenderer().getStringWidth("0.00") / 2.0f + 6.0f; + float width = Minecraft.getMinecraft().fontRendererObj.getStringWidth("0.00") / 2.0f + 6.0f; GlStateManager.disableDepth(); GlStateManager.disableBlend(); GlStateManager.disableLighting(); DecimalFormat df = new DecimalFormat("0.00"); Color color = new Color(255, 255, 255); - float time = (float) (EntityTNTPrimedUtil.getFuse(entity) / 20.0 + duration.getValue().doubleValue() - 4); + float time = (float) (entity.fuse / 20.0 + duration.getValue().doubleValue() - 4); if (time < 2.5) { color = new Color(255, 255, 0); } if (time < 1.0) { color = new Color(255, 0, 0); } - Wrappers.minecraft().getFontRenderer().drawStringWithShadow(df.format(time), -width + 5, -20f, color.getRGB()); + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(df.format(time), -width + 5, -20f, color.getRGB()); GlStateManager.enableLighting(); GlStateManager.enableBlend(); GlStateManager.enableDepth(); diff --git a/shared/java/top/fpsmaster/features/impl/utility/TimeChanger.java b/shared/java/top/fpsmaster/features/impl/utility/TimeChanger.java index 49a75da8..a7fd6596 100644 --- a/shared/java/top/fpsmaster/features/impl/utility/TimeChanger.java +++ b/shared/java/top/fpsmaster/features/impl/utility/TimeChanger.java @@ -6,7 +6,8 @@ import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.impl.NumberSetting; -import top.fpsmaster.api.Wrappers; +import net.minecraft.network.play.server.S03PacketTimeUpdate; +import top.fpsmaster.utils.Utility; public class TimeChanger extends Module { @@ -20,15 +21,15 @@ public TimeChanger() { @Subscribe public void onTick(EventTick e) { - if (Wrappers.world().getWorld() != null) { - Wrappers.world().setWorldTime(time.getValue().longValue()); + if (Utility.mc.theWorld != null) { + Utility.mc.theWorld.setWorldTime(time.getValue().longValue()); } } @Subscribe public void onPacket(EventPacket e) { if (e.type == EventPacket.PacketType.RECEIVE) { - if (Wrappers.timeUpdatePacket().isPacket(e.packet)) { + if (e.packet instanceof S03PacketTimeUpdate) { e.cancel(); } } diff --git a/shared/java/top/fpsmaster/features/manager/Category.java b/shared/java/top/fpsmaster/features/manager/Category.java index db23a378..7f8c4c86 100644 --- a/shared/java/top/fpsmaster/features/manager/Category.java +++ b/shared/java/top/fpsmaster/features/manager/Category.java @@ -5,7 +5,6 @@ public enum Category { RENDER("Render"), Utility("Utility"), Interface("Interface"), - Music("Music"), ; final String name; diff --git a/shared/java/top/fpsmaster/features/manager/Module.java b/shared/java/top/fpsmaster/features/manager/Module.java index 06d77b85..648532e6 100644 --- a/shared/java/top/fpsmaster/features/manager/Module.java +++ b/shared/java/top/fpsmaster/features/manager/Module.java @@ -5,7 +5,6 @@ import top.fpsmaster.event.EventDispatcher; import top.fpsmaster.features.settings.Setting; import top.fpsmaster.features.settings.impl.*; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.modules.logger.ClientLogger; import top.fpsmaster.ui.notification.NotificationManager; @@ -64,7 +63,7 @@ public void set(boolean state) { if (state && !isEnabled) { isEnabled = true; onEnable(); - if (Minecraft.getMinecraft() != null && Wrappers.minecraft().getPlayer() != null) { + if (Minecraft.getMinecraft() != null && Minecraft.getMinecraft().thePlayer != null) { NotificationManager.addNotification( FPSMaster.i18n.get("notification.module.enable"), String.format( @@ -77,7 +76,7 @@ public void set(boolean state) { } else if (!state && isEnabled){ isEnabled = false; onDisable(); - if (Minecraft.getMinecraft() != null && Wrappers.minecraft().getPlayer() != null) { + if (Minecraft.getMinecraft() != null && Minecraft.getMinecraft().thePlayer != null) { NotificationManager.addNotification( FPSMaster.i18n.get("notification.module.disable"), String.format( diff --git a/shared/java/top/fpsmaster/features/manager/ModuleManager.java b/shared/java/top/fpsmaster/features/manager/ModuleManager.java index 7ea1e878..5db68787 100644 --- a/shared/java/top/fpsmaster/features/manager/ModuleManager.java +++ b/shared/java/top/fpsmaster/features/manager/ModuleManager.java @@ -80,7 +80,6 @@ public void init() { modules.add(new MinimizedBobbing()); modules.add(new MoreParticles()); modules.add(new FPSDisplay()); - modules.add(new IRC()); modules.add(new ArmorDisplay()); modules.add(new BetterChat()); modules.add(new BetterFishingRod()); @@ -89,7 +88,6 @@ public void init() { modules.add(new PotionDisplay()); modules.add(new ReachDisplay()); modules.add(new Scoreboard()); - modules.add(new MusicOverlay()); modules.add(new OldAnimations()); modules.add(new HitColor()); modules.add(new BlockOverlay()); @@ -98,8 +96,6 @@ public void init() { modules.add(new FireModifier()); modules.add(new FreeLook()); modules.add(new AutoGG()); - modules.add(new LyricsDisplay()); - modules.add(new SkinChanger()); modules.add(new TimeChanger()); modules.add(new TNTTimer()); modules.add(new Hitboxes()); @@ -127,9 +123,7 @@ public void init() { modules.add(new SoundModifier()); modules.add(new ParticlesModifier()); - if (FPSMaster.EDITION.equals("1.12.2")) { - modules.add(new HideIndicator()); - } + modules.add(new HideIndicator()); for (Module m : FPSMaster.moduleManager.modules) { mainPanel.mods.add(new ModuleRenderer(m)); diff --git a/shared/java/top/fpsmaster/font/impl/StringCache.java b/shared/java/top/fpsmaster/font/impl/StringCache.java index c13c70f9..f7a6f1ac 100644 --- a/shared/java/top/fpsmaster/font/impl/StringCache.java +++ b/shared/java/top/fpsmaster/font/impl/StringCache.java @@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull; import org.lwjgl.opengl.GL11; import top.fpsmaster.modules.client.GlobalTextFilter; -import top.fpsmaster.wrapper.renderEngine.bufferbuilder.WrapperBufferBuilder; +import net.minecraft.client.renderer.WorldRenderer; import java.awt.*; import java.awt.font.GlyphVector; @@ -463,7 +463,7 @@ public int renderString(String str, float startX, float startY, int initialColor /* 使用Tessellator将数据排队至顶点数组然后一次性绘制应该比即时模式更快 */ Tessellator tessellator = Tessellator.getInstance(); - WrapperBufferBuilder worldRenderer = new WrapperBufferBuilder(tessellator); + WorldRenderer worldRenderer = tessellator.getWorldRenderer(); //GlStateManager.disableTexture2D(); worldRenderer.begin(7, DefaultVertexFormats.POSITION); GlStateManager.color((color >> 16 & 0xff) / 255F, (color >> 8 & 0xff) / 255F, (color & 0xff) / 255F); @@ -720,7 +720,7 @@ private int applyColorCode(int colorCode, int color, boolean shadowFlag) { color = colorTable[colorCode] & 0xffffff | color & 0xff000000; } - new WrapperBufferBuilder(Tessellator.getInstance()).color(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff); + Tessellator.getInstance().getWorldRenderer().color(color >> 16 & 0xff, color >> 8 & 0xff, color & 0xff, color >> 24 & 0xff); return color; } diff --git a/shared/java/top/fpsmaster/modules/account/AccountManager.java b/shared/java/top/fpsmaster/modules/account/AccountManager.java deleted file mode 100644 index 0b298c01..00000000 --- a/shared/java/top/fpsmaster/modules/account/AccountManager.java +++ /dev/null @@ -1,159 +0,0 @@ -package top.fpsmaster.modules.account; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.exception.AccountException; -import top.fpsmaster.exception.ExceptionHandler; -import top.fpsmaster.exception.FileException; -import top.fpsmaster.exception.NetworkException; -import top.fpsmaster.modules.logger.ClientLogger; -import top.fpsmaster.utils.os.FileUtils; -import top.fpsmaster.utils.os.HttpRequest; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; - -public class AccountManager { - private String token = ""; - private String username = ""; - public static String skin = ""; - public static JsonParser parser = new JsonParser(); - public static String cosmeticsHeld = ""; - public static String cosmeticsUsing = ""; - public static HashMap cosmetics = new HashMap<>(); - - public void autoLogin() { - FPSMaster.async.runnable(() -> { - try { - doAutoLogin(); - } catch (FileException e) { - ExceptionHandler.handleFileException(e, "尝试自动登录失败"); - } catch (AccountException e) { - ExceptionHandler.handleAccountException(e, "尝试自动登录失败"); - } catch (NetworkException e) { - ExceptionHandler.handleNetworkException(e, "尝试自动登录失败"); - } catch (Exception e) { - ExceptionHandler.handle(e, "尝试自动登录失败"); - } - }); - } - - private void doAutoLogin() throws FileException, AccountException, NetworkException { - token = FileUtils.readTempValue("token").trim(); - username = FPSMaster.configManager.configure.getOrCreate("username", "").trim(); - if (!token.isEmpty() && !username.isEmpty()) { - if (attemptLogin(username, token)) { - ClientLogger.info("自动登录成功! " + username); - FPSMaster.INSTANCE.loggedIn = true; - } else { - ClientLogger.info(username); - ClientLogger.error("自动登录失败!"); - throw new AccountException("自动登录失败"); - } - } - } - - private boolean attemptLogin(String username, String token) throws AccountException { - if (username.isEmpty() || token.isEmpty()) { - return false; - } - try { - HashMap headers = new HashMap<>(); - headers.put("Authorization", "Bearer " + token); - HttpRequest.HttpResponseResult s = HttpRequest.get(FPSMaster.SERVICE_API + "/api/auth/validate-jwt", headers); - JsonObject json = parser.parse(s.getBody()).getAsJsonObject(); - if (!s.isSuccess()) { - throw new AccountException("Failed to login via token " + s.getStatusCode()); - } - this.username = username; - this.token = token; - return json.get("data").getAsJsonObject().get("success").getAsBoolean(); - } catch (Exception e) { - throw new AccountException("Failed to login via token"); - } - } - - - public static JsonObject login(String username, String password) throws AccountException { - JsonObject body = new JsonObject(); - body.addProperty("username", username); - body.addProperty("password", password); - HttpRequest.HttpResponseResult s; - try { - s = HttpRequest.post(FPSMaster.SERVICE_API + "/api/auth/login", body.toString()); - } catch (IOException e) { - throw new RuntimeException(e); - } - - JsonObject jsonObject = parser.parse(s.getBody()).getAsJsonObject(); - if (jsonObject.get("data") == null || !jsonObject.get("data").getAsJsonObject().get("success").getAsBoolean()) { - throw new AccountException("登录失败: " + jsonObject.get("message").getAsString()); - } - return jsonObject; - } - - public void refreshUserData() throws AccountException { - try { - String token = FileUtils.readTempValue("token").trim(); - HashMap headers = new HashMap<>(); - headers.put("Authorization", "Bearer " + token); - HttpRequest.HttpResponseResult s = HttpRequest.post(FPSMaster.SERVICE_API + "/api/users", null, headers); - JsonObject json = parser.parse(s.getBody()).getAsJsonObject(); - if (!s.isSuccess()) { - throw new AccountException("Failed to login via token " + s.getStatusCode()); - } - cosmeticsHeld = json.get("data").getAsJsonObject().get("items").getAsString(); - } catch (Exception e) { - throw new AccountException("Failed to login via token"); - } - } - - public void refreshCosmetics() throws AccountException { - try { - String token = FileUtils.readTempValue("token").trim(); - HashMap headers = new HashMap<>(); - headers.put("Authorization", "Bearer " + token); - HttpRequest.HttpResponseResult s = HttpRequest.get(FPSMaster.SERVICE_API + "/api/store/items", headers); - JsonObject json = parser.parse(s.getBody()).getAsJsonObject(); - if (!s.isSuccess()) { - throw new AccountException("Failed to login via token " + s.getStatusCode()); - } - cosmetics.clear(); - for (JsonElement data : json.get("data").getAsJsonArray()) { - JsonObject asJsonObject = data.getAsJsonObject(); - Cosmetic cosmetic = new Cosmetic(); - cosmetic.id = asJsonObject.get("id").getAsInt(); - cosmetic.name = asJsonObject.get("name").getAsString(); - cosmetic.img = asJsonObject.get("img").getAsString(); - cosmetic.category = asJsonObject.get("category").getAsString(); - cosmetic.price = asJsonObject.get("price").getAsDouble(); - cosmetic.available = asJsonObject.get("available").getAsBoolean(); - cosmetic.resource = asJsonObject.get("resource").getAsString(); - cosmetics.put(cosmetic.id, cosmetic); - cosmetic.load(); - } - } catch (Exception e) { - throw new AccountException("Failed to login via token"); - } - } - - // Getter and Setter methods - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } -} diff --git a/shared/java/top/fpsmaster/modules/account/Cosmetic.java b/shared/java/top/fpsmaster/modules/account/Cosmetic.java deleted file mode 100644 index e52858ab..00000000 --- a/shared/java/top/fpsmaster/modules/account/Cosmetic.java +++ /dev/null @@ -1,64 +0,0 @@ -package top.fpsmaster.modules.account; - -import com.google.gson.JsonObject; -import net.minecraft.client.renderer.ThreadDownloadImageData; -import net.minecraft.util.ResourceLocation; -import scala.Int; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.utils.awt.GifUtil; -import top.fpsmaster.utils.os.HttpRequest; - -import java.awt.image.BufferedImage; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -import static top.fpsmaster.utils.Utility.mc; - -public class Cosmetic { - public int id; - public String name; - public String img; - public String category; - public double price; - public boolean available; - public String resource; - public boolean loaded; - public Integer frame = 0; - public long frameTime = 0; - public List frames = new ArrayList<>(); - - public Cosmetic() { - } - - public void load() { - if (mc.theWorld == null) return; - FPSMaster.async.runnable(() -> { - if (resource.endsWith(".png")) { - ResourceLocation textureLocation = new ResourceLocation("ornaments/" + id + "_resource"); - ThreadDownloadImageData downloadImageData = new ThreadDownloadImageData(null, null, textureLocation, null); - try { - downloadImageData.setBufferedImage(HttpRequest.downloadImage(resource)); - mc.getTextureManager().loadTexture(textureLocation, downloadImageData); - } catch (IOException ignored) { - } - } else if (resource.endsWith(".gif")) { - try { - InputStream inputStream = HttpRequest.downloadFile(resource); - frames.clear(); - frames = GifUtil.convertGifToPng(inputStream); - for (GifUtil.FrameData frame : frames) { - ResourceLocation textureLocation = new ResourceLocation("ornaments/" + id + "_resource_" + frames.indexOf(frame)); - ThreadDownloadImageData downloadImageData = new ThreadDownloadImageData(null, null, textureLocation, null); - downloadImageData.setBufferedImage(frame.image); - mc.getTextureManager().loadTexture(textureLocation, downloadImageData); - } - loaded = true; - } catch (IOException e) { - throw new RuntimeException(e); - } - } - }); - } -} diff --git a/shared/java/top/fpsmaster/modules/client/ClientUser.java b/shared/java/top/fpsmaster/modules/client/ClientUser.java deleted file mode 100644 index 0845666a..00000000 --- a/shared/java/top/fpsmaster/modules/client/ClientUser.java +++ /dev/null @@ -1,22 +0,0 @@ -package top.fpsmaster.modules.client; - -public class ClientUser { - public String uid; - public String name; - public String uuid; - public String gameId; - public String cosmetics; - public String skin; - public String rank; - public String customRank; - public ClientUser(String uid, String name, String uuid, String gameId, String cosmetics, String skin, String rank, String customRank) { - this.uid = uid; - this.name = name; - this.uuid = uuid; - this.gameId = gameId; - this.cosmetics = cosmetics; - this.skin = skin; - this.rank = rank; - this.customRank = customRank; - } -} diff --git a/shared/java/top/fpsmaster/modules/client/ClientUsersManager.java b/shared/java/top/fpsmaster/modules/client/ClientUsersManager.java deleted file mode 100644 index da19a86d..00000000 --- a/shared/java/top/fpsmaster/modules/client/ClientUsersManager.java +++ /dev/null @@ -1,39 +0,0 @@ -package top.fpsmaster.modules.client; - -import net.minecraft.entity.Entity; -import top.fpsmaster.modules.logger.ClientLogger; -import top.fpsmaster.utils.Utility; -import top.fpsmaster.websocket.data.message.server.SFetchPlayerPacket; - -import java.util.ArrayList; - -public class ClientUsersManager { - public ArrayList users = new ArrayList<>(); - - public void addFromFetch(SFetchPlayerPacket packet) { - ClientUser clientUser = new ClientUser(packet.uid, packet.name, packet.uuid, packet.gameId, packet.cosmetics, packet.skin, packet.rank, packet.customRank); - ClientUser rm = null; - for (ClientUser user : users) { - if (user.uid.equals(clientUser.uid)) - rm = user; - } - if (rm != null) - users.remove(rm); - users.add(clientUser); - Utility.sendClientDebug("Add user: " + clientUser.name + " " + clientUser.uid + " " + clientUser.uuid + " " + clientUser.gameId + " " + clientUser.rank + " " + clientUser.customRank + " " + clientUser.cosmetics + " " + clientUser.skin); - } - - public ClientUser getClientUser(Entity entityIn) { - for (ClientUser user : users) - if (user.gameId.equals(entityIn.getName()) && user.uuid.equals(entityIn.getUniqueID().toString())) - return user; - return null; - } - - public ClientUser getClientUser(String name, String uuid) { - for (ClientUser user : users) - if (user.gameId.equals(name) && user.uuid.equals(uuid)) - return user; - return null; - } -} diff --git a/shared/java/top/fpsmaster/modules/client/GlobalTextFilter.java b/shared/java/top/fpsmaster/modules/client/GlobalTextFilter.java index 3e3d5c20..ff9da978 100644 --- a/shared/java/top/fpsmaster/modules/client/GlobalTextFilter.java +++ b/shared/java/top/fpsmaster/modules/client/GlobalTextFilter.java @@ -1,6 +1,5 @@ package top.fpsmaster.modules.client; -import top.fpsmaster.features.impl.utility.IRC; import top.fpsmaster.features.impl.utility.NameProtect; public class GlobalTextFilter { diff --git a/shared/java/top/fpsmaster/modules/config/ConfigManager.java b/shared/java/top/fpsmaster/modules/config/ConfigManager.java index fc39a788..16beac96 100644 --- a/shared/java/top/fpsmaster/modules/config/ConfigManager.java +++ b/shared/java/top/fpsmaster/modules/config/ConfigManager.java @@ -8,7 +8,6 @@ import top.fpsmaster.features.impl.optimizes.OldAnimations; import top.fpsmaster.features.impl.optimizes.Performance; import top.fpsmaster.features.impl.render.ItemPhysics; -import top.fpsmaster.features.impl.utility.IRC; import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.Setting; import top.fpsmaster.features.settings.impl.*; @@ -177,6 +176,5 @@ private void openDefaultModules() { FPSMaster.moduleManager.getModule(Performance.class).set(true); FPSMaster.moduleManager.getModule(OldAnimations.class).set(true); FPSMaster.moduleManager.getModule(ItemPhysics.class).set(true); - FPSMaster.moduleManager.getModule(IRC.class).set(true); } } diff --git a/shared/java/top/fpsmaster/modules/lua/LuaManager.java b/shared/java/top/fpsmaster/modules/lua/LuaManager.java index 645b6514..2f19f5c2 100644 --- a/shared/java/top/fpsmaster/modules/lua/LuaManager.java +++ b/shared/java/top/fpsmaster/modules/lua/LuaManager.java @@ -8,7 +8,6 @@ import top.fpsmaster.FPSMaster; import top.fpsmaster.exception.FileException; import top.fpsmaster.features.manager.Module; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.modules.logger.ClientLogger; import top.fpsmaster.utils.Utility; import top.fpsmaster.utils.os.FileUtils; @@ -92,16 +91,16 @@ public static LuaScript loadLua(RawLua rawLua) throws FileException { lua.push(L -> { boolean sneak = L.toBoolean(1); - Wrappers.gameSettings().setKeyPress(Utility.mc.gameSettings.keyBindSneak, sneak); + net.minecraft.client.settings.KeyBinding.setKeyBindState(Utility.mc.gameSettings.keyBindSneak.getKeyCode(), sneak); return 0; // 返回值数量 }); lua.setGlobal("sneak"); lua.push(L -> { - double posX = Wrappers.minecraft().getPlayer().posX; - double posY = Wrappers.minecraft().getPlayer().posY; - double posZ = Wrappers.minecraft().getPlayer().posZ; - boolean onGround = Wrappers.minecraft().getPlayer().onGround; + double posX = Utility.mc.thePlayer.posX; + double posY = Utility.mc.thePlayer.posY; + double posZ = Utility.mc.thePlayer.posZ; + boolean onGround = Utility.mc.thePlayer.onGround; lua.push(posX); lua.push(posY); diff --git a/shared/java/top/fpsmaster/modules/music/IngameOverlay.java b/shared/java/top/fpsmaster/modules/music/IngameOverlay.java deleted file mode 100644 index 1407c315..00000000 --- a/shared/java/top/fpsmaster/modules/music/IngameOverlay.java +++ /dev/null @@ -1,94 +0,0 @@ -package top.fpsmaster.modules.music; - -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.util.ResourceLocation; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.features.impl.interfaces.MusicOverlay; -import top.fpsmaster.font.impl.UFontRenderer; -import top.fpsmaster.modules.music.netease.Music; -import top.fpsmaster.utils.Utility; -import top.fpsmaster.utils.math.animation.AnimationUtils; -import top.fpsmaster.utils.render.Render2DUtils; - -import java.awt.*; - -public class IngameOverlay { - private static float songProgress = 0f; - private static double[] smoothCurve = new double[0]; - - public static void onRender() { - if (MusicPlayer.isPlaying) { - ScaledResolution sr = new ScaledResolution(Utility.mc); - double[] curve = MusicPlayer.getCurve(); - if (curve.length != 0) { - int numBars = 60; // 你希望显示的频谱柱条数 - if (smoothCurve.length != numBars) { - smoothCurve = new double[numBars]; - } - - float width = (float) sr.getScaledWidth() / numBars; - - float screenWidth = sr.getScaledWidth(); - float screenHeight = sr.getScaledHeight(); - - int binsPerBar = curve.length / numBars; - - for (int bar = 0; bar < numBars; bar++) { - double sum = 0.0; - for (int j = 0; j < binsPerBar; j++) { - int idx = bar * binsPerBar + j; - sum += Math.max(curve[idx], 0.0); - } - double averageMagnitude = sum / binsPerBar; - averageMagnitude = Math.min(averageMagnitude, 1.0); - averageMagnitude = Math.sqrt(averageMagnitude); - smoothCurve[bar] = AnimationUtils.base(smoothCurve[bar], averageMagnitude, 0.1); - float xPos = (float) bar / numBars * screenWidth; - float height = (float) (smoothCurve[bar] * 100f * MusicOverlay.amplitude.getValue().floatValue()); - - Render2DUtils.drawRect( - xPos, - screenHeight - height, - width, - height, - MusicOverlay.color.getColor() - ); - } - } - } - } - - public static void drawSong(float x, float y, float width, float height) { - ScaledResolution sr = new ScaledResolution(Utility.mc); - Music current = (Music) MusicPlayer.playList.musics.get(MusicPlayer.playList.getCurrent()); - UFontRenderer s18 = FPSMaster.fontManager.s18; - - Render2DUtils.drawOptimizedRoundedRect(x, y, width, height, new Color(0, 0, 0, 180)); - Render2DUtils.drawOptimizedRoundedRect(x, y, songProgress, height, MusicOverlay.progressColor.getColor()); - - songProgress = (float) AnimationUtils.base(songProgress, 6 + (width - 6) * MusicPlayer.curPlayProgress, 0.1); - - Render2DUtils.drawImage( - new ResourceLocation("music/netease/" + current.id), - x + 5, - y + 5, - height - 10, - height - 10, - -1 - ); - - FPSMaster.fontManager.s18.drawString( - current.name, - x + 40, - y + 6, - new Color(234, 234, 234).getRGB() - ); - - FPSMaster.fontManager.s16.drawString( - current.author, - x + 40, - y + 18, - new Color(162, 162, 162).getRGB() - ); - } -} diff --git a/shared/java/top/fpsmaster/modules/music/netease/Music.java b/shared/java/top/fpsmaster/modules/music/netease/Music.java index 80aecf4f..3623bf46 100644 --- a/shared/java/top/fpsmaster/modules/music/netease/Music.java +++ b/shared/java/top/fpsmaster/modules/music/netease/Music.java @@ -3,7 +3,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ThreadDownloadImageData; import net.minecraft.util.ResourceLocation; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.modules.logger.ClientLogger; import top.fpsmaster.modules.music.AbstractMusic; import top.fpsmaster.modules.music.MusicPlayer; @@ -32,7 +31,7 @@ public Music(long id, String name, String artists, String picUrl) { public void loadMusic() { try { - if (Wrappers.world().getWorld() == null) return; + if (Minecraft.getMinecraft().theWorld == null) return; File artist = new File(FileUtils.artists, FileUtils.fixName(name + "(" + id + ").png")); if (!artist.exists()) { HttpRequest.downloadFile(imgURL + "?param=90y90", artist.getAbsolutePath()); diff --git a/shared/java/top/fpsmaster/ui/Compass.java b/shared/java/top/fpsmaster/ui/Compass.java index 70b2544d..6523cf18 100644 --- a/shared/java/top/fpsmaster/ui/Compass.java +++ b/shared/java/top/fpsmaster/ui/Compass.java @@ -6,7 +6,7 @@ import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.opengl.GL11; import top.fpsmaster.FPSMaster; -import top.fpsmaster.api.Wrappers; +import net.minecraft.client.Minecraft; import top.fpsmaster.utils.render.Render2DUtils; import java.awt.*; @@ -55,12 +55,12 @@ public Compass(float i, float o, float s, int a, boolean sh) { } public void draw(ScaledResolution sr) { - if (Wrappers.minecraft().getPlayer() == null) + if (Minecraft.getMinecraft().thePlayer == null) return; preRender(sr); float center = Render2DUtils.getFixedBounds()[0] / 2; int count = 0; - float yaaahhrewindTime = (Wrappers.minecraft().getPlayer().rotationYaw % 360) * 2 + 360 * 3; + float yaaahhrewindTime = (Minecraft.getMinecraft().thePlayer.rotationYaw % 360) * 2 + 360 * 3; GL11.glPushMatrix(); GL11.glEnable(3089); int scaleFactor = Render2DUtils.fixScale(); diff --git a/shared/java/top/fpsmaster/ui/ai/AIChatPanel.java b/shared/java/top/fpsmaster/ui/ai/AIChatPanel.java deleted file mode 100644 index 21c1b702..00000000 --- a/shared/java/top/fpsmaster/ui/ai/AIChatPanel.java +++ /dev/null @@ -1,129 +0,0 @@ -package top.fpsmaster.ui.ai; - -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.ui.click.component.ScrollContainer; -import top.fpsmaster.ui.common.TextField; -import top.fpsmaster.utils.Utility; -import top.fpsmaster.utils.render.Render2DUtils; -import top.fpsmaster.utils.thirdparty.openai.OpenAIClient; - -import java.awt.*; -import java.util.ArrayList; - -public class AIChatPanel { - int x = 0, y = 0; - int w = 220, h = 350; - boolean dragging = false; - int dragX = 0; - int dragY = 0; - - boolean disabled = false; - - ScrollContainer chat = new ScrollContainer(); - - TextField input; - - ArrayList messages = new ArrayList<>(); - - public void init() { - input = new TextField(FPSMaster.fontManager.s16, "输入消息", new Color(60, 60, 60).getRGB(), -1, 256); - } - - public void render(int mouseX, int mouseY, int scaleFactor) { - - Render2DUtils.drawBlurArea(x, y, w, h, 3, new Color(43, 43, 43, 255)); - Render2DUtils.drawOptimizedRoundedRect(x, y, w, h, 3, new Color(43, 43, 43, 80).getRGB()); - - Render2DUtils.drawOptimizedRoundedRect(x, y, w, 16, new Color(43, 87, 145)); - FPSMaster.fontManager.s16.drawString("FPS-Chat", x + 2, y + 1, -1); - input.drawTextBox(x + 2, y + h - 20, w - 4, 18); - - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_SCISSOR_TEST); - Render2DUtils.doGlScissor(x, y + 24, w, h - 46, scaleFactor); - chat.draw(x, y + 16, w - 6, h - 40, mouseX, mouseY, () -> { - int height = (int) (chat.getScroll()) + 22; - for (OpenAIClient.Message message : messages) { - FPSMaster.fontManager.s16.drawString(message.getRole() + ":", x + 2, y + height, -1); - StringBuilder sb = new StringBuilder(); - height += 14; - - ArrayList lines = new ArrayList<>(); - - - int ic = 0; - for (char c : message.getContent().toCharArray()) { - ic++; - sb.append(c); - if (c == '\n' || c == '\r' || FPSMaster.fontManager.s16.getStringWidth(sb.toString()) > w - 16 || ic == message.getContent().length()) { - lines.add(sb.toString()); - sb = new StringBuilder(); - } - } - - for (String line : lines) { - FPSMaster.fontManager.s16.drawString(line, x + 6, y + height, new Color(207, 207, 207).getRGB()); - height += 16; - } - } - - chat.setHeight(height - chat.getScroll()); - }); - - GL11.glDisable(GL11.GL_SCISSOR_TEST); - GL11.glPopMatrix(); - if (dragging) { - x = mouseX - dragX; - y = mouseY - dragY; - if (!Mouse.isButtonDown(0)) { - dragging = false; - } - } - } - - - public void click(int mouseX, int mouseY, int button) { - if (Render2DUtils.isHovered(x, y, w, 16, mouseX, mouseY) && button == 0) { - dragX = mouseX - x; - dragY = mouseY - y; - dragging = true; - } - input.mouseClicked(mouseX, mouseY, button); - } - - public void keyTyped(char typedChar, int keyCode) { - if (keyCode == Keyboard.KEY_RETURN) { - messages.add(new OpenAIClient.Message("user", input.getText())); - OpenAIClient.Message msg = new OpenAIClient.Message("assistant", ""); - messages.add(msg); - getResponse(msg); - disabled = true; - input.setText(""); - return; - } - input.textboxKeyTyped(typedChar, keyCode); - } - - public void getResponse(OpenAIClient.Message msg) { - OpenAIClient.getChatResponseAsync(messages, new OpenAIClient.ResponseCallback() { - @Override - public void onResponse(String response) { - //response - msg.setContent(response); - } - - @Override - public void onError(Exception e) { - Utility.sendClientNotify("Fetching AI response error"); - } - - @Override - public void onFinish(String string) { - disabled = false; - } - }); - } -} diff --git a/shared/java/top/fpsmaster/ui/click/CosmeticScreen.java b/shared/java/top/fpsmaster/ui/click/CosmeticScreen.java deleted file mode 100644 index 6fb5419d..00000000 --- a/shared/java/top/fpsmaster/ui/click/CosmeticScreen.java +++ /dev/null @@ -1,77 +0,0 @@ -package top.fpsmaster.ui.click; - -import org.lwjgl.opengl.GL11; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.exception.AccountException; -import top.fpsmaster.modules.account.AccountManager; -import top.fpsmaster.modules.account.Cosmetic; -import top.fpsmaster.ui.click.component.ScrollContainer; -import top.fpsmaster.utils.render.Render2DUtils; -import top.fpsmaster.utils.render.ScaledGuiScreen; - -import java.awt.*; -import java.io.IOException; - -public class CosmeticScreen extends ScaledGuiScreen { - ScrollContainer container = new ScrollContainer(); - - @Override - public void render(int mouseX, int mouseY, float partialTicks) { - super.render(mouseX, mouseY, partialTicks); - String[] split = AccountManager.cosmeticsHeld.split(","); - Render2DUtils.drawRoundedRectImage(guiWidth / 2f - 200, guiHeight / 2f - 130, 400, 260, 4, new Color(0, 0, 0, 100)); - GL11.glEnable(GL11.GL_SCISSOR_TEST); - Render2DUtils.doGlScissor(guiWidth / 2f - 200, guiHeight / 2f - 130, 400, 260, scaleFactor); - container.draw(guiWidth / 2f - 200, guiHeight / 2f - 130, 400, 260, mouseX, mouseY, () -> { - int y = 0; - for (String id : split) { - if (id.isEmpty()) - continue; - Cosmetic cosmetic = AccountManager.cosmetics.get(Integer.parseInt(id)); - if (!cosmetic.loaded) { - cosmetic.load(); - } - FPSMaster.fontManager.s18.drawString(cosmetic.name, guiWidth / 2f - 190, guiHeight / 2f - 120 + y + container.getScroll(), id.equals(AccountManager.cosmeticsUsing) ? Color.GREEN.getRGB() : Color.WHITE.getRGB()); - y += 20; - } - container.setHeight(y); - }); - GL11.glDisable(GL11.GL_SCISSOR_TEST); - - - } - - @Override - public void initGui() { - super.initGui(); - FPSMaster.async.runnable(() -> { - try { - if (AccountManager.cosmetics.isEmpty()) - FPSMaster.accountManager.refreshCosmetics(); - FPSMaster.accountManager.refreshUserData(); - } catch (AccountException e) { - throw new RuntimeException(e); - } - }); - } - - @Override - public void onClick(int mouseX, int mouseY, int mouseButton) { - String[] split = AccountManager.cosmeticsHeld.split(","); - int y = 0; - for (String id : split) { - if (id.isEmpty()) - continue; - Cosmetic cosmetic = AccountManager.cosmetics.get(Integer.parseInt(id)); - if (Render2DUtils.isHovered(guiWidth / 2f - 200, guiHeight / 2f - 120 + y, 400, 20, mouseX, mouseY)) { - String cosmeticsUsing = String.valueOf(cosmetic.id); - if (AccountManager.cosmeticsUsing.equals(cosmeticsUsing)) { - AccountManager.cosmeticsUsing = ""; - } else { - AccountManager.cosmeticsUsing = cosmeticsUsing; - } - } - y += 20; - } - } -} diff --git a/shared/java/top/fpsmaster/ui/click/MainPanel.java b/shared/java/top/fpsmaster/ui/click/MainPanel.java index c1db0d76..e4b69536 100644 --- a/shared/java/top/fpsmaster/ui/click/MainPanel.java +++ b/shared/java/top/fpsmaster/ui/click/MainPanel.java @@ -9,10 +9,8 @@ import top.fpsmaster.exception.FileException; import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.manager.Module; -import top.fpsmaster.ui.ai.AIChatPanel; import top.fpsmaster.ui.click.component.ScrollContainer; import top.fpsmaster.ui.click.modules.ModuleRenderer; -import top.fpsmaster.ui.click.music.NewMusicPanel; import top.fpsmaster.utils.math.animation.Animation; import top.fpsmaster.utils.math.animation.AnimationUtils; import top.fpsmaster.utils.math.animation.Type; @@ -56,8 +54,6 @@ public class MainPanel extends ScaledGuiScreen { public static Module curModule = null; public static String dragLock = "null"; - public AIChatPanel aiChatPanel = new AIChatPanel(); - public MainPanel() { super(); } @@ -105,43 +101,39 @@ public void render(int mouseX, int mouseY, float partialTicks) { moduleListAlpha = (float) AnimationUtils.base(moduleListAlpha, 255.0, 0.1f); - if (curType == Category.Music) { - NewMusicPanel.draw(x + leftWidth, y, width - leftWidth, height, mouseX, mouseY, scaleFactor); - } else { - GL11.glEnable(GL11.GL_SCISSOR_TEST); - Render2DUtils.doGlScissor( - x, y + 10, width, - (height - 18), - scaleFactor - ); - modHeight = 20f; - float containerWidth = width - leftWidth - 10; - int finalMouseY = mouseY; - modsContainer.draw(x + leftWidth, y + 25f, containerWidth, height - 20f, mouseX, mouseY, () -> { - float modsY = y + 22f; - for (ModuleRenderer m : mods) { - if (m.mod.category == curType) { - float moduleY = modsY + modsContainer.getScroll(); - if (moduleY + 40 + m.height > y && moduleY < y + height) { - m.render( - x + leftWidth + 10, - moduleY, - containerWidth - 10, - 40f, - mouseX, - finalMouseY, - curModule == m.mod - ); - } - modsY += 45 + m.height; - modHeight += 45 + m.height; + GL11.glEnable(GL11.GL_SCISSOR_TEST); + Render2DUtils.doGlScissor( + x, y + 10, width, + (height - 18), + scaleFactor + ); + modHeight = 20f; + float containerWidth = width - leftWidth - 10; + int finalMouseY = mouseY; + modsContainer.draw(x + leftWidth, y + 25f, containerWidth, height - 20f, mouseX, mouseY, () -> { + float modsY = y + 22f; + for (ModuleRenderer m : mods) { + if (m.mod.category == curType) { + float moduleY = modsY + modsContainer.getScroll(); + if (moduleY + 40 + m.height > y && moduleY < y + height) { + m.render( + x + leftWidth + 10, + moduleY, + containerWidth - 10, + 40f, + mouseX, + finalMouseY, + curModule == m.mod + ); } + modsY += 45 + m.height; + modHeight += 45 + m.height; } - modsContainer.setHeight(modHeight); - }); - GL11.glEnable(GL11.GL_BLEND); - GL11.glDisable(GL11.GL_SCISSOR_TEST); - } + } + modsContainer.setHeight(modHeight); + }); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_SCISSOR_TEST); if (Render2DUtils.isHovered(x, (int) (y + height / 2 - 70), categoryAnimation, 140, mouseX, mouseY)) { @@ -232,9 +224,6 @@ public void updateScreen() { public void initGui() { super.initGui(); // aiChatPanel.init(); - if (curType == Category.Music) - NewMusicPanel.init(); - scaleAnimation.fstart(0.8, 1.0, 0.2f, Type.EASE_IN_OUT_QUAD); close = false; @@ -285,21 +274,12 @@ public void keyTyped(char typedChar, int keyCode) throws IOException { } } - NewMusicPanel.keyTyped(typedChar, keyCode); super.keyTyped(typedChar, keyCode); } @Override public void onClick(int mouseX, int mouseY, int mouseButton) { // aiChatPanel.click(mouseX, mouseY, mouseButton); - if (Render2DUtils.isHovered(x + 5, - y + height - 25, - 20, - 20, mouseX, mouseY)) { - if (mouseButton == 0) { - mc.displayGuiScreen(new CosmeticScreen()); - } - } if (!Render2DUtils.isHovered(x, y, width, height, mouseX, mouseY)) return; // if (mouseButton == 0 && Render2DUtils.isHoveredWithoutScale( @@ -328,31 +308,23 @@ public void onClick(int mouseX, int mouseY, int mouseButton) { if (curType != c) { moduleListAlpha = 0f; } - if (c == Category.Music) { - NewMusicPanel.init(); - } curType = c; } my += 27f; } - - if (curType == Category.Music) { - NewMusicPanel.mouseClicked(mouseX, mouseY, mouseButton); - } else { - float modsY = y + 22f + modsContainer.getRealScroll(); - for (ModuleRenderer m : mods) { - if (m.mod.category == curType) { - m.mouseClick( - x + leftWidth, - modsY, - width - leftWidth, - 40f, - mouseX, - mouseY, - mouseButton - ); - modsY += 45 + m.height; - } + float modsY = y + 22f + modsContainer.getRealScroll(); + for (ModuleRenderer m : mods) { + if (m.mod.category == curType) { + m.mouseClick( + x + leftWidth, + modsY, + width - leftWidth, + 40f, + mouseX, + mouseY, + mouseButton + ); + modsY += 45 + m.height; } } } diff --git a/shared/java/top/fpsmaster/ui/click/modules/impl/MultipleItemSettingRender.java b/shared/java/top/fpsmaster/ui/click/modules/impl/MultipleItemSettingRender.java index 527ab07d..e940f585 100644 --- a/shared/java/top/fpsmaster/ui/click/modules/impl/MultipleItemSettingRender.java +++ b/shared/java/top/fpsmaster/ui/click/modules/impl/MultipleItemSettingRender.java @@ -4,8 +4,8 @@ import top.fpsmaster.FPSMaster; import top.fpsmaster.features.manager.Module; import top.fpsmaster.features.settings.impl.MultipleItemSetting; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.ui.click.modules.SettingRender; +import top.fpsmaster.utils.Utility; import top.fpsmaster.utils.render.Render2DUtils; import top.fpsmaster.utils.world.ItemsUtil; @@ -66,7 +66,7 @@ public void renderButton(float x, float y, float mouseX, float mouseY, String ic @Override public void mouseClick(float x, float y, float width, float height, float mouseX, float mouseY, int btn) { if(Render2DUtils.isHovered(x + 10 + xOffset + itemWidth - 15, y - 3,10,10,(int)mouseX,(int)mouseY) && btn == 0){ - ItemStack heldItem = Wrappers.minecraft().getPlayer().getHeldItem(); + ItemStack heldItem = Utility.mc.thePlayer.getHeldItem(); if(heldItem != null){ this.setting.addItem(heldItem); return; diff --git a/shared/java/top/fpsmaster/ui/click/music/MusicPanel.java b/shared/java/top/fpsmaster/ui/click/music/MusicPanel.java deleted file mode 100644 index 0098a489..00000000 --- a/shared/java/top/fpsmaster/ui/click/music/MusicPanel.java +++ /dev/null @@ -1,432 +0,0 @@ -package top.fpsmaster.ui.click.music; - -import com.google.gson.JsonObject; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.ThreadDownloadImageData; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.exception.ExceptionHandler; -import top.fpsmaster.exception.FileException; -import top.fpsmaster.modules.music.AbstractMusic; -import top.fpsmaster.modules.music.JLayerHelper; -import top.fpsmaster.modules.music.MusicPlayer; -import top.fpsmaster.modules.music.PlayList; -import top.fpsmaster.modules.music.netease.Music; -import top.fpsmaster.modules.music.netease.NeteaseApi; -import top.fpsmaster.modules.music.netease.deserialize.MusicWrapper; -import top.fpsmaster.ui.click.component.ScrollContainer; -import top.fpsmaster.ui.common.TextField; -import top.fpsmaster.utils.os.FileUtils; -import top.fpsmaster.utils.render.Render2DUtils; - -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.util.Base64; -import java.util.concurrent.atomic.AtomicReference; - -public class MusicPanel { - - private static PlayList displayList = new PlayList(); - private static PlayList recommendList = new PlayList(); - private static PlayList searchList = new PlayList(); - private static Thread searchThread = null; - - private static float playProgress = 0f; - // private static final SearchBox inputBox = new SearchBox(FPSMaster.i18n.get("music.search"), () -> { -// searchThread = new Thread(MusicPanel::run); -// searchThread.start(); -// }); - private static final TextField inputBox = new TextField(FPSMaster.fontManager.s16, FPSMaster.i18n.get("music.search"), new Color(40, 40, 40, 180).getRGB(), -1, 100, () -> { - searchThread = new Thread(MusicPanel::run); - searchThread.start(); - }); - - private static final String[] pages = {"music.name", "music.list", "music.daily"}; - private static int curSearch = 0; - private static boolean isWaitingLogin = false; - private static String key = null; - private static Thread loginThread = null; - private static final ScrollContainer container = new ScrollContainer(); - - public static int code = 801; - public static String nickname = "Unknown"; - public static float x = 0f; - public static float y = 0f; - public static float width = 0f; - public static float height = 0f; - private static Thread playThread; - - public static void mouseClicked(int mouseX, int mouseY, int btn) { - inputBox.mouseClicked(mouseX, mouseY, btn); - if (searchThread == null || !searchThread.isAlive()) { - float dY = y + 50 + container.getRealScroll(); - for (AbstractMusic music : displayList.musics) { - if (Render2DUtils.isHovered(x, dY, width - 10f, 40f, mouseX, mouseY) && mouseY < y + height - 34 && mouseY > y + 34) { - if (Mouse.isButtonDown(0)) { - music.play(); - MusicPlayer.playList.current = MusicPlayer.playList.musics.indexOf(music); - } - } - dY += 40f; - } - } - - // 搜索 - int xOffset = 0; - for (int i = 0; i < pages.length; i++) { - String page = pages[i]; - int width = FPSMaster.fontManager.s16.getStringWidth(FPSMaster.i18n.get(page)) + 10; - if (Render2DUtils.isHovered(x + 95 + xOffset, y + 8, width, 14f, mouseX, mouseY)) { - if (Mouse.isButtonDown(0)) { - curSearch = i; - if (curSearch == 2) { - MusicPlayer.playList.pause(); - searchThread = new Thread(() -> { - recommendList = MusicWrapper.getSongsFromDaily(); - displayList = recommendList; - setMusicList(); - }); - searchThread.start(); - } - } - } - xOffset += width; - } - - // 操作栏 - AbstractMusic current = MusicPlayer.playList.current(); - if (Render2DUtils.isHovered(x, y + height - 30, width, 4f, mouseX, mouseY)) { - if (Mouse.isButtonDown(0) && current != null) { - if (!MusicPlayer.isPlaying) { - if (playThread != null && playThread.isAlive()) { - playThread.interrupt(); - } - playThread = new Thread( - () -> { - MusicPlayer.playList.play(); - try { - Thread.sleep(50); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - current.seek((mouseX - x) / width); - } - ); - MusicPlayer.isPlaying = true; - } else { - current.seek((mouseX - x) / width); - } - } - } - if (Render2DUtils.isHovered(x + width / 2 - 35, y + height - 23, 16f, 16f, mouseX, mouseY) && btn == 0) { - MusicPlayer.playList.previous(); - } - if (Render2DUtils.isHovered(x + width / 2 + 5, y + height - 23, 16f, 16f, mouseX, mouseY) && btn == 0) { - MusicPlayer.playList.next(); - } - if (Render2DUtils.isHovered(x + width / 2 - 15, y + height - 23, 35 / 2f, 35 / 2f, mouseX, mouseY) && btn == 0) { - if (!MusicPlayer.playList.musics.isEmpty()) { - if (MusicPlayer.isPlaying) { - playProgress = MusicPlayer.getPlayProgress(); - MusicPlayer.playList.pause(); - } else { - FPSMaster.async.runnable(() -> { - MusicPlayer.playList.current().play(); - try { - Thread.sleep(50); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - MusicPlayer.playList.current().seek(playProgress); - }); - MusicPlayer.isPlaying = true; - } - } - } - if (Render2DUtils.isHovered(x + width / 2 - 55, y + height - 21, 12f, 12f, mouseX, mouseY) && btn == 0) { - if (MusicPlayer.mode < 2) { - MusicPlayer.mode++; - MusicPlayer.playList.setMusicList(displayList.musics); - } else { - MusicPlayer.mode = 0; - } - } - } - - public static void keyTyped(char c, int keyCode) { - inputBox.textboxKeyTyped(c, keyCode); - } - - public static void draw(float x, float y, float width, float height, int mouseX, int mouseY, int scaleFactor) { - if (isWaitingLogin) { - FPSMaster.fontManager.s18.drawCenteredString("<", x + 20, y + 20, new Color(234, 234, 234).getRGB()); - if (Render2DUtils.isHovered(x + 20, y + 20, 20f, 20f, mouseX, mouseY) && Mouse.isButtonDown(0)) { - isWaitingLogin = false; - } - try { - ResourceLocation resourceLocation = new ResourceLocation("music/qr"); - Render2DUtils.drawImage(resourceLocation, x + width / 2 - 45, y + height / 2 - 45, 90f, 90f, -1); - } catch (Exception e) { - // Handle exception - } - String scan = ""; - switch (code) { - case 801: - scan = "music.waitscan"; - break; - case 802: - scan = "music.waitconfirmation"; - break; - case 800: - reloadImg(); - code = 801; - break; - case 803: - isWaitingLogin = false; - break; - } - FPSMaster.fontManager.s18.drawCenteredString(FPSMaster.i18n.get(scan), x + width / 2, y + height / 2 + 60, new Color(234, 234, 234).getRGB()); - return; - } - MusicPanel.x = x; - MusicPanel.y = y; - MusicPanel.width = width; - MusicPanel.height = height; - if (displayList.musics.isEmpty() && searchThread == null) { - searchThread = new Thread(() -> searchList = MusicWrapper.searchSongs("C418")); - searchThread.start(); - } - - GL11.glEnable(GL11.GL_SCISSOR_TEST); - Render2DUtils.doGlScissor(x, y, width, height - 30, scaleFactor); - if (searchThread == null || !searchThread.isAlive()) { - AtomicReference dY = new AtomicReference<>(y + 50 + container.getScroll()); - AtomicReference musicHeight = new AtomicReference<>(0f); - - Render2DUtils.drawRect(x, dY.get() - 6, width - 10, 0.5f, new Color(100, 100, 100, 50)); - FPSMaster.fontManager.s16.drawString("#", x + 12, dY.get() - 20, new Color(234, 234, 234).getRGB()); - FPSMaster.fontManager.s16.drawString("标题", x + 30, dY.get() - 20, new Color(234, 234, 234).getRGB()); - - // music list - container.draw(x, y + 50, width - 5, height - 80, mouseX, mouseY, () -> { - for (int i = 0; i < displayList.musics.size(); i++) { - Music music = (Music) displayList.musics.get(i); - if (Render2DUtils.isHovered(x, dY.get(), width - 10f, 40f, mouseX, mouseY) && mouseY > y + 50 && mouseY < y + height - 34) { - Render2DUtils.drawOptimizedRoundedRect(x, dY.get(), width - 10, 40f, new Color(200, 200, 200, 50)); - } - FPSMaster.fontManager.s16.drawCenteredString("" + i, x + 15, dY.get() + 15, new Color(234, 234, 234).getRGB()); - if (dY.get() > y && dY.get() < y + height - 10) { - if (music.isLoadedImage) { - Render2DUtils.drawImage(new ResourceLocation("music/netease/" + music.id), x + 30, dY.get() + 10, 20f, 20f, -1); - } else { - Render2DUtils.drawOptimizedRoundedRect(x + 30, dY.get() + 10, 20f, 20f, new Color(200, 200, 200, 255)); - } - } - FPSMaster.fontManager.s16.drawString(music.name + " " + music.author, x + 60, dY.get() + 10, new Color(234, 234, 234).getRGB()); - FPSMaster.fontManager.s16.drawString(music.author, x + 60, dY.get() + 20, new Color(162, 162, 162).getRGB()); - dY.updateAndGet(v -> v + 40f); - musicHeight.updateAndGet(v -> v + 40f); - } - container.setHeight(musicHeight.get()); - }); - - } else { - FPSMaster.fontManager.s18.drawCenteredString("...", x + width / 2, y + 60, new Color(234, 234, 234).getRGB()); - } - GL11.glDisable(GL11.GL_SCISSOR_TEST); - - // 搜索 - inputBox.drawTextBox(x + 5, y + 8, 80f, 16f); - - // 分页 - int xOffset = 0; - int pagesWidth = 0; - for (String page : pages) { - pagesWidth += FPSMaster.fontManager.s16.getStringWidth(FPSMaster.i18n.get(page)) + 10; - } - Render2DUtils.drawOptimizedRoundedRect(x + 90, y + 8, pagesWidth, 16f, new Color(50, 50, 50, 100).getRGB()); - for (String page : pages) { - int stringWidth = FPSMaster.fontManager.s16.getStringWidth(FPSMaster.i18n.get(page)); - if (page.equals(pages[curSearch])) { - Render2DUtils.drawOptimizedRoundedRect(x + 90 + xOffset, y + 8, stringWidth + 10, 16f, -1); - FPSMaster.fontManager.s16.drawString(FPSMaster.i18n.get(page), x + 95 + xOffset, y + 12, new Color(50, 50, 50).getRGB()); - } else { - FPSMaster.fontManager.s16.drawString(FPSMaster.i18n.get(page), x + 95 + xOffset, y + 12, -1); - } - xOffset += stringWidth + 10; - } - - // login - if (NeteaseApi.cookies.isEmpty()) { - if (!nickname.isEmpty()) { - nickname = "Unknown"; - } - int stringWidth = FPSMaster.fontManager.s16.getStringWidth(FPSMaster.i18n.get("music.notLoggedIn")); - if (Render2DUtils.isHovered(x + width - stringWidth - 5, y + 10, stringWidth, 16f, mouseX, mouseY)) { - FPSMaster.fontManager.s16.drawString(FPSMaster.i18n.get("music.notloggedin"), x + width - stringWidth - 5, y + 10, new Color(234, 234, 234).getRGB()); - if (Mouse.isButtonDown(0)) { - isWaitingLogin = true; - reloadImg(); - code = 801; - } - } else { - FPSMaster.fontManager.s16.drawString(FPSMaster.i18n.get("music.notloggedin"), x + width - stringWidth - 5, y + 10, new Color(162, 162, 162).getRGB()); - } - } else { - int stringWidth = FPSMaster.fontManager.s16.getStringWidth(nickname); - FPSMaster.fontManager.s16.drawString(nickname, x + width - stringWidth - 5, y + 10, -1); - if (Render2DUtils.isHovered(x + width - stringWidth - 5, y + 10, stringWidth, 16f, mouseX, mouseY)) { - if (Mouse.isButtonDown(0)) { - isWaitingLogin = true; - reloadImg(); - code = 801; - } - } - } - - // 操作栏 - AbstractMusic current = MusicPlayer.playList.current(); - Render2DUtils.drawRect(x, y + height - 30, width, 2f, new Color(58, 58, 58).getRGB()); - Render2DUtils.drawRect(x, y + height - 30, width * MusicPlayer.getPlayProgress(), 2f, -1); - if (Render2DUtils.isHovered(x, y + height - 32, width, 4f, mouseX, mouseY)) { - Render2DUtils.drawRect(x, y + height - 31f, width * MusicPlayer.getPlayProgress(), 4f, -1); - } - - // 音量 - Render2DUtils.drawImage(new ResourceLocation("client/textures/ui/volume.png"), x + width - 50, y + height - 16, 7f, 7f, -1); - Render2DUtils.drawRect(x + width - 40, y + height - 14, 30f, 2f, new Color(58, 58, 58).getRGB()); - Render2DUtils.drawRect(x + width - 40, y + height - 14, 30 * MusicPlayer.getVolume(), 2f, -1); - if (Render2DUtils.isHovered(x + width - 40, y + height - 14, 30f, 2f, mouseX, mouseY)) { - Render2DUtils.drawRect(x + width - 40, y + height - 14.5f, 30 * MusicPlayer.getVolume(), 3f, -1); - if (Mouse.isButtonDown(0)) { - float newVolume = (mouseX - x - width + 40) / 30f; - MusicPlayer.setVolume(newVolume); - } - } - int trimWidth = (int) (width / 2 - 100); - if (!MusicPlayer.playList.musics.isEmpty() && current != null) { - String name = FPSMaster.fontManager.s18.trimString(current.name + " - " + current.author, trimWidth, false); - FPSMaster.fontManager.s18.drawString(name, x + 30, y + height - 23, new Color(234, 234, 234).getRGB()); - String progress = "0:00/0:00"; - if (JLayerHelper.clip != null) { - double duration = JLayerHelper.getDuration(); - int minutes = (int) (duration * MusicPlayer.getPlayProgress()); - int seconds = (int) ((duration * MusicPlayer.getPlayProgress() - minutes) * 60); - progress = minutes + ":" + seconds + "/" + (int) duration + ":" + (int) ((duration - (int) duration) * 60); - } - FPSMaster.fontManager.s16.drawString(progress, x + 30, y + height - 14, new Color(162, 162, 162).getRGB()); - if (MusicPlayer.playList.current() != null && ((Music) MusicPlayer.playList.current()).isLoadedImage) { - Render2DUtils.drawImage(new ResourceLocation("music/netease/" + ((Music) MusicPlayer.playList.current()).id), x + 5, y + height - 24, 20f, 20f, -1); - } else { - Render2DUtils.drawOptimizedRoundedRect(x + 5, y + height - 24, 20f, 20f, new Color(200, 200, 200, 255)); - } - } - ResourceLocation res = new ResourceLocation("client/gui/settings/music/loop.png"); - switch (MusicPlayer.mode) { - case 0: - res = new ResourceLocation("client/gui/settings/music/shuffle.png"); - break; - case 1: - res = new ResourceLocation("client/gui/settings/music/order.png"); - break; - case 2: - res = new ResourceLocation("client/gui/settings/music/loop.png"); - break; - } - Render2DUtils.drawImage(res, x + width / 2 - 55, y + height - 21, 12f, 12f, new Color(234, 234, 234)); - Render2DUtils.drawImage(new ResourceLocation("client/gui/settings/music/previous.png"), x + width / 2 - 35, y + height - 23, 16f, 16f, new Color(234, 234, 234)); - Render2DUtils.drawImage(MusicPlayer.isPlaying ? new ResourceLocation("client/gui/settings/music/pause.png") : new ResourceLocation("client/gui/settings/music/play.png"), x + width / 2 - 15, y + height - 23, 35 / 2f, 35 / 2f, -1); - Render2DUtils.drawImage(new ResourceLocation("client/gui/settings/music/next.png"), x + width / 2 + 5, y + height - 23, 16f, 16f, new Color(234, 234, 234)); - } - - private static String extractMiddleContent(String input, String prefix, String suffix) { - int startIndex = input.indexOf(prefix); - if (startIndex != -1) { - int endIndex = input.indexOf(suffix, startIndex + prefix.length()); - if (endIndex != -1) { - return input.substring(startIndex + prefix.length(), endIndex); - } - } - return ""; - } - - private static void reloadImg() { - loginThread = new Thread(() -> { - while (isWaitingLogin) { - try { - JsonObject loginStatus = MusicWrapper.getLoginStatus(key); - code = loginStatus.get("code").getAsInt(); - if (code == 802) { - String element = loginStatus.get("nickname").getAsString(); - if (element != null) { - nickname = element; - try { - FileUtils.saveTempValue("nickname", nickname); - } catch (FileException e) { - ExceptionHandler.handleFileException(e, "无法保存昵称"); - } - } - } - if (code == 803) { - // parse cookie - String asString = loginStatus.get("cookie").getAsString(); - String result = "MUSIC_U=" + extractMiddleContent(asString, "MUSIC_U=", ";") + "; " + "NMTID=" + extractMiddleContent(asString, "NMTID=", ";"); - NeteaseApi.cookies = result; - - try { - FileUtils.saveTempValue("cookies", NeteaseApi.cookies); - System.out.println("cookies: " + NeteaseApi.cookies); - } catch (FileException e) { - ExceptionHandler.handleFileException(e, "无法保存cookies"); - } - } - Thread.sleep(1000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - }); - FPSMaster.async.runnable(() -> { - key = MusicWrapper.getQRKey(); - if (key == null) return; - String base64 = MusicWrapper.getQRCodeImg(key); - // render base64 img data - net.minecraft.client.renderer.texture.TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); - // base64 decode - byte[] bytes = Base64.getDecoder().decode(base64); - // create resource location - ResourceLocation resourceLocation = new ResourceLocation("music/qr"); - try { - ThreadDownloadImageData textureArt = new ThreadDownloadImageData(null, null, resourceLocation, null); - // convert bytes to bufferedimage - ByteArrayInputStream bis = new ByteArrayInputStream(bytes); - BufferedImage bufferedImage = ImageIO.read(bis); - textureArt.setBufferedImage(bufferedImage); - textureManager.loadTexture(resourceLocation, textureArt); - loginThread.start(); - } catch (IOException e) { - throw new RuntimeException(e); - } - }); - } - - private static void setMusicList() { - MusicPlayer.playList.setMusicList(displayList.musics); - } - - private static void run() { - if (!inputBox.getText().isEmpty()) { - searchList = curSearch == 0 ? MusicWrapper.searchSongs(inputBox.getText()) : MusicWrapper.searchList(inputBox.getText()); - displayList = searchList; - MusicPlayer.playList.pause(); - setMusicList(); - searchThread = null; - } - } -} diff --git a/shared/java/top/fpsmaster/ui/click/music/NewMusicPanel.java b/shared/java/top/fpsmaster/ui/click/music/NewMusicPanel.java deleted file mode 100644 index ae1e2604..00000000 --- a/shared/java/top/fpsmaster/ui/click/music/NewMusicPanel.java +++ /dev/null @@ -1,457 +0,0 @@ -package top.fpsmaster.ui.click.music; - -import com.google.gson.JsonObject; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.ThreadDownloadImageData; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.exception.ExceptionHandler; -import top.fpsmaster.exception.FileException; -import top.fpsmaster.font.impl.UFontRenderer; -import top.fpsmaster.forge.api.IMinecraft; -import top.fpsmaster.modules.music.*; -import top.fpsmaster.modules.music.netease.Music; -import top.fpsmaster.modules.music.netease.NeteaseApi; -import top.fpsmaster.modules.music.netease.NeteaseProfile; -import top.fpsmaster.modules.music.netease.deserialize.MusicWrapper; -import top.fpsmaster.ui.click.component.ScrollContainer; -import top.fpsmaster.ui.common.TextField; -import top.fpsmaster.utils.math.animation.Animation; -import top.fpsmaster.utils.math.animation.Type; -import top.fpsmaster.utils.os.FileUtils; -import top.fpsmaster.utils.render.Render2DUtils; - -import java.awt.*; -import java.io.File; -import java.util.ArrayList; -import java.util.Base64; - -import static top.fpsmaster.utils.Utility.mc; - -public class NewMusicPanel { - - // Threads - private static Thread loginThread = null; - private static Thread songsLoadThread = null; - private static Thread playThread = null; - - // login - static boolean isWaitingLogin = false; - static int loginCode; - public static String nickname = ""; - private static String key; - private static ArrayList dailyTracks = new ArrayList<>(); - private static ArrayList likedTracks = new ArrayList<>(); - - static Track recommendTrack; - static Thread loadThread = null; - - // tracks - static Track currentTrack; - - public static Music playing; - static NeteaseProfile profile; - private static Track playingTrack; - private static final Animation opacityAnimation = new Animation(); - // search - public static TextField searchField = new TextField(FPSMaster.fontManager.s14, "搜索歌曲", new Color(56, 56, 56).getRGB(), new Color(200, 200, 200).getRGB(), 50, NewMusicPanel::search); - static boolean searching = false; - - public static void search() { - FPSMaster.async.runnable(() -> { - searching = true; - currentTrack = new Track(-1L, "", ""); - PlayList playList = MusicWrapper.searchSongs(searchField.getText()); - currentTrack.setMusics(playList.musics); - currentTrack.setLoaded(true); - searching = false; - }); - } - - int mode = 0; - - public static void init() { - if (playThread == null) { - playThread = new Thread(() -> { - while (((IMinecraft) mc).arch$getRunning()) { - if (playing != null) { - // next song - if (MusicPlayer.getPlayProgress() > 0.999f) { - MusicPlayer.isPlaying = false; - nextSong(); - } - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } else { - try { - Thread.sleep(10000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - } - } - }); - playThread.start(); - } - if (loadThread == null || !loadThread.isAlive()) { - loadThread = new Thread(() -> { - searching = true; - if (profile == null) - profile = MusicWrapper.getProfile(); - if (profile != null) { - if (dailyTracks.isEmpty()) { - dailyTracks = MusicWrapper.getTracksDaily(); - } - if (likedTracks.isEmpty()) { - likedTracks = MusicWrapper.getTracksLiked(profile.id); - } - } - searching = false; - if (recommendTrack == null || recommendTrack.getMusics().isEmpty()) { - recommendTrack = new Track(0L, "日推", ""); - recommendTrack.setMusics(MusicWrapper.getSongsFromDaily().musics); - recommendTrack.setLoaded(true); - } - }); - loadThread.start(); - } - } - - private static void nextSong() { - int i = playingTrack.getMusics().indexOf(playing); - if (i + 1 >= playingTrack.getMusics().size()) { - i = 0; - } else { - i++; - } - playing = (Music) playingTrack.getMusics().get(i); - playing.play(); - } - - // containers - static ScrollContainer scrollContainer = new ScrollContainer(); - static ScrollContainer songsContainer = new ScrollContainer(); - - public static void draw(float x, int y, float width, float height, int mouseX, int mouseY, int scaleFactor) { - Render2DUtils.drawImage(new ResourceLocation("client/gui/music.png"), x + 12, y + 14, 75, 16, -1); - searchField.drawTextBox(x + 32, y + 14, 100, 16); - if (Render2DUtils.isHovered(x + 12, y + 14, 16, 16, mouseX, mouseY) && consumeClick(0)) { - currentTrack = null; - isWaitingLogin = false; - if (loginThread != null) { - loginThread.interrupt(); - loginThread = null; - } - } - if (profile == null) { - int stringWidth = FPSMaster.fontManager.s16.getStringWidth(FPSMaster.i18n.get("music.notLoggedIn")); - Color color = new Color(162, 162, 162); - if (Render2DUtils.isHovered(x + width - stringWidth - 5, y + 15, stringWidth, 16f, mouseX, mouseY)) { - color = new Color(234, 234, 234); - if (consumeClick(0)) { - isWaitingLogin = true; - reloadImg(); - loginCode = 801; - } - } - FPSMaster.fontManager.s16.drawString(FPSMaster.i18n.get("music.notloggedin"), x + width - stringWidth - 10, y + 15, color.getRGB()); - } else { - int stringWidth = FPSMaster.fontManager.s16.getStringWidth(profile.nickname); - Render2DUtils.drawWebImage(profile.avatarUrl, x + width - stringWidth - 30, y + 14f, 16, 16); - FPSMaster.fontManager.s16.drawString(profile.nickname, x + width - stringWidth - 10, y + 15, -1); - if (Render2DUtils.isHovered(x + width - stringWidth - 10, y + 10, stringWidth, 16f, mouseX, mouseY)) { - if (consumeClick(0)) { - isWaitingLogin = true; - reloadImg(); - loginCode = 801; - } - } - } - if(isWaitingLogin) { - ResourceLocation resourceLocation = new ResourceLocation("music/qr"); - Render2DUtils.drawImage(resourceLocation, x + width / 2 - 45, y + height / 2 - 45, 90f, 90f, -1); - }else{ - if (searching) { - FPSMaster.fontManager.s22.drawCenteredString("加载中...", x + width / 2, y + height / 2 - 20, -1); - } else { - if (currentTrack == null) { - GL11.glEnable(GL11.GL_SCISSOR_TEST); - Render2DUtils.doGlScissor(x + 12, y + 35, width - 12, height - 65, scaleFactor); - int finalY = (int) (y + scrollContainer.getScroll()); - scrollContainer.draw(x + 12, y + 35, width - 12, height - 65, mouseX, mouseY, () -> { - String recommendSong = ""; - - if (recommendTrack != null && !recommendTrack.getMusics().isEmpty()) { - recommendSong = recommendTrack.getMusics().get(0).name; - } - - int tX = 0; - int tY = 60; - FPSMaster.fontManager.s22.drawString("推荐歌单", x + 20, finalY + 40, -1); - if (recommendTrack != null) - drawTrack(recommendTrack, "每日推荐", "每日推荐,从『" + recommendSong + "』听起", x + 20, finalY + 60, mouseX, mouseY, new Color(255, 73, 73, 200)); - tY = drawTracks(x, width, mouseX, mouseY, finalY, tX + 70, tY, dailyTracks); - tY += 120; - FPSMaster.fontManager.s22.drawString("收藏的歌单", x + 20, finalY + tY - 20, -1); - tY = drawTracks(x, width, mouseX, mouseY, finalY, tX, tY, likedTracks); - scrollContainer.setHeight(tY + 80); - }); - GL11.glDisable(GL11.GL_SCISSOR_TEST); - } else { - GL11.glEnable(GL11.GL_SCISSOR_TEST); - Render2DUtils.doGlScissor(x + 12, y + 35, width - 12, height - 65, scaleFactor); - if (!currentTrack.isLoaded() && (songsLoadThread == null || !songsLoadThread.isAlive())) { - songsLoadThread = new Thread(() -> { - searching = true; - currentTrack.loadMusic(); - searching = false; - }); - songsLoadThread.start(); - } - if (currentTrack.isLoaded()) { - int finalY = (int) (y + songsContainer.getScroll()); - songsContainer.draw(x + 12, y + 35, width - 12, height - 65, mouseX, mouseY, () -> { - int sY = 40; - for (AbstractMusic music : currentTrack.getMusics()) { - if (finalY + sY + 25 > y + 35 && finalY + sY < y + 35 + height - 65) { - Music neteaseMusic = (Music) music; - boolean isHovered = Render2DUtils.isHovered(x + 15, finalY + sY - 5, width - 25, 30, mouseX, mouseY); - if (isHovered) { - Render2DUtils.drawOptimizedRoundedRect(x + 15,finalY + sY - 5, width - 25, 30,new Color(255,255,255,50)); - if(consumeClick(0)){ - playing = (Music) music; - playingTrack = currentTrack; - music.play(); - } - } - if (neteaseMusic.isLoadedImage) { - Render2DUtils.drawImage(new ResourceLocation("music/netease/" + neteaseMusic.id), x + 20, finalY + sY, 20f, 20f, -1); - } else { - Render2DUtils.drawOptimizedRoundedRect(x + 20, finalY + sY, 20f, 20f, new Color(200, 200, 200, 255)); - } - FPSMaster.fontManager.s18.drawString(neteaseMusic.name, x + 45, finalY + sY, -1); - FPSMaster.fontManager.s14.drawString(neteaseMusic.author, x + 45, finalY + sY + 10, new Color(200, 200, 200).getRGB()); - } - sY += 31; - } - songsContainer.setHeight(sY); - }); - } - GL11.glDisable(GL11.GL_SCISSOR_TEST); - } - - Render2DUtils.drawRoundedRectImage(x + 1, y + height - 30, width - 2, 31, 10, new Color(0, 0, 0, 150)); - if (playing != null) { - int opacity; - opacityAnimation.start(0,255,0.2f,Type.EASE_IN_QUAD); - if(!opacityAnimation.isFinished()){ - opacityAnimation.update(); - opacity = (int) opacityAnimation.value; - } else { - opacity = 255; - } - - UFontRenderer s14 = FPSMaster.fontManager.s14; - s14.drawString(s14.trimString(playing.name, 100, false), x + 30, y + height - 22, new Color(234, 234, 234, opacity).getRGB()); - s14.drawString(s14.trimString(playing.author, 60, false), x + 30, y + height - 12, new Color(124, 124, 124, opacity).getRGB()); - - if (playing.isLoadedImage) { - Render2DUtils.drawImage(new ResourceLocation("music/netease/" + playing.id), x + 5, y + height - 25, 20f, 20f, new Color(255,255,255,opacity)); - } else { - Render2DUtils.drawOptimizedRoundedRect(x + 5, y + height - 25, 20f, 20f, new Color(200, 200, 200, opacity)); - } - // 进度条 - if (Render2DUtils.isHovered(x + width / 2 - 80, y + height - 6, 160, 3, mouseX, mouseY)) { - Render2DUtils.drawRoundedRectImage(x + width / 2 - 80, y + height - 6, 160, 3, 3, new Color(95, 95, 95,opacity)); - if (consumeClick(0)) { - playing.seek((mouseX - (x + width / 2 - 80)) / 160f); - if (!MusicPlayer.isPlaying) - MusicPlayer.play(); - } - } else { - Render2DUtils.drawRoundedRectImage(x + width / 2 - 80, y + height - 6, 160, 3, 3, new Color(51, 51, 51,opacity)); - } - float playProgress = MusicPlayer.getPlayProgress(); - if (JLayerHelper.clip == null) { - Render2DUtils.drawRoundedRectImage(x + width / 2 - 80, y + height - 6, 160f * playing.downloadProgress, 3, 3, new Color(148, 148, 148,opacity)); - } else { - Render2DUtils.drawRoundedRectImage(x + width / 2 - 80, y + height - 6, 160f * playProgress, 3, 3, new Color(225, 73, 73,opacity)); - } - - // 操作按钮 - Render2DUtils.drawImage(new ResourceLocation("client/gui/settings/music/previous.png"), x + width / 2 - 35, y + height - 25, 16f, 16f, new Color(234, 234, 234,opacity)); - Render2DUtils.drawImage(MusicPlayer.isPlaying ? new ResourceLocation("client/gui/settings/music/pause.png") : new ResourceLocation("client/gui/settings/music/play.png"), x + width / 2 - 15, y + height - 26, 35 / 2f, 35 / 2f, new Color(255,255,255,opacity)); - Render2DUtils.drawImage(new ResourceLocation("client/gui/settings/music/next.png"), x + width / 2 + 5, y + height - 25, 16f, 16f, new Color(234, 234, 234,opacity)); - - // 音量键 - Render2DUtils.drawImage(new ResourceLocation("client/textures/ui/volume.png"), x + width - 62, y + height - 16, 7f, 7f, new Color(234, 234, 234,opacity)); - Render2DUtils.drawRoundedRectImage(x + width - 50, y + height - 13, 30f, 2f,1, new Color(108, 108, 108)); - float volume = MusicPlayer.getVolume(); - Render2DUtils.drawRoundedRectImage(x + width - 50, y + height - 13, 30f * volume, 2f,1, new Color(255,255,255)); - if (Render2DUtils.isHovered(x + width - 50, y + height - 13, 30f, 2f, mouseX, mouseY) && Mouse.isButtonDown(0)){ - float newVolume = (mouseX - (x + width - 50)) / 30f; - MusicPlayer.setVolume(newVolume); - } - - - if (JLayerHelper.clip != null) { - if (Render2DUtils.isHovered(x + width / 2 - 15, y + height - 26, 35 / 2f, 35 / 2f, mouseX, mouseY) && consumeClick(0)) { - if (MusicPlayer.isPlaying) - MusicPlayer.pause(); - else - MusicPlayer.play(); - } - - double duration = JLayerHelper.getDuration(); - int minutes = (int) (duration * playProgress); - int seconds = (int) ((duration * playProgress - minutes) * 60); - String progress = minutes + ":" + seconds; - String total = (int) duration + ":" + (int) ((duration - (int) duration) * 60); - s14.drawString(progress, x + width / 2 - 80 - s14.getStringWidth(progress) - 2, y + height - 10, new Color(160, 160, 160,opacity).getRGB()); - s14.drawString(total, x + width / 2 + 80 + 2, y + height - 10, new Color(160, 160, 160,opacity).getRGB()); - } - } - } - } - - mouseButton = -1; - } - - private static int drawTracks(float x, float width, int mouseX, int mouseY, int finalY, int tX, int tY, ArrayList likedTracks) { - for (Track track : likedTracks) { - drawTrack(track, "", track.getName(), x + 20 + tX, finalY + tY, mouseX, mouseY, new Color(0, 0, 0, 100)); - tX += 70; - if (tX >= width - 40) { - tX = 0; - tY += 90; - } - } - return tY; - } - - - private static void drawTrack(Track track, String name, String desc, float x, float y, int mouseX, int mouseY, Color color) { - if (Render2DUtils.isHovered(x, y, 60, 82, mouseX, mouseY) && consumeClick(0)) { - currentTrack = track; - } - - Render2DUtils.drawOptimizedRoundedRect(x, y, 60, 82, track.getDominateColor() == null ? new Color(202, 112, 112) : track.getDominateColor()); - if (track != null && !track.getPicUrl().isEmpty()) { - Render2DUtils.drawImage(track.getCoverResource(), x, y, 60, 60, -1); - } else { - Render2DUtils.drawOptimizedRoundedRect(x, y, 60, 60, color); - } - FPSMaster.fontManager.s18.drawString(name, x + 5, y + 5, track.getFontColor().getRGB()); - String text = FPSMaster.fontManager.s16.trimString(desc, 60, false); - FPSMaster.fontManager.s14.drawString(text, x + 2, y + 62, track.getFontColor().getRGB()); - if (desc.length() > text.length()) { - String substring = desc.substring(text.length()); - substring = FPSMaster.fontManager.s16.trimString(substring, 60, false); - FPSMaster.fontManager.s14.drawString(substring, x + 2, y + 72, track.getFontColor().getRGB()); - } - - } - - - public static void keyTyped(char typedChar, int keyCode) { - searchField.textboxKeyTyped(typedChar, keyCode); - } - - - static int mouseButton = -1; - - public static void mouseClicked(int mouseX, int mouseY, int btn) { - mouseButton = btn; - searchField.mouseClicked(mouseX, mouseY, btn); - } - - public static boolean consumeClick(int btn) { - boolean temp = mouseButton == btn; - if (temp) - mouseButton = -1; - return temp; - } - - - private static void reloadImg() { - loginThread = new Thread(() -> { - while (isWaitingLogin) { - try { - JsonObject loginStatus = MusicWrapper.getLoginStatus(key); - loginCode = loginStatus.get("code").getAsInt(); - if (loginCode == 802) { - String element = loginStatus.get("nickname").getAsString(); - if (element != null) { - nickname = element; - try { - FileUtils.saveTempValue("nickname", nickname); - } catch (FileException e) { - ExceptionHandler.handleFileException(e, "无法保存昵称"); - } - } - } - if (loginCode == 803) { - // parse cookie - String asString = loginStatus.get("cookie").getAsString(); - String result = "MUSIC_U=" + subString(asString, "MUSIC_U=", ";") + "; " + "NMTID=" + subString(asString, "NMTID=", ";"); - NeteaseApi.cookies = result; - try { - FileUtils.saveTempValue("cookies", NeteaseApi.cookies); - isWaitingLogin = false; - profile = MusicWrapper.getProfile(); - return; - } catch (FileException e) { - ExceptionHandler.handleFileException(e, "无法保存cookies"); - } - } - Thread.sleep(1000); - } catch (InterruptedException e) { - isWaitingLogin = false; - throw new RuntimeException(e); - } - } - }); - FPSMaster.async.runnable(() -> { - key = MusicWrapper.getQRKey(); - if (key == null) return; - String base64 = MusicWrapper.getQRCodeImg(key); - System.out.println(base64); - // render base64 img data - TextureManager textureManager = Minecraft.getMinecraft().getTextureManager(); - // base64 decode - byte[] bytes = Base64.getDecoder().decode(base64); - // create resource location - ResourceLocation resourceLocation = new ResourceLocation("music/qr"); - File qr = new File(FileUtils.dir, "/music/qr.png"); - File qrf = new File(FileUtils.dir, "/music"); - qrf.mkdirs(); - try { - FileUtils.saveFileBytes("/music/qr.png", bytes); - ThreadDownloadImageData textureArt = new ThreadDownloadImageData(qr, null, null, null); - textureManager.loadTexture(resourceLocation, textureArt); - - loginThread.start(); - } catch (FileException e) { - ExceptionHandler.handleFileException(e, "无法保存二维码图片"); - } - }); - } - - private static String subString(String input, String prefix, String suffix) { - int startIndex = input.indexOf(prefix); - if (startIndex != -1) { - int endIndex = input.indexOf(suffix, startIndex + prefix.length()); - if (endIndex != -1) { - return input.substring(startIndex + prefix.length(), endIndex); - } - } - return ""; - } - -} diff --git a/shared/java/top/fpsmaster/ui/common/TextField.java b/shared/java/top/fpsmaster/ui/common/TextField.java index 4727e28c..9ed8d946 100644 --- a/shared/java/top/fpsmaster/ui/common/TextField.java +++ b/shared/java/top/fpsmaster/ui/common/TextField.java @@ -4,12 +4,12 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.ChatAllowedCharacters; import top.fpsmaster.font.impl.UFontRenderer; import top.fpsmaster.utils.math.MathUtils; import top.fpsmaster.utils.render.Render2DUtils; -import top.fpsmaster.wrapper.renderEngine.bufferbuilder.WrapperBufferBuilder; import java.awt.*; import java.util.Arrays; @@ -521,7 +521,7 @@ private void drawCursorVertical(float startX, float startY, float endX, float en } Tessellator tessellator = Tessellator.getInstance(); - WrapperBufferBuilder bufferbuilder = new WrapperBufferBuilder(tessellator); + WorldRenderer bufferbuilder = tessellator.getWorldRenderer(); GlStateManager.color(0.0F, 0.0F, 255.0F, 255.0F); GlStateManager.disableTexture2D(); GlStateManager.enableColorLogic(); diff --git a/shared/java/top/fpsmaster/ui/custom/Component.java b/shared/java/top/fpsmaster/ui/custom/Component.java index ef03658a..a144e29a 100644 --- a/shared/java/top/fpsmaster/ui/custom/Component.java +++ b/shared/java/top/fpsmaster/ui/custom/Component.java @@ -9,7 +9,7 @@ import top.fpsmaster.features.impl.InterfaceModule; import top.fpsmaster.features.impl.interfaces.ClientSettings; import top.fpsmaster.font.impl.UFontRenderer; -import top.fpsmaster.api.Wrappers; +import net.minecraft.client.Minecraft; import top.fpsmaster.ui.click.MainPanel; import top.fpsmaster.utils.Utility; import top.fpsmaster.utils.math.animation.AnimationUtils; @@ -229,10 +229,10 @@ public void drawString(int fontSize, boolean bold, String text, float x, float y GL11.glTranslated(x, y, 0.0); GL11.glScaled(scaled, scaled, 1.0); if (mod.fontShadow.getValue()) { - Wrappers.minecraft().getFontRenderer().drawStringWithShadow(text, 0f, 0f, color); + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(text, 0, 0, color); } else { GL11.glColor4f(1, 1, 1, 1); - Wrappers.minecraft().drawString(text, 0f, 0f, color); + Minecraft.getMinecraft().fontRendererObj.drawString(text, 0, 0, color); } GL11.glPopMatrix(); } @@ -240,11 +240,11 @@ public void drawString(int fontSize, boolean bold, String text, float x, float y public float getStringWidth(int fontSize, String name) { UFontRenderer font = FPSMaster.fontManager.getFont(fontSize); - return mod.betterFont.getValue() ? font.getStringWidth(name) : Wrappers.minecraft().getFontRenderer().getStringWidth(name); + return mod.betterFont.getValue() ? font.getStringWidth(name) : Minecraft.getMinecraft().fontRendererObj.getStringWidth(name); } public float getStringHeight(int fontSize) { UFontRenderer font = FPSMaster.fontManager.getFont(fontSize); - return mod.betterFont.getValue() ? font.getHeight() : Wrappers.minecraft().getFontRenderer().FONT_HEIGHT; + return mod.betterFont.getValue() ? font.getHeight() : Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT; } } diff --git a/shared/java/top/fpsmaster/ui/custom/ComponentsManager.java b/shared/java/top/fpsmaster/ui/custom/ComponentsManager.java index 51aaed75..102aa42c 100644 --- a/shared/java/top/fpsmaster/ui/custom/ComponentsManager.java +++ b/shared/java/top/fpsmaster/ui/custom/ComponentsManager.java @@ -21,14 +21,12 @@ public class ComponentsManager { public void init() { components.add(new FPSDisplayComponent()); components.add(new ArmorDisplayComponent()); - components.add(new MusicComponent()); components.add(new ScoreboardComponent()); components.add(new PotionDisplayComponent()); components.add(new CPSDisplayComponent()); components.add(new KeystrokesComponent()); components.add(new ReachDisplayComponent()); components.add(new ComboDisplayComponent()); - components.add(new LyricsComponent()); components.add(new InventoryDisplayComponent()); components.add(new TargetHUDComponent()); components.add(new PlayerDisplayComponent()); diff --git a/shared/java/top/fpsmaster/ui/custom/impl/ArmorDisplayComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/ArmorDisplayComponent.java index b00a4eae..a5592a1e 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/ArmorDisplayComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/ArmorDisplayComponent.java @@ -4,7 +4,6 @@ import net.minecraft.client.renderer.RenderHelper; import net.minecraft.item.ItemStack; import top.fpsmaster.features.impl.interfaces.ArmorDisplay; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.ui.custom.Component; import java.awt.*; @@ -22,7 +21,7 @@ public ArmorDisplayComponent() { @Override public void draw(float x, float y) { super.draw(x, y); - List armorInventory = Arrays.asList(Wrappers.minecraft().getArmorInventory()); + List armorInventory = Arrays.asList(mc.thePlayer.inventory.armorInventory); for (int i = 0; i < armorInventory.size(); i++) { ItemStack itemStack = armorInventory.get(i); @@ -57,7 +56,7 @@ public void draw(float x, float y) { GlStateManager.pushMatrix(); mc.getRenderItem().renderItemIntoGUI(itemStack, x1, y1); GlStateManager.popMatrix(); - mc.getRenderItem().renderItemOverlays(Wrappers.minecraft().getFontRenderer(), itemStack, x1, y1); + mc.getRenderItem().renderItemOverlays(mc.fontRendererObj, itemStack, x1, y1); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); diff --git a/shared/java/top/fpsmaster/ui/custom/impl/CPSDisplayComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/CPSDisplayComponent.java index ff63fdcc..c539f605 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/CPSDisplayComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/CPSDisplayComponent.java @@ -2,7 +2,7 @@ import top.fpsmaster.features.impl.interfaces.CPSDisplay; import top.fpsmaster.ui.custom.Component; -import top.fpsmaster.wrapper.TextFormattingProvider; +import net.minecraft.util.EnumChatFormatting; public class CPSDisplayComponent extends Component { @@ -16,10 +16,10 @@ public CPSDisplayComponent() { @Override public void draw(float x, float y) { super.draw(x, y); - String text = String.format("CPS: %d%s | %s%d", - CPSDisplay.lcps, - TextFormattingProvider.getGray(), - TextFormattingProvider.getReset(), + String text = String.format("CPS: %d%s | %s%d", + CPSDisplay.lcps, + EnumChatFormatting.GRAY, + EnumChatFormatting.RESET, CPSDisplay.rcps); width = getStringWidth(16, text) + 4; diff --git a/shared/java/top/fpsmaster/ui/custom/impl/CoordsDisplayComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/CoordsDisplayComponent.java index 1e0a1dae..87cba429 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/CoordsDisplayComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/CoordsDisplayComponent.java @@ -3,9 +3,10 @@ import org.jetbrains.annotations.NotNull; import top.fpsmaster.features.impl.interfaces.CoordsDisplay; import top.fpsmaster.features.impl.interfaces.FPSDisplay; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.ui.custom.Component; -import top.fpsmaster.wrapper.TextFormattingProvider; +import net.minecraft.util.EnumChatFormatting; + +import static top.fpsmaster.utils.Utility.mc; public class CoordsDisplayComponent extends Component { @@ -18,18 +19,18 @@ public CoordsDisplayComponent() { public void draw(float x, float y) { super.draw(x, y); String s = String.format("X:%d Y:%d Z:%d", - (int) Wrappers.minecraft().getPlayer().posX, - (int) Wrappers.minecraft().getPlayer().posY, - (int) Wrappers.minecraft().getPlayer().posZ); + (int) mc.thePlayer.posX, + (int) mc.thePlayer.posY, + (int) mc.thePlayer.posZ); if (((CoordsDisplay) mod).limitDisplay.getValue()) { String yStr = getString(); s = String.format("X:%d Y:%d(%s) Z:%d", - (int) Wrappers.minecraft().getPlayer().posX, - (int) Wrappers.minecraft().getPlayer().posY, + (int) mc.thePlayer.posX, + (int) mc.thePlayer.posY, yStr, - (int) Wrappers.minecraft().getPlayer().posZ); + (int) mc.thePlayer.posZ); } width = getStringWidth(18, s) + 4; @@ -40,16 +41,16 @@ public void draw(float x, float y) { } private @NotNull String getString() { - int restHeight = ((CoordsDisplay) mod).limitDisplayY.getValue().intValue() - (int) Wrappers.minecraft().getPlayer().posY; + int restHeight = ((CoordsDisplay) mod).limitDisplayY.getValue().intValue() - (int) mc.thePlayer.posY; String yStr; // color if (restHeight < 5) { - yStr = TextFormattingProvider.getRed() + String.valueOf(restHeight) + TextFormattingProvider.getReset(); + yStr = EnumChatFormatting.RED + String.valueOf(restHeight) + EnumChatFormatting.RESET; } else if (restHeight < 10) { - yStr = TextFormattingProvider.getYellow() + String.valueOf(restHeight) + TextFormattingProvider.getReset(); + yStr = EnumChatFormatting.YELLOW + String.valueOf(restHeight) + EnumChatFormatting.RESET; } else { - yStr = TextFormattingProvider.getGreen() + String.valueOf(restHeight) + TextFormattingProvider.getReset(); + yStr = EnumChatFormatting.GREEN + String.valueOf(restHeight) + EnumChatFormatting.RESET; } return yStr; } diff --git a/shared/java/top/fpsmaster/ui/custom/impl/InventoryDisplayComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/InventoryDisplayComponent.java index 3946ed26..be779b56 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/InventoryDisplayComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/InventoryDisplayComponent.java @@ -6,7 +6,6 @@ import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL11; import top.fpsmaster.features.impl.interfaces.InventoryDisplay; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.ui.custom.Component; import static top.fpsmaster.utils.Utility.mc; @@ -30,7 +29,7 @@ public void draw(float x, float y) { GL11.glTranslated(x, y, 0); if (scale != 1) GL11.glScaled(scale, scale, 0); - for (Slot slot : Wrappers.minecraft().getPlayer().inventoryContainer.inventorySlots) { + for (Slot slot : mc.thePlayer.inventoryContainer.inventorySlots) { count2++; if (count2 <= 9 || count2 > 36) { @@ -47,7 +46,7 @@ public void draw(float x, float y) { GlStateManager.disableBlend(); RenderHelper.enableGUIStandardItemLighting(); mc.getRenderItem().renderItemAndEffectIntoGUI(itemStack, x1, y1); - mc.getRenderItem().renderItemOverlays(Wrappers.minecraft().getFontRenderer(), itemStack, x1, y1); + mc.getRenderItem().renderItemOverlays(mc.fontRendererObj, itemStack, x1, y1); RenderHelper.disableStandardItemLighting(); GlStateManager.enableAlpha(); diff --git a/shared/java/top/fpsmaster/ui/custom/impl/ItemCountDisplayComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/ItemCountDisplayComponent.java index 61662854..b2823300 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/ItemCountDisplayComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/ItemCountDisplayComponent.java @@ -6,7 +6,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import top.fpsmaster.features.impl.interfaces.ItemCountDisplay; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.ui.custom.Component; import top.fpsmaster.utils.world.ItemsUtil; import top.fpsmaster.utils.world.PotionMetadata; @@ -43,7 +42,7 @@ public ItemCountDisplayComponent() { public void draw(float x, float y) { super.draw(x, y); ItemCountDisplay displayModule = ((ItemCountDisplay) mod); - ItemStack[] mainInventory = Wrappers.minecraft().getPlayer().inventory.mainInventory; + ItemStack[] mainInventory = mc.thePlayer.inventory.mainInventory; if(displayModule.modes.getValue() != 2) itemStacks = Arrays.stream(modeItems.get(displayModule.modes.getValue())).collect(Collectors.toList()); else itemStacks = displayModule.itemsSetting.getValue(); diff --git a/shared/java/top/fpsmaster/ui/custom/impl/LyricsComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/LyricsComponent.java deleted file mode 100644 index a15d4ef5..00000000 --- a/shared/java/top/fpsmaster/ui/custom/impl/LyricsComponent.java +++ /dev/null @@ -1,153 +0,0 @@ -package top.fpsmaster.ui.custom.impl; - -import net.minecraft.client.renderer.GlStateManager; -import org.lwjgl.opengl.GL11; -import top.fpsmaster.features.impl.interfaces.LyricsDisplay; -import top.fpsmaster.modules.music.*; -import top.fpsmaster.ui.click.music.NewMusicPanel; -import top.fpsmaster.ui.custom.Component; -import top.fpsmaster.ui.custom.Position; -import top.fpsmaster.utils.math.animation.Animation; -import top.fpsmaster.utils.math.animation.AnimationUtils; -import top.fpsmaster.utils.math.animation.Type; -import top.fpsmaster.utils.render.Render2DUtils; - -import java.awt.*; -import java.util.List; -import java.util.Objects; - -public class LyricsComponent extends Component { - - private long duration = 0; - public LyricsComponent() { - super(LyricsDisplay.class); - x = 0.5f; - y = 0.2f; - height = 70f; - position = Position.CT; - allowScale = true; - } - - private long fromTimeTick(String timeTick) { - String[] parts = timeTick.split(":"); - long minutes = Long.parseLong(parts[0]) * 60 * 1000; - String[] subParts = parts[1].split("\\."); - long seconds = Long.parseLong(subParts[0]) * 1000; - long milliseconds = Long.parseLong(subParts[1]); - return minutes + seconds + milliseconds; - } - - @Override - public void draw(float x, float y) { - super.draw(x, y); - drawRect(x, y, width, height, mod.backgroundColor.getColor()); - if (((LyricsDisplay) mod).scale.getValue()) { - y += 10; - }else{ - y += 5; - } - y += (scale - 1) * 23; - AbstractMusic current = NewMusicPanel.playing; - if (current != null && current.lyrics != null) { - int curLine = -1; - List lines = current.lyrics.lines; - for (int i = 0; i < lines.size(); i++) { - Line line = lines.get(i); - line.finished = false; - if (MusicPlayer.isPlaying && JLayerHelper.clip != null) { - duration = (long) (JLayerHelper.getDuration() * 60 * 1000 * JLayerHelper.getProgress()); - } - long time = line.time; - long nextTime = line.time + line.duration; - if (i < lines.size() - 1) { - nextTime = lines.get(i + 1).time; - } - if (line.type == 1) { - time = fromTimeTick(line.timeTick); - if (i < lines.size() - 1) { - nextTime = fromTimeTick(lines.get(i + 1).timeTick); - } - } - if ((duration >= time && duration < nextTime) || duration > time) { - curLine = i; - //get previous line and set finished - if(i != 0) lines.get(i - 1).finished = true; - } - } - - if (curLine != -1) { - for (int j = curLine - 3; j <= curLine + 2; j++) { - if (j >= 0 && j < lines.size()) { - Line line = lines.get(j); - String content = line.getContent(); - float stringWidth = getStringWidth(20, content); - float xOffset = x + (width - stringWidth) / 2 * scale ; - width = 200f; - - if (this.width < stringWidth + 10 ) { - this.width = stringWidth + 10 ; - } - if (j == curLine) { - line.animation = (float) AnimationUtils.base(line.animation, 0.0, 0.05f); - line.alpha = (float) AnimationUtils.base(line.alpha, 1.0, 0.05f); - } else { - line.animation = (float) AnimationUtils.base(line.animation, j - curLine, 0.05f); - line.alpha = (float) (Math.abs(j - curLine) == 1 ? - AnimationUtils.base(line.alpha, 1.0, 0.05f) : - AnimationUtils.base(line.alpha, 0.0, 0.05f)); - } - if (Math.abs(j - curLine) <= 1) { - drawLine(line, xOffset, y + line.animation * (20 * scale)+ 20, 20,j == curLine); - } - } - } - } - } - } - - private void drawLine(Line line, float xOffset, float y, int font, boolean current) { - LyricsDisplay lyrics = (LyricsDisplay) mod; - //lyric line has been play finished or is playing - if (lyrics.scale.getValue()) { - //default scale ratio - float scaleRatio = 1.0f; - if(current) { - line.scaleAnimation.start(1.0,1.3,0.3f,Type.LINEAR); - }else{ - line.scaleAnimation.start(line.scaleAnimation.value,1.0,0.3f,Type.LINEAR); - } - line.scaleAnimation.update(); - scaleRatio = (float) line.scaleAnimation.value; - - Render2DUtils.scaleStart(xOffset + (getStringWidth((int) (20 * scale), line.getContent()) / 2.0f), y + (getStringHeight(20) / 2.0f), scaleRatio); - GL11.glTranslated(0, -8, 0); - } - for (Word word : line.words) { - xOffset += current ? drawWord(word, xOffset, y, line) : drawWordBG(word, xOffset, y, line); - } - if (lyrics.scale.getValue()) { - GL11.glTranslated(0, 8, 0); - Render2DUtils.scaleEnd(); - } - } - - - private float drawWord(Word word, float xOffset, float y, Line line) { - if (duration >= word.time) { - float animation = 0.3f + (float) (duration - word.time) / word.duration; - float animation2 = (float) (duration - word.time) / word.duration; - drawString(20, word.content, xOffset, y + 7 - Math.min(animation2, 1f), - Render2DUtils.reAlpha(LyricsDisplay.textColor.getColor(), (int) Math.min(animation * 255, 255)).getRGB()); - }else { - drawString(20, word.content, xOffset, y + 7, - Render2DUtils.reAlpha(LyricsDisplay.textColor.getColor(), (int) Math.min(line.alpha * 120, 255)).getRGB()); - } - return getStringWidth(20, word.content) * scale; - } - - private float drawWordBG(Word word, float xOffset, float y, Line line) { - drawString(20, word.content, xOffset, y + 5, - Render2DUtils.reAlpha(LyricsDisplay.textBG.getColor(), (int) Math.min(line.alpha * 120, 255)).getRGB()); - return getStringWidth(20, word.content) * scale; - } -} diff --git a/shared/java/top/fpsmaster/ui/custom/impl/MiniMapComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/MiniMapComponent.java index 874d085a..b1fca5a5 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/MiniMapComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/MiniMapComponent.java @@ -4,7 +4,7 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import top.fpsmaster.features.impl.interfaces.MiniMap; -import top.fpsmaster.api.Wrappers; +import top.fpsmaster.forge.api.IMinecraft; import top.fpsmaster.ui.custom.Component; import top.fpsmaster.ui.minimap.XaeroMinimap; import top.fpsmaster.ui.minimap.animation.MinimapAnimation; @@ -49,7 +49,8 @@ public void draw(float x, float y) { } GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); Minecraft.getMinecraft().entityRenderer.setupOverlayRendering(); - InterfaceHandler.drawInterfaces(width, height, Wrappers.timer().getRenderPartialTicks()); + float partialTicks = ((IMinecraft) Minecraft.getMinecraft()).arch$getTimer().renderPartialTicks; + InterfaceHandler.drawInterfaces(width, height, partialTicks); MinimapAnimation.tick(); GL11.glPopMatrix(); Render2DUtils.fixScale(); diff --git a/shared/java/top/fpsmaster/ui/custom/impl/ModsListComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/ModsListComponent.java index 508d00b4..5e0da75f 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/ModsListComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/ModsListComponent.java @@ -5,7 +5,7 @@ import top.fpsmaster.features.manager.Category; import top.fpsmaster.features.manager.Module; import top.fpsmaster.font.impl.UFontRenderer; -import top.fpsmaster.api.Wrappers; +import net.minecraft.client.Minecraft; import top.fpsmaster.ui.custom.Component; import top.fpsmaster.utils.render.Render2DUtils; @@ -41,22 +41,22 @@ public void draw(float x, float y) { float maxWidth = 40f; x += this.width; - if (Wrappers.minecraft().getPlayer().ticksExisted % 20 == 0) + if (Minecraft.getMinecraft().thePlayer.ticksExisted % 20 == 0) modules = FPSMaster.moduleManager.modules.stream() .sorted((m1, m2) -> { float w1 = (mod).betterFont.getValue() ? font.getStringWidth(modlist.english.getValue() ? m1.name : FPSMaster.i18n.get(m1.name.toLowerCase())) - : Wrappers.minecraft().getFontRenderer().getStringWidth(modlist.english.getValue() ? m1.name : FPSMaster.i18n.get(m1.name.toLowerCase())); + : Minecraft.getMinecraft().fontRendererObj.getStringWidth(modlist.english.getValue() ? m1.name : FPSMaster.i18n.get(m1.name.toLowerCase())); float w2 = (mod.betterFont.getValue() ? font.getStringWidth(modlist.english.getValue() ? m2.name : FPSMaster.i18n.get(m2.name.toLowerCase())) - : Wrappers.minecraft().getFontRenderer().getStringWidth(modlist.english.getValue() ? m2.name : FPSMaster.i18n.get(m2.name.toLowerCase()))); + : Minecraft.getMinecraft().fontRendererObj.getStringWidth(modlist.english.getValue() ? m2.name : FPSMaster.i18n.get(m2.name.toLowerCase()))); return Float.compare(w2, w1); }).collect(Collectors.toList()); int index = 0; for (Module module : modules) { Color textColor = Color.getHSBColor( - index / (float) modules.size() - Wrappers.minecraft().getPlayer().ticksExisted % 50 / 50f, + index / (float) modules.size() - Minecraft.getMinecraft().thePlayer.ticksExisted % 50 / 50f, 0.7f, 1f ); @@ -71,7 +71,7 @@ public void draw(float x, float y) { float textWidth = mod.betterFont.getValue() ? font.getStringWidth(name) - : Wrappers.minecraft().getFontRenderer().getStringWidth(name); + : Minecraft.getMinecraft().fontRendererObj.getStringWidth(name); if (maxWidth < textWidth) { maxWidth = textWidth + 5; @@ -89,10 +89,10 @@ public void draw(float x, float y) { yOffset = (int) ((MODULE_HEIGHT - font.getHeight()) / 2); font.drawStringWithShadow(name, x - textWidth - 2, y + modY + yOffset, color.getRGB()); } else { - // Problem: yOffset = (BG_HEIGHT - Wrappers.minecraft().getFontRenderer().FONT_HEIGHT) / 2; + // Problem: yOffset = (BG_HEIGHT - mc.fontRendererObj.FONT_HEIGHT) / 2; // this is the only way to center the text y position - yOffset = Wrappers.minecraft().getFontRenderer().FONT_HEIGHT / 2; - Wrappers.minecraft().getFontRenderer().drawStringWithShadow(name, x - textWidth - 2, y + modY + yOffset, color.getRGB()); + yOffset = Minecraft.getMinecraft().fontRendererObj.FONT_HEIGHT / 2; + Minecraft.getMinecraft().fontRendererObj.drawStringWithShadow(name, x - textWidth - 2, y + modY + yOffset, color.getRGB()); } index++; modY += MODULE_HEIGHT + modlist.spacing.getValue().intValue(); diff --git a/shared/java/top/fpsmaster/ui/custom/impl/MusicComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/MusicComponent.java deleted file mode 100644 index 28415fd3..00000000 --- a/shared/java/top/fpsmaster/ui/custom/impl/MusicComponent.java +++ /dev/null @@ -1,65 +0,0 @@ -package top.fpsmaster.ui.custom.impl; - -import net.minecraft.util.ResourceLocation; -import top.fpsmaster.features.impl.interfaces.MusicOverlay; -import top.fpsmaster.modules.music.AbstractMusic; -import top.fpsmaster.modules.music.MusicPlayer; -import top.fpsmaster.modules.music.netease.Music; -import top.fpsmaster.ui.click.music.NewMusicPanel; -import top.fpsmaster.ui.custom.Component; -import top.fpsmaster.ui.custom.Position; -import top.fpsmaster.utils.math.animation.AnimationUtils; -import top.fpsmaster.utils.render.Render2DUtils; - -import java.awt.*; - -public class MusicComponent extends Component { - - private static float songProgress = 0f; - - public MusicComponent() { - super(MusicOverlay.class); - x = 0.01f; - y = 0.01f; - position = Position.RT; - } - - private void drawSong(float x, float y, float width, float height) { - Music current = NewMusicPanel.playing; - if (current == null) { - return; - } - drawRect(x, y, width, height, mod.backgroundColor.getColor()); - drawRect(x, y, songProgress, height, MusicOverlay.progressColor.getColor()); - songProgress = (float) AnimationUtils.base(songProgress, (6 + (width - 6) * MusicPlayer.getPlayProgress()), 0.1); - - if (current.isLoadedImage) { - Render2DUtils.drawImage( - new ResourceLocation("music/netease/" + current.id), - x + 5, - y + 5, - height - 10, - height - 10, - -1 - ); - } - - drawString(18, current.name, x + 40, y + 6, new Color(234, 234, 234).getRGB()); - drawString(16, current.author, x + 40, y + 18, new Color(162, 162, 162).getRGB()); - } - - @Override - public void draw(float x, float y) { - super.draw(x, y); - - Music current = NewMusicPanel.playing; - if (current != null) { - float width = Math.max( - getStringWidth(18, current.name), getStringWidth(18, current.author) - ); - drawSong(x, y, width + 60, 40f); - this.width = width + 60; - height = 40f; - } - } -} diff --git a/shared/java/top/fpsmaster/ui/custom/impl/PingDisplayComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/PingDisplayComponent.java index 0f2ccabc..829093d4 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/PingDisplayComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/PingDisplayComponent.java @@ -1,7 +1,8 @@ package top.fpsmaster.ui.custom.impl; import top.fpsmaster.features.impl.interfaces.PingDisplay; -import top.fpsmaster.api.Wrappers; +import net.minecraft.client.Minecraft; +import net.minecraft.client.network.NetworkPlayerInfo; import top.fpsmaster.ui.custom.Component; public class PingDisplayComponent extends Component { @@ -16,11 +17,13 @@ public void draw(float x, float y) { super.draw(x, y); // Get ping of connection - if (Wrappers.minecraft().getPlayer() == null) { + Minecraft mc = Minecraft.getMinecraft(); + if (mc.thePlayer == null || mc.getNetHandler() == null) { return; } - String ping = Wrappers.minecraft().getRespondTime() + "ms"; + NetworkPlayerInfo info = mc.getNetHandler().getPlayerInfo(mc.thePlayer.getUniqueID()); + String ping = (info != null ? info.getResponseTime() : 0) + "ms"; String text = "Ping: " + ping; width = getStringWidth(16, text) + 4; diff --git a/shared/java/top/fpsmaster/ui/custom/impl/PlayerDisplayComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/PlayerDisplayComponent.java index 4841a479..edddc2d7 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/PlayerDisplayComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/PlayerDisplayComponent.java @@ -5,12 +5,13 @@ import top.fpsmaster.FPSMaster; import top.fpsmaster.features.impl.interfaces.PlayerDisplay; import top.fpsmaster.font.impl.UFontRenderer; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.ui.custom.Component; import top.fpsmaster.utils.render.Render2DUtils; import java.awt.*; +import static top.fpsmaster.utils.Utility.mc; + public class PlayerDisplayComponent extends Component { public PlayerDisplayComponent() { @@ -23,9 +24,9 @@ public void draw(float x, float y) { width = 40f; int i = 0; - for (Entity entity : Wrappers.world().getWorld().loadedEntityList) { + for (Entity entity : mc.theWorld.loadedEntityList) { if (entity instanceof EntityPlayer && !entity.isInvisible()) { - if (i > 10 || entity == Wrappers.minecraft().getPlayer()) continue; + if (i > 10 || entity == mc.thePlayer) continue; UFontRenderer s16 = FPSMaster.fontManager.s16; String healthText = (int) (((EntityPlayer) entity).getHealth() * 10 / 10) + " hp"; float hX = s16.getStringWidth(healthText); diff --git a/shared/java/top/fpsmaster/ui/custom/impl/PotionDisplayComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/PotionDisplayComponent.java index 29b0ead7..a4ecf9f1 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/PotionDisplayComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/PotionDisplayComponent.java @@ -8,12 +8,13 @@ import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import top.fpsmaster.features.impl.interfaces.PotionDisplay; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.ui.custom.Component; import top.fpsmaster.utils.Utility; import java.awt.*; +import static top.fpsmaster.utils.Utility.mc; + public class PotionDisplayComponent extends Component { public PotionDisplayComponent() { @@ -29,7 +30,7 @@ public void draw(float x, float y) { float dY = y - mod.spacing.getValue().intValue(); GlStateManager.pushMatrix(); int index = 0; - for (PotionEffect effect : Wrappers.minecraft().getPlayer().getActivePotionEffects()) { + for (PotionEffect effect : mc.thePlayer.getActivePotionEffects()) { String title = I18n.format(effect.getEffectName()) + " lv." + (effect.getAmplifier() + 1); String duration = (effect.getDuration() / 20 / 60) + "min" + effect.getDuration() / 20 % 60 + "s"; float width = Math.max(getStringWidth(18, title), getStringWidth(16, duration)) + 36; diff --git a/shared/java/top/fpsmaster/ui/custom/impl/ScoreboardComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/ScoreboardComponent.java index 1bf31c2b..7b2e9089 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/ScoreboardComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/ScoreboardComponent.java @@ -2,7 +2,15 @@ import top.fpsmaster.features.impl.interfaces.Scoreboard; import top.fpsmaster.ui.custom.Component; -import top.fpsmaster.wrapper.mods.WrapperScoreboard; +import net.minecraft.client.Minecraft; +import net.minecraft.scoreboard.Score; +import net.minecraft.scoreboard.ScoreObjective; +import net.minecraft.scoreboard.ScorePlayerTeam; +import top.fpsmaster.utils.render.Render2DUtils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; public class ScoreboardComponent extends Component { @@ -14,8 +22,50 @@ public ScoreboardComponent() { @Override public void draw(float x, float y) { super.draw(x, y); - float[] render = WrapperScoreboard.render(this, mod, x, y); - width = render[0]; - height = render[1]; + Minecraft mc = Minecraft.getMinecraft(); + if (mc.theWorld == null) { + width = 0; + height = 0; + return; + } + net.minecraft.scoreboard.Scoreboard mcScoreboard = mc.theWorld.getScoreboard(); + ScoreObjective objective = mcScoreboard.getObjectiveInDisplaySlot(1); + if (objective == null) { + width = 0; + height = 0; + return; + } + + Collection scores = mcScoreboard.getSortedScores(objective); + List filtered = new ArrayList<>(); + for (Score score : scores) { + if (score.getPlayerName() != null && !score.getPlayerName().startsWith("#")) { + filtered.add(score); + } + } + if (filtered.size() > 15) { + filtered = filtered.subList(filtered.size() - 15, filtered.size()); + } + + int maxWidth = mc.fontRendererObj.getStringWidth(objective.getDisplayName()); + boolean showScore = Scoreboard.score.getValue(); + List lines = new ArrayList<>(); + for (Score score : filtered) { + String name = ScorePlayerTeam.formatPlayerName(mcScoreboard.getPlayersTeam(score.getPlayerName()), score.getPlayerName()); + String line = showScore ? name + ": " + score.getScorePoints() : name; + lines.add(line); + maxWidth = Math.max(maxWidth, mc.fontRendererObj.getStringWidth(line)); + } + + int lineHeight = mc.fontRendererObj.FONT_HEIGHT + 1; + width = maxWidth + 6; + height = (lines.size() + 1) * lineHeight + 4; + Render2DUtils.drawRect(x, y, width, height, mod.backgroundColor.getColor()); + mc.fontRendererObj.drawStringWithShadow(objective.getDisplayName(), x + 3, y + 2, 0xFFFFFF); + float offsetY = y + 2 + lineHeight; + for (String line : lines) { + mc.fontRendererObj.drawStringWithShadow(line, x + 3, offsetY, 0xFFFFFF); + offsetY += lineHeight; + } } } diff --git a/shared/java/top/fpsmaster/ui/custom/impl/SprintComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/SprintComponent.java index 601cb60e..31b12410 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/SprintComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/SprintComponent.java @@ -1,6 +1,5 @@ package top.fpsmaster.ui.custom.impl; -import top.fpsmaster.api.provider.ProviderRegistry; import top.fpsmaster.features.impl.utility.Sprint; import top.fpsmaster.ui.custom.Component; diff --git a/shared/java/top/fpsmaster/ui/custom/impl/TargetHUDComponent.java b/shared/java/top/fpsmaster/ui/custom/impl/TargetHUDComponent.java index fbeb5f3c..bc2a610a 100644 --- a/shared/java/top/fpsmaster/ui/custom/impl/TargetHUDComponent.java +++ b/shared/java/top/fpsmaster/ui/custom/impl/TargetHUDComponent.java @@ -3,7 +3,6 @@ import net.minecraft.entity.player.EntityPlayer; import top.fpsmaster.FPSMaster; import top.fpsmaster.features.impl.interfaces.TargetDisplay; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.ui.custom.Component; import top.fpsmaster.utils.Utility; import top.fpsmaster.utils.math.animation.AnimationUtils; @@ -30,7 +29,7 @@ public void draw(float x, float y) { // Get the target or player if chat is open EntityPlayer target1 = TargetDisplay.target; if (Utility.mc.ingameGUI.getChatGUI().getChatOpen()) { - target1 = Wrappers.minecraft().getPlayer(); + target1 = Utility.mc.thePlayer; } if (target1 == null) return; // Set width and height @@ -39,7 +38,7 @@ public void draw(float x, float y) { name = name.substring(0, 20) + ".."; } - animation = (TargetDisplay.target.isDead || (System.currentTimeMillis() - TargetDisplay.lastHit > 5000 && target1 != Wrappers.minecraft().getPlayer())) + animation = (TargetDisplay.target.isDead || (System.currentTimeMillis() - TargetDisplay.lastHit > 5000 && target1 != Utility.mc.thePlayer)) ? (float) AnimationUtils.base(animation, 0.0, 0.1) : (float) AnimationUtils.base(animation, 1, 0.1); diff --git a/shared/java/top/fpsmaster/ui/mc/GuiMultiplayer.java b/shared/java/top/fpsmaster/ui/mc/GuiMultiplayer.java index 9865b740..4d65f5b8 100644 --- a/shared/java/top/fpsmaster/ui/mc/GuiMultiplayer.java +++ b/shared/java/top/fpsmaster/ui/mc/GuiMultiplayer.java @@ -1,9 +1,6 @@ package top.fpsmaster.ui.mc; import com.google.common.collect.Lists; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonObject; import net.minecraft.client.gui.GuiScreenAddServer; import net.minecraft.client.gui.GuiScreenServerList; import net.minecraft.client.gui.GuiYesNo; @@ -19,18 +16,15 @@ import org.lwjgl.opengl.GL11; import top.fpsmaster.FPSMaster; import top.fpsmaster.font.impl.UFontRenderer; -import top.fpsmaster.modules.client.thread.ClientThreadPool; import top.fpsmaster.ui.click.component.ScrollContainer; import top.fpsmaster.ui.common.GuiButton; import top.fpsmaster.ui.screens.mainmenu.MainMenu; import top.fpsmaster.utils.math.MathTimer; -import top.fpsmaster.utils.os.HttpRequest; import top.fpsmaster.utils.render.Render2DUtils; import top.fpsmaster.utils.render.ScaledGuiScreen; import java.awt.*; import java.io.File; -import java.io.IOException; import java.util.List; public class GuiMultiplayer extends ScaledGuiScreen { @@ -40,11 +34,8 @@ public class GuiMultiplayer extends ScaledGuiScreen { private final List servers = Lists.newArrayList(); private final List serverListDisplay = Lists.newArrayList(); private final List serverListInternet = Lists.newArrayList(); - private static final List serverListRecommended = Lists.newArrayList(); public final OldServerPinger oldServerPinger = new OldServerPinger(); - private final Gson gson = new GsonBuilder().setPrettyPrinting().create(); - String action = ""; MathTimer timer = new MathTimer(); @@ -89,7 +80,6 @@ public class GuiMultiplayer extends ScaledGuiScreen { @Override public void initGui() { super.initGui(); - tab = 0; loadServerList(); serverListInternet.clear(); for (ServerData server : servers) { @@ -97,18 +87,6 @@ public void initGui() { } serverListDisplay.clear(); serverListDisplay.addAll(serverListInternet); - if (serverListRecommended.isEmpty()) { - FPSMaster.async.runnable(() -> { - String s; - try { - s = HttpRequest.get("https://service.fpsmaster.top/api/client/servers").getBody(); - } catch (IOException e) { - throw new RuntimeException(e); - } - JsonObject jsonObject = gson.fromJson(s, JsonObject.class); - jsonObject.get("data").getAsJsonArray().forEach(e -> serverListRecommended.add(new ServerListEntry(this, new ServerData(e.getAsJsonObject().get("name").getAsString() + " - " + e.getAsJsonObject().get("description").getAsString(), e.getAsJsonObject().get("address").getAsString(), false)))); - }); - } } @Override @@ -157,9 +135,6 @@ public void saveServerList() { } ScrollContainer scrollContainer = new ScrollContainer(); - int tab = 0; - - @Override public void render(int mouseX, int mouseY, float partialTicks) { super.render(mouseX, mouseY, partialTicks); @@ -170,9 +145,8 @@ public void render(int mouseX, int mouseY, float partialTicks) { title.drawCenteredString("多人游戏", guiWidth / 2f, 16, -1); Render2DUtils.drawOptimizedRoundedRect((guiWidth - 180) / 2f, 30, 180, 24, 3, new Color(0, 0, 0, 80).getRGB()); - Render2DUtils.drawOptimizedRoundedRect((guiWidth - 176) / 2f + 90 * tab, 32, 86, 20, 3, -1); - FPSMaster.fontManager.s16.drawCenteredString("服务器列表", (guiWidth - 90) / 2f, 36, tab == 0 ? new Color(50, 50, 50).getRGB() : -1); - FPSMaster.fontManager.s16.drawCenteredString("推荐服务器", (guiWidth + 90) / 2f, 36, tab == 1 ? new Color(50, 50, 50).getRGB() : -1); + Render2DUtils.drawOptimizedRoundedRect((guiWidth - 176) / 2f, 32, 176, 20, 3, -1); + FPSMaster.fontManager.s16.drawCenteredString("服务器列表", guiWidth / 2f, 36, new Color(50, 50, 50).getRGB()); GL11.glPushMatrix(); GL11.glEnable(GL11.GL_SCISSOR_TEST); @@ -238,21 +212,6 @@ public void onClick(int mouseX, int mouseY, int mouseButton) { back.mouseClick(mouseX, mouseY, mouseButton); - Render2DUtils.drawOptimizedRoundedRect((guiWidth - 180) / 2f, 30, 180, 24, 3, new Color(255, 255, 255, 80).getRGB()); - Render2DUtils.drawOptimizedRoundedRect((guiWidth - 176) / 2f, 32, 86, 20, 3, new Color(113, 127, 254).getRGB()); - FPSMaster.fontManager.s16.drawCenteredString("服务器列表", (guiWidth - 90) / 2f, 36, -1); - FPSMaster.fontManager.s16.drawCenteredString("推荐服务器", (guiWidth + 90) / 2f, 36, -1); - - if (Render2DUtils.isHovered((guiWidth - 180) / 2f, 30, 90, 24, mouseX, mouseY)) { - tab = 0; - serverListDisplay.clear(); - serverListDisplay.addAll(serverListInternet); - } else if (Render2DUtils.isHovered((guiWidth) / 2f, 30, 90, 24, mouseX, mouseY)) { - tab = 1; - serverListDisplay.clear(); - serverListDisplay.addAll(serverListRecommended); - } - float y = 70 + scrollContainer.getScroll(); for (ServerListEntry server : serverListDisplay) { @@ -296,4 +255,4 @@ public void loadServerList() { } } -} \ No newline at end of file +} diff --git a/shared/java/top/fpsmaster/ui/screens/account/GuiWaiting.java b/shared/java/top/fpsmaster/ui/screens/account/GuiWaiting.java deleted file mode 100644 index fee60173..00000000 --- a/shared/java/top/fpsmaster/ui/screens/account/GuiWaiting.java +++ /dev/null @@ -1,69 +0,0 @@ -package top.fpsmaster.ui.screens.account; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiMainMenu; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.utils.render.Render2DUtils; -import top.fpsmaster.utils.thirdparty.microsoft.MicrosoftLogin; - -import java.awt.*; -import java.io.IOException; - -public class GuiWaiting extends GuiScreen { - public static boolean loggedIn = false; - - Thread loginThread = new Thread(MicrosoftLogin::loginViaBrowser); - - @Override - public void initGui() { - super.initGui(); - if (!loginThread.isAlive()){ - loginThread.start(); - } - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawScreen(mouseX, mouseY, partialTicks); - - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - - // Draw background - Render2DUtils.drawRect( - 0f, 0f, - sr.getScaledWidth(), sr.getScaledHeight(), - new Color(255, 255, 255) - ); - - // Draw text - FPSMaster.fontManager.s24.drawCenteredString( - MicrosoftLogin.loginProgressMessage, - sr.getScaledWidth() / 2f, - sr.getScaledHeight() / 2f - 30, - new Color(162, 162, 162).getRGB() - ); - - FPSMaster.fontManager.s40.drawCenteredString( - FPSMaster.i18n.get("microsoft.login.title"), - sr.getScaledWidth() / 2f, - sr.getScaledHeight() / 2f + 10, - new Color(113, 127, 254).getRGB() - ); - - // Check if logged in and switch to the main menu - if (loggedIn) { - loggedIn = false; - Minecraft.getMinecraft().displayGuiScreen(new GuiMainMenu()); - } - } - - @Override - public void keyTyped(char typedChar, int keyCode) throws IOException { - super.keyTyped(typedChar, keyCode); - if (keyCode == 1) { // Escape key - Minecraft.getMinecraft().displayGuiScreen(new GuiMainMenu()); - } - } -} diff --git a/shared/java/top/fpsmaster/ui/screens/mainmenu/MainMenu.java b/shared/java/top/fpsmaster/ui/screens/mainmenu/MainMenu.java index 728ba5f8..108ed102 100644 --- a/shared/java/top/fpsmaster/ui/screens/mainmenu/MainMenu.java +++ b/shared/java/top/fpsmaster/ui/screens/mainmenu/MainMenu.java @@ -2,21 +2,17 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiOptions; +import net.minecraft.client.gui.GuiSelectWorld; import net.minecraft.util.ResourceLocation; -import org.lwjgl.input.Mouse; import top.fpsmaster.FPSMaster; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.ui.mc.GuiMultiplayer; -import top.fpsmaster.ui.screens.account.GuiWaiting; -import top.fpsmaster.ui.screens.oobe.GuiLogin; import top.fpsmaster.utils.math.animation.Animation; import top.fpsmaster.utils.math.animation.Type; import top.fpsmaster.utils.render.Render2DUtils; import top.fpsmaster.utils.render.ScaledGuiScreen; -import top.fpsmaster.wrapper.TextFormattingProvider; +import net.minecraft.util.EnumChatFormatting; import java.awt.*; -import java.net.URI; public class MainMenu extends ScaledGuiScreen { private static int firstBoot = 0; @@ -27,15 +23,14 @@ public class MainMenu extends ScaledGuiScreen { private final MenuButton options; private final MenuButton exit; - private String info = "Failed to get version update"; - private boolean needUpdate = false; + private String info = "离线模式"; private static final Animation startAnimation = new Animation(); private static final Animation backgroundAnimation = new Animation(); public MainMenu() { - singlePlayer = new MenuButton("mainmenu.single", () -> Wrappers.mainMenu().showSinglePlayer(this)); + singlePlayer = new MenuButton("mainmenu.single", () -> mc.displayGuiScreen(new GuiSelectWorld(this))); multiPlayer = new MenuButton("mainmenu.multi", () -> mc.displayGuiScreen(new GuiMultiplayer())); options = new MenuButton("mainmenu.settings", () -> mc.displayGuiScreen(new GuiOptions(this, mc.gameSettings))); exit = new MenuButton("X", () -> mc.shutdown()); @@ -43,7 +38,7 @@ public MainMenu() { @Override public void initGui() { - Wrappers.mainMenu().initGui(); + super.initGui(); if (firstBoot == 0) { // Check Java Version String version = System.getProperty("java.version"); @@ -82,14 +77,7 @@ public void render(int mouseX, int mouseY, float partialTicks) { // Display user info and avatar float stringWidth = FPSMaster.fontManager.s16.getStringWidth(mc.getSession().getUsername()); - if (Render2DUtils.isHovered(10f, 10f, 80f, 20f, mouseX, mouseY)) { - Render2DUtils.drawOptimizedRoundedRect(10f, 10f, 30 + stringWidth, 20f, new Color(0, 0, 0, 100)); - if (Mouse.isButtonDown(0)) { - Minecraft.getMinecraft().displayGuiScreen(new GuiWaiting()); - } - } else { - Render2DUtils.drawOptimizedRoundedRect(10f, 10f, 30 + stringWidth, 20f, new Color(0, 0, 0, 60)); - } + Render2DUtils.drawOptimizedRoundedRect(10f, 10f, 30 + stringWidth, 20f, new Color(0, 0, 0, 60)); Render2DUtils.drawImage(new ResourceLocation("client/gui/screen/avatar.png"), 14f, 15f, 10f, 10f, -1); FPSMaster.fontManager.s16.drawString(mc.getSession().getUsername(), 28, 16, Color.WHITE.getRGB()); @@ -112,20 +100,9 @@ public void render(int mouseX, int mouseY, float partialTicks) { FPSMaster.fontManager.s16.drawString("Copyright Mojang AB. Do not distribute!", guiWidth - w - 4, guiHeight - 14, Color.WHITE.getRGB()); // Display welcome message - String welcome = FPSMaster.INSTANCE.loggedIn ? TextFormattingProvider.getGreen() + String.format(FPSMaster.i18n.get("mainmenu.welcome"), FPSMaster.accountManager.getUsername()) : TextFormattingProvider.getRed().toString() + TextFormattingProvider.getBold().toString() + FPSMaster.i18n.get("mainmenu.notlogin"); + String welcome = EnumChatFormatting.GREEN + FPSMaster.i18n.get("mainmenu.single"); FPSMaster.fontManager.s16.drawString(welcome, 4, guiHeight - 52, Color.WHITE.getRGB()); - // Version info - if (FPSMaster.updateFailed) { - info = TextFormattingProvider.getGreen() + FPSMaster.i18n.get("mainmenu.failed"); - } else { - if (FPSMaster.isLatest) { - info = TextFormattingProvider.getGreen() + FPSMaster.i18n.get("mainmenu.latest"); - } else { - info = TextFormattingProvider.getRed().toString() + TextFormattingProvider.getBold().toString() + FPSMaster.i18n.get("mainmenu.notlatest"); - needUpdate = true; - } - } FPSMaster.fontManager.s16.drawString(info, 4, guiHeight - 40, Color.WHITE.getRGB()); // Render client info @@ -147,9 +124,6 @@ public void onClick(int mouseX, int mouseY, int mouseButton) { options.mouseClick(mouseX, mouseY, mouseButton); exit.mouseClick(mouseX, mouseY, mouseButton); - float uw = FPSMaster.fontManager.s16.getStringWidth(info); - float nw = FPSMaster.fontManager.s16.getStringWidth(info); - if (mouseButton == 0) { if (Render2DUtils.isHovered(guiWidth - 22, 13, 12, 12, mouseX, mouseY)) { if (FPSMaster.configManager.configure.getOrCreate("background", "new").equals("classic")) { @@ -158,18 +132,6 @@ public void onClick(int mouseX, int mouseY, int mouseButton) { FPSMaster.configManager.configure.set("background", "classic"); } } - - if (Render2DUtils.isHovered(4f, guiHeight - 52, nw, 14f, mouseX, mouseY)) { - Minecraft.getMinecraft().displayGuiScreen(new GuiLogin()); - } - - if (Render2DUtils.isHovered(4f, guiHeight - 40, uw, 14f, mouseX, mouseY) && needUpdate) { - try { - Desktop.getDesktop().browse(new URI("https://fpsmaster.top")); - } catch (Exception e) { - e.printStackTrace(); - } - } } } } diff --git a/shared/java/top/fpsmaster/ui/screens/oobe/GuiLogin.java b/shared/java/top/fpsmaster/ui/screens/oobe/GuiLogin.java deleted file mode 100644 index b34710e5..00000000 --- a/shared/java/top/fpsmaster/ui/screens/oobe/GuiLogin.java +++ /dev/null @@ -1,29 +0,0 @@ -package top.fpsmaster.ui.screens.oobe; - -import net.minecraft.client.gui.GuiScreen; -import top.fpsmaster.ui.screens.oobe.impls.Login; - -import java.io.IOException; - -public class GuiLogin extends GuiScreen { - - private static final Login login = new Login(false); - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawScreen(mouseX, mouseY, partialTicks); - login.drawScreen(mouseX, mouseY, partialTicks); - } - - @Override - public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - super.mouseClicked(mouseX, mouseY, mouseButton); - login.mouseClick(mouseX, mouseY, mouseButton); - } - - @Override - public void keyTyped(char typedChar, int keyCode) throws IOException { - super.keyTyped(typedChar, keyCode); - login.keyTyped(typedChar, keyCode); - } -} diff --git a/shared/java/top/fpsmaster/ui/screens/oobe/OOBEScreen.java b/shared/java/top/fpsmaster/ui/screens/oobe/OOBEScreen.java deleted file mode 100644 index 8e8a7eac..00000000 --- a/shared/java/top/fpsmaster/ui/screens/oobe/OOBEScreen.java +++ /dev/null @@ -1,83 +0,0 @@ -package top.fpsmaster.ui.screens.oobe; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import org.lwjgl.opengl.GL11; -import top.fpsmaster.ui.screens.oobe.impls.Login; -import top.fpsmaster.utils.math.animation.Animation; -import top.fpsmaster.utils.math.animation.Type; -import top.fpsmaster.utils.render.Render2DUtils; - -import java.awt.*; -import java.io.IOException; -import java.util.ArrayList; - -public class OOBEScreen extends GuiScreen { - - private static final ArrayList scenes = new ArrayList<>(); - private static Scene currentScene = null; - private static int currentSceneIndex = 0; - public static Animation switchAnimation = new Animation(); - - @Override - public void initGui() { - super.initGui(); - if (scenes.isEmpty()) { - scenes.add(new Login(true)); - currentScene = scenes.get(0); - switchAnimation.start(0.0, 100.0, 0.3f, Type.EASE_IN_OUT_QUAD); - } - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawScreen(mouseX, mouseY, partialTicks); - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - switchAnimation.update(); - - if (switchAnimation.value < 99.9 && currentSceneIndex > 0) { - Scene previousScene = scenes.get(currentSceneIndex - 1); - previousScene.drawScreen(mouseX, mouseY, partialTicks); - - Render2DUtils.drawRect( - 0f, 0f, sr.getScaledWidth(), sr.getScaledHeight(), - new Color(0, 0, 0, Render2DUtils.limit(2 * switchAnimation.value)) - ); - - GL11.glTranslatef((float) (sr.getScaledWidth() * (1 - switchAnimation.value / 100f)), 0f, 0f); - currentScene.drawScreen(mouseX, mouseY, partialTicks); - GL11.glTranslatef((float) (-sr.getScaledWidth() * (1 - switchAnimation.value / 100f)), 0f, 0f); - } else { - currentScene.drawScreen(mouseX, mouseY, partialTicks); - } - } - - @Override - public void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - super.mouseClicked(mouseX, mouseY, mouseButton); - if (switchAnimation.value > 99.9) { - currentScene.mouseClick(mouseX, mouseY, mouseButton); - } - } - - @Override - public void keyTyped(char typedChar, int keyCode) throws IOException { - if (switchAnimation.value > 99.9) { - currentScene.keyTyped(typedChar, keyCode); - } - super.keyTyped(typedChar, keyCode); - } - - public void nextScene() { - if (currentSceneIndex < scenes.size() - 1) { - currentSceneIndex++; - currentScene = scenes.get(currentSceneIndex); - switchAnimation.reset(); - switchAnimation.start(0.0, 100.0, 0.5f, Type.EASE_IN_OUT_QUAD); - } else { - currentSceneIndex = 0; - currentScene = scenes.get(currentSceneIndex); - } - } -} diff --git a/shared/java/top/fpsmaster/ui/screens/oobe/Scene.java b/shared/java/top/fpsmaster/ui/screens/oobe/Scene.java deleted file mode 100644 index 5c38c575..00000000 --- a/shared/java/top/fpsmaster/ui/screens/oobe/Scene.java +++ /dev/null @@ -1,13 +0,0 @@ -package top.fpsmaster.ui.screens.oobe; - -public class Scene { - public void drawScreen(int mouseX, int mouseY, float partialTicks){ - - } - public void mouseClick(int mouseX, int mouseY, int button){ - - } - public void keyTyped(char typedChar, int keyCode){ - - } -} diff --git a/shared/java/top/fpsmaster/ui/screens/oobe/impls/Login.java b/shared/java/top/fpsmaster/ui/screens/oobe/impls/Login.java deleted file mode 100644 index 2d939ef8..00000000 --- a/shared/java/top/fpsmaster/ui/screens/oobe/impls/Login.java +++ /dev/null @@ -1,145 +0,0 @@ -package top.fpsmaster.ui.screens.oobe.impls; - -import com.google.gson.JsonObject; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ScaledResolution; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.exception.AccountException; -import top.fpsmaster.exception.ExceptionHandler; -import top.fpsmaster.exception.FileException; -import top.fpsmaster.exception.NetworkException; -import top.fpsmaster.modules.account.AccountManager; -import top.fpsmaster.ui.common.GuiButton; -import top.fpsmaster.ui.common.TextField; -import top.fpsmaster.ui.screens.mainmenu.MainMenu; -import top.fpsmaster.ui.screens.oobe.Scene; -import top.fpsmaster.utils.math.animation.ColorAnimation; -import top.fpsmaster.utils.math.animation.Type; -import top.fpsmaster.utils.os.FileUtils; -import top.fpsmaster.utils.render.Render2DUtils; - -import java.awt.*; -import java.net.URI; - -public class Login extends Scene { - private String msg; - private boolean msgbox = false; - private final GuiButton btn; - private final GuiButton btn2; - private final TextField username; - private final TextField password; - private final ColorAnimation msgBoxAnimation; - - public Login(boolean isOOBE) { - username = new TextField(FPSMaster.fontManager.s18, false, FPSMaster.i18n.get("oobe.login.username"), -1, new Color(200, 200, 200).getRGB(), 32); - password = new TextField(FPSMaster.fontManager.s18, true, FPSMaster.i18n.get("oobe.login.password"), -1, new Color(200, 200, 200).getRGB(), 32); - msgBoxAnimation = new ColorAnimation(new Color(0, 0, 0, 0)); - - String defaultText = FPSMaster.configManager.configure.getOrCreate("username", ""); - if (!defaultText.isEmpty()) { // If there's a value "offline", strange bug happens. - username.setText(defaultText); - } - - btn = new GuiButton(FPSMaster.i18n.get("oobe.login.login"), () -> { - try { - JsonObject login = AccountManager.login(username.getText(), password.getText()); - if (FPSMaster.accountManager != null) { - FPSMaster.accountManager.setUsername(username.getText()); - FPSMaster.accountManager.setToken(login.get("data").getAsJsonObject().get("token").getAsString()); - } - try { - if (FPSMaster.accountManager != null) { - FileUtils.saveTempValue("token", FPSMaster.accountManager.getToken()); - } - } catch (FileException e) { - ExceptionHandler.handleFileException(e, "无法保存登录令牌"); - } - FPSMaster.INSTANCE.loggedIn = true; - if (isOOBE) { - FPSMaster.oobeScreen.nextScene(); - } else { - Minecraft.getMinecraft().displayGuiScreen(new MainMenu()); - } - } catch (AccountException e) { - ExceptionHandler.handle(e, "登录失败"); - msg = "未知错误: " + e.getMessage(); - msgbox = true; - } - }); - - btn2 = new GuiButton(FPSMaster.i18n.get("oobe.login.skip"), () -> { - if (isOOBE) { - FPSMaster.oobeScreen.nextScene(); - } else { - Minecraft.getMinecraft().displayGuiScreen(new MainMenu()); - } - FPSMaster.INSTANCE.loggedIn = false; - FPSMaster.configManager.configure.set("username", ""); - }); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawScreen(mouseX, mouseY, partialTicks); - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - - Render2DUtils.drawRect(0f, 0f, sr.getScaledWidth(), sr.getScaledHeight(), new Color(235, 242, 255).getRGB()); - - FPSMaster.fontManager.s24.drawCenteredString(FPSMaster.i18n.get("oobe.login.desc"), sr.getScaledWidth() / 2f, sr.getScaledHeight() / 2f - 90, new Color(162, 162, 162).getRGB()); - FPSMaster.fontManager.s18.drawString(FPSMaster.i18n.get("oobe.login.register"), sr.getScaledWidth() / 2f - 90, sr.getScaledHeight() / 2f + 15, new Color(113, 127, 254).getRGB()); - FPSMaster.fontManager.s40.drawCenteredString(FPSMaster.i18n.get("oobe.login.title"), sr.getScaledWidth() / 2f, sr.getScaledHeight() / 2f - 75, new Color(113, 127, 254).getRGB()); - - btn.render(sr.getScaledWidth() / 2f - 70, sr.getScaledHeight() / 2f + 40, 60f, 24f, mouseX, mouseY); - btn2.render(sr.getScaledWidth() / 2f + 5, sr.getScaledHeight() / 2f + 40, 60f, 24f, mouseX, mouseY); - - username.drawTextBox(sr.getScaledWidth() / 2f - 90, sr.getScaledHeight() / 2f - 40, 180f, 20f); - password.drawTextBox(sr.getScaledWidth() / 2f - 90, sr.getScaledHeight() / 2f - 10, 180f, 20f); - - msgBoxAnimation.update(); - if (msgbox) { - msgBoxAnimation.start(new Color(0, 0, 0, 0), new Color(0, 0, 0, 100), 0.6f, Type.EASE_IN_OUT_QUAD); - Render2DUtils.drawRect(0f, 0f, sr.getScaledWidth(), sr.getScaledHeight(), msgBoxAnimation.getColor()); - Render2DUtils.drawOptimizedRoundedRect(sr.getScaledWidth() / 2f - 100, sr.getScaledHeight() / 2f - 50, 200f, 100f, new Color(255, 255, 255)); - Render2DUtils.drawOptimizedRoundedRect(sr.getScaledWidth() / 2f - 100, sr.getScaledHeight() / 2f - 50, 200f, 20f, new Color(113, 127, 254)); - - FPSMaster.fontManager.s18.drawString(FPSMaster.i18n.get("oobe.login.info"), sr.getScaledWidth() / 2f - 90, sr.getScaledHeight() / 2f - 45, -1); - FPSMaster.fontManager.s18.drawString(msg, sr.getScaledWidth() / 2f - 90, sr.getScaledHeight() / 2f - 20, new Color(60, 60, 60).getRGB()); - } else { - msgBoxAnimation.start(new Color(0, 0, 0, 100), new Color(0, 0, 0, 0), 0.6f, Type.EASE_IN_OUT_QUAD); - } - } - - @Override - public void mouseClick(int mouseX, int mouseY, int mouseButton) { - super.mouseClick(mouseX, mouseY, mouseButton); - btn.mouseClick(mouseX, mouseY, mouseButton); - btn2.mouseClick(mouseX, mouseY, mouseButton); - username.mouseClicked(mouseX, mouseY, mouseButton); - password.mouseClicked(mouseX, mouseY, mouseButton); - - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - if (Render2DUtils.isHovered(sr.getScaledWidth() / 2f - 90, sr.getScaledHeight() / 2f + 15, 100f, 10f, mouseX, mouseY) && mouseButton == 0) { - String url = "https://fpsmaster.top/register"; - if (Desktop.isDesktopSupported()) { - Desktop desktop = Desktop.getDesktop(); - try { - desktop.browse(new URI(url)); - } catch (Exception e) { - ExceptionHandler.handle(e, "无法打开网页"); - } - } - } - - if (msgbox && msgBoxAnimation.getColor().getAlpha() > 50) { - msgbox = false; - } - } - - @Override - public void keyTyped(char typedChar, int keyCode) { - super.keyTyped(typedChar, keyCode); - username.textboxKeyTyped(typedChar, keyCode); - FPSMaster.configManager.configure.set("username", username.getText()); - password.textboxKeyTyped(typedChar, keyCode); - } -} diff --git a/shared/java/top/fpsmaster/utils/Utility.java b/shared/java/top/fpsmaster/utils/Utility.java index 202c9cef..f748c91b 100644 --- a/shared/java/top/fpsmaster/utils/Utility.java +++ b/shared/java/top/fpsmaster/utils/Utility.java @@ -2,7 +2,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.util.ChatComponentText; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.modules.dev.DevMode; import java.util.ArrayList; @@ -16,13 +15,13 @@ public class Utility { static ArrayList messages = new ArrayList<>(); public static void sendChatMessage(String message) { - if (Wrappers.minecraft().getPlayer() == null) return; - Wrappers.minecraft().getPlayer().sendChatMessage(message); + if (mc.thePlayer == null) return; + mc.thePlayer.sendChatMessage(message); } public static void sendClientMessage(String msg) { - if (Wrappers.minecraft().getWorld() != null) { - Wrappers.minecraft().printChatMessage(new ChatComponentText(msg)); + if (mc.theWorld != null) { + mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(msg)); } else { messages.add(msg); } @@ -30,8 +29,8 @@ public static void sendClientMessage(String msg) { public static void sendClientNotify(String msg) { String msg1 = "§9[FPSMaster]§r " + msg; - if (Wrappers.minecraft().getWorld() != null) { - Wrappers.minecraft().printChatMessage(new ChatComponentText(msg1)); + if (mc.theWorld != null) { + mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(msg1)); } else { messages.add(msg1); } @@ -45,7 +44,7 @@ public static void sendClientDebug(String msg) { public static void flush() { for (String message : messages) { - Wrappers.minecraft().printChatMessage(new ChatComponentText(message)); + mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(message)); } messages.clear(); } diff --git a/shared/java/top/fpsmaster/utils/os/FileUtils.java b/shared/java/top/fpsmaster/utils/os/FileUtils.java index bdb05b65..55c93705 100644 --- a/shared/java/top/fpsmaster/utils/os/FileUtils.java +++ b/shared/java/top/fpsmaster/utils/os/FileUtils.java @@ -1,9 +1,9 @@ package top.fpsmaster.utils.os; import top.fpsmaster.exception.FileException; -import top.fpsmaster.api.Wrappers; +import net.minecraft.client.Minecraft; import top.fpsmaster.modules.logger.ClientLogger; -import top.fpsmaster.wrapper.Constants; +import top.fpsmaster.Constants; import java.io.*; import java.nio.charset.StandardCharsets; @@ -29,8 +29,8 @@ public class FileUtils { cache = file(new File("D:\\Code\\Lua\\FPSMaster"), ".cache"); dir = file(new File("D:\\Code\\Lua\\FPSMaster"), "FPSMaster " + Constants.VERSION); } else { - cache = file(Wrappers.minecraft().getGameDir(), ".cache"); - dir = file(Wrappers.minecraft().getGameDir(), "FPSMaster " + Constants.VERSION); + cache = file(Minecraft.getMinecraft().mcDataDir, ".cache"); + dir = file(Minecraft.getMinecraft().mcDataDir, "FPSMaster " + Constants.VERSION); } plugins = file(dir, "plugins"); fonts = file(dir, "fonts"); diff --git a/shared/java/top/fpsmaster/utils/render/Render2DUtils.java b/shared/java/top/fpsmaster/utils/render/Render2DUtils.java index dc96d494..243cc3dc 100644 --- a/shared/java/top/fpsmaster/utils/render/Render2DUtils.java +++ b/shared/java/top/fpsmaster/utils/render/Render2DUtils.java @@ -6,6 +6,7 @@ import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.ThreadDownloadImageData; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; @@ -16,7 +17,6 @@ import org.lwjgl.opengl.GL20; import top.fpsmaster.FPSMaster; import top.fpsmaster.features.impl.interfaces.ClientSettings; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.ui.screens.mainmenu.MainMenu; import top.fpsmaster.utils.Utility; import top.fpsmaster.utils.awt.AWTUtils; @@ -27,7 +27,6 @@ import top.fpsmaster.utils.render.shader.GLSLSandboxShader; import top.fpsmaster.utils.render.shader.KawaseBlur; import top.fpsmaster.utils.render.shader.RoundedUtil; -import top.fpsmaster.wrapper.renderEngine.bufferbuilder.WrapperBufferBuilder; import java.awt.*; import java.io.File; @@ -178,7 +177,7 @@ public static void drawModalRectWithCustomSizedTexture(float x, float y, float u float f = 1.0F / textureWidth; float f1 = 1.0F / textureHeight; Tessellator tessellator = Tessellator.getInstance(); - WrapperBufferBuilder bufferbuilder = new WrapperBufferBuilder(tessellator); + WorldRenderer bufferbuilder = tessellator.getWorldRenderer(); bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); bufferbuilder.pos(x, y + height, 0.0D).tex(u * f, (v + height) * f1).endVertex(); bufferbuilder.pos(x + width, y + height, 0.0D).tex((u + width) * f, (v + height) * f1).endVertex(); @@ -348,7 +347,7 @@ public static void drawBackground(int guiWidth, int guiHeight, int mouseX, int m GL11.glEnable(GL11.GL_ALPHA_TEST); Render2DUtils.drawRect(0f, 0f, guiWidth, guiHeight, new Color(26, 59, 109, 60)); } else { - Wrappers.mainMenu().renderSkybox(mouseX, mouseY, partialTicks, guiWidth, guiHeight, zLevel); + Render2DUtils.drawRect(0f, 0f, guiWidth, guiHeight, new Color(0, 0, 0, 255)); } } } diff --git a/shared/java/top/fpsmaster/utils/render/Render3DUtils.java b/shared/java/top/fpsmaster/utils/render/Render3DUtils.java index fad9f512..3ffd7e95 100644 --- a/shared/java/top/fpsmaster/utils/render/Render3DUtils.java +++ b/shared/java/top/fpsmaster/utils/render/Render3DUtils.java @@ -1,22 +1,22 @@ package top.fpsmaster.utils.render; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.AxisAlignedBB; import top.fpsmaster.utils.Utility; -import top.fpsmaster.wrapper.renderEngine.bufferbuilder.WrapperBufferBuilder; -import top.fpsmaster.wrapper.util.WrapperAxisAlignedBB; public class Render3DUtils extends Utility { - private static void posBoundingBoxLeftHalf(WrapperAxisAlignedBB boundingBox, WrapperBufferBuilder bufferBuilder) { - bufferBuilder.pos(boundingBox.minX(), boundingBox.maxY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.maxY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.maxY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.maxY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.maxY(), boundingBox.minZ()).endVertex(); + private static void posBoundingBoxLeftHalf(AxisAlignedBB boundingBox, WorldRenderer bufferBuilder) { + bufferBuilder.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); } - public static void drawBoundingBoxOutline(WrapperAxisAlignedBB boundingBox) { + public static void drawBoundingBoxOutline(AxisAlignedBB boundingBox) { Tessellator tessellator = Tessellator.getInstance(); - WrapperBufferBuilder bufferBuilder = new WrapperBufferBuilder(tessellator); + WorldRenderer bufferBuilder = tessellator.getWorldRenderer(); bufferBuilder.begin(3, DefaultVertexFormats.POSITION); posBoundingBoxHalf(boundingBox, bufferBuilder); tessellator.draw(); @@ -27,71 +27,71 @@ public static void drawBoundingBoxOutline(WrapperAxisAlignedBB boundingBox) { posBoundingBoxSquare(boundingBox, tessellator, bufferBuilder); } - private static void posBoundingBoxHalf(WrapperAxisAlignedBB boundingBox, WrapperBufferBuilder bufferBuilder) { - bufferBuilder.pos(boundingBox.minX(), boundingBox.minY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.minY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.minY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.minY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.minY(), boundingBox.minZ()).endVertex(); + private static void posBoundingBoxHalf(AxisAlignedBB boundingBox, WorldRenderer bufferBuilder) { + bufferBuilder.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); } - private static void posBoundingBoxSquare(WrapperAxisAlignedBB boundingBox, Tessellator tessellator, WrapperBufferBuilder bufferBuilder) { - bufferBuilder.pos(boundingBox.minX(), boundingBox.minY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.maxY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.minY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.maxY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.minY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.maxY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.minY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.maxY(), boundingBox.maxZ()).endVertex(); + private static void posBoundingBoxSquare(AxisAlignedBB boundingBox, Tessellator tessellator, WorldRenderer bufferBuilder) { + bufferBuilder.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); tessellator.draw(); } - public static void drawBoundingBox(WrapperAxisAlignedBB boundingBox) { + public static void drawBoundingBox(AxisAlignedBB boundingBox) { Tessellator tessellator = Tessellator.getInstance(); - WrapperBufferBuilder bufferBuilder = new WrapperBufferBuilder(tessellator); + WorldRenderer bufferBuilder = tessellator.getWorldRenderer(); bufferBuilder.begin(7, DefaultVertexFormats.POSITION); posBoundingBoxSquare(boundingBox, tessellator, bufferBuilder); bufferBuilder.begin(7, DefaultVertexFormats.POSITION); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.maxY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.minY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.maxY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.minY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.maxY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.minY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.maxY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.minY(), boundingBox.maxZ()).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); tessellator.draw(); bufferBuilder.begin(7, DefaultVertexFormats.POSITION); posBoundingBoxLeftHalf(boundingBox, bufferBuilder); - bufferBuilder.pos(boundingBox.minX(), boundingBox.maxY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.maxY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.maxY(), boundingBox.minZ()).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); tessellator.draw(); bufferBuilder.begin(7, DefaultVertexFormats.POSITION); posBoundingBoxHalf(boundingBox, bufferBuilder); - bufferBuilder.pos(boundingBox.minX(), boundingBox.minY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.minY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.minY(), boundingBox.minZ()).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); tessellator.draw(); bufferBuilder.begin(7, DefaultVertexFormats.POSITION); - bufferBuilder.pos(boundingBox.minX(), boundingBox.minY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.maxY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.minY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.maxY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.minY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.maxY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.minY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.maxY(), boundingBox.minZ()).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); tessellator.draw(); bufferBuilder.begin(7, DefaultVertexFormats.POSITION); - bufferBuilder.pos(boundingBox.minX(), boundingBox.maxY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.minY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.maxY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.minX(), boundingBox.minY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.maxY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.minY(), boundingBox.minZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.maxY(), boundingBox.maxZ()).endVertex(); - bufferBuilder.pos(boundingBox.maxX(), boundingBox.minY(), boundingBox.maxZ()).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).endVertex(); + bufferBuilder.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).endVertex(); tessellator.draw(); } } diff --git a/shared/java/top/fpsmaster/utils/thirdparty/github/UpdateChecker.java b/shared/java/top/fpsmaster/utils/thirdparty/github/UpdateChecker.java deleted file mode 100644 index 7ab78870..00000000 --- a/shared/java/top/fpsmaster/utils/thirdparty/github/UpdateChecker.java +++ /dev/null @@ -1,16 +0,0 @@ -package top.fpsmaster.utils.thirdparty.github; - -import top.fpsmaster.utils.GitInfo; -import top.fpsmaster.utils.os.HttpRequest; - -import java.io.IOException; - -public class UpdateChecker { - public static String getLatestVersion() { - try { - return HttpRequest.get("https://service.fpsmaster.top/api/github/latest/commit?branch=refs/heads/"+ GitInfo.getBranch()).getBody(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/utils/thirdparty/microsoft/MicrosoftLogin.java b/shared/java/top/fpsmaster/utils/thirdparty/microsoft/MicrosoftLogin.java deleted file mode 100644 index 8d77ba85..00000000 --- a/shared/java/top/fpsmaster/utils/thirdparty/microsoft/MicrosoftLogin.java +++ /dev/null @@ -1,382 +0,0 @@ -package top.fpsmaster.utils.thirdparty.microsoft; - -import com.google.gson.JsonObject; -import com.sun.net.httpserver.HttpServer; -import net.minecraft.util.Session; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.ui.screens.mainmenu.MainMenu; -import top.fpsmaster.utils.os.HttpRequest; - -import java.awt.*; -import java.io.IOException; -import java.io.OutputStream; -import java.net.InetSocketAddress; -import java.net.URI; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; -import java.util.StringJoiner; -import java.util.concurrent.Executors; -import java.util.concurrent.atomic.AtomicBoolean; - -import static top.fpsmaster.utils.Utility.mc; - -public class MicrosoftLogin { - - public static String loginProgressMessage = "Waiting for login..."; - - // --- Configuration --- - private static final String CLIENT_ID = "d1ed1b72-9f7c-41bc-9702-365d2cbd2e38"; - private static final int SERVER_PORT = 17342; - private static final String REDIRECT_URI = "http://127.0.0.1:" + SERVER_PORT; - private static final boolean DEBUG_MODE = false; - - private static HttpServer httpServer; - private static final AtomicBoolean loginCompleted = new AtomicBoolean(false); - - /** - * Starts the local HTTP server to handle the Microsoft authentication redirect. - * This method should be called before opening the browser for login. - */ - public static void startLocalHttpServer() { - if (httpServer != null) { - logInfo("HTTP server is already running."); - return; - } - - try { - httpServer = HttpServer.create(new InetSocketAddress(SERVER_PORT), 0); - logInfo("Created login server on port " + SERVER_PORT); - - httpServer.createContext("/", exchange -> { - logInfo("New connection received on HTTP server."); - String responseMessage = "Authentication successful! You can close this tab."; - try (OutputStream responseBody = exchange.getResponseBody()) { - exchange.sendResponseHeaders(200, responseMessage.length()); - responseBody.write(responseMessage.getBytes(StandardCharsets.UTF_8)); - } catch (IOException e) { - logError("Error sending HTTP response: " + e.getMessage()); - } finally { - // Stop the server immediately after receiving the code - stopLocalHttpServer(); - } - - String requestUri = exchange.getRequestURI().toString(); - logDebug("Received request URI: " + requestUri); - - if (requestUri.contains("code=")) { - String code = requestUri.substring(requestUri.indexOf("=") + 1); - logInfo("Authorization code received. Starting token exchange..."); - try { - // Exchange authorization code for initial tokens - Map tokenRequestParams = new HashMap<>(); - tokenRequestParams.put("client_id", CLIENT_ID); - tokenRequestParams.put("code", code); - tokenRequestParams.put("grant_type", "authorization_code"); - tokenRequestParams.put("redirect_uri", REDIRECT_URI); - - String oauthResponse = HttpRequest.postForm("https://login.live.com/oauth20_token.srf", tokenRequestParams).getBody(); - logDebug("OAuth Response: " + oauthResponse); - JsonObject oauthJson = HttpRequest.gson().fromJson(oauthResponse, JsonObject.class); - String accessToken = getJsonString(oauthJson, "access_token", "OAuth access token"); - String refreshToken = getJsonString(oauthJson, "refresh_token", "OAuth refresh token"); - logInfo("OAuth Access Token obtained. (Refresh Token: " + (DEBUG_MODE ? refreshToken : "[HIDDEN]") + ")"); - - // Continue with Minecraft authentication using the obtained access token - continueMinecraftAuthentication(accessToken); - loginCompleted.set(true); - } catch (Exception e) { - logError("Error during login completion: " + e.getMessage()); - setStep("Login Failed. (error: " + e.getMessage() + ")"); - } - } else { - logError("No authorization code found in the redirect URI."); - setStep("Login failed. (no authorization code found in the redirect URI)"); - stopLocalHttpServer(); - } - }); - - // Use a single-thread executor for the HTTP server to avoid resource issues - httpServer.setExecutor(Executors.newSingleThreadExecutor()); - httpServer.start(); - logInfo("HTTP server started successfully."); - } catch (IOException e) { - logError("Failed to start HTTP server: " + e.getMessage()); - setStep("Login failed. (error: " + e.getMessage() + ")"); - httpServer = null; // Ensure server is null if creation failed - throw new RuntimeException("Failed to start HTTP server for Microsoft login.", e); - } - } - - /** - * Stops the local HTTP server. - */ - public static void stopLocalHttpServer() { - if (httpServer != null) { - httpServer.stop(1); // Stop with a 1-second delay to allow current requests to finish - httpServer = null; - logInfo("HTTP server stopped."); - } - } - - /** - * Initiates the Microsoft login process by opening a browser window. - * This method will start a local HTTP server to listen for the redirect. - * - * @return true if the login process is successfully initiated (browser opened), false otherwise. - */ - public static boolean loginMicrosoft() { - startLocalHttpServer(); // Ensure the server is running before opening the browser - if (httpServer == null) { - logError("HTTP server failed to start. Cannot proceed with browser login."); - return false; - } - - try { - Map params = new HashMap<>(); - params.put("client_id", CLIENT_ID); - params.put("response_type", "code"); - params.put("redirect_uri", REDIRECT_URI); - params.put("scope", "XboxLive.signin offline_access"); - - String microsoftAuthUrl = buildUrl("https://login.live.com/oauth20_authorize.srf", params); - logInfo("Opening browser for Microsoft authentication: " + microsoftAuthUrl); - Desktop.getDesktop().browse(URI.create(microsoftAuthUrl)); - return true; - } catch (IOException e) { - logError("Failed to open browser for Microsoft login: " + e.getMessage()); - setStep("Login failed. (failed to open browser for Microsoft login)"); - stopLocalHttpServer(); // Stop server if browser can't be opened - return false; - } - } - - /** - * Continues the Minecraft authentication process using an Xbox Live access token. - * This method covers steps 2-5 of the original login flow: - * Xbox Live authentication, XSTS authorization, Minecraft authentication, and profile retrieval. - * - * @param xboxAccessToken The Xbox Live access token obtained from the initial OAuth flow or refresh token. - * @throws IOException If any HTTP request fails or authentication fails. - */ - private static void continueMinecraftAuthentication(String xboxAccessToken) throws IOException { - logInfo("Continuing Minecraft authentication flow..."); - - // 2. Authenticate with Xbox Live - setStep("Step 2/5: Authenticating with Xbox Live..."); - Map xboxAuthProperties = new HashMap<>(); - xboxAuthProperties.put("AuthMethod", "RPS"); - xboxAuthProperties.put("SiteName", "user.auth.xboxlive.com"); - xboxAuthProperties.put("RpsTicket", "d=" + xboxAccessToken); - - JsonObject xboxAuthPayload = new JsonObject(); - xboxAuthPayload.add("Properties", HttpRequest.gson().toJsonTree(xboxAuthProperties)); - xboxAuthPayload.addProperty("RelyingParty", "http://auth.xboxlive.com"); - xboxAuthPayload.addProperty("TokenType", "JWT"); - - String xboxAuthResponse = HttpRequest.postJson("https://user.auth.xboxlive.com/user/authenticate", xboxAuthPayload).getBody(); - logDebug("Xbox Auth Response: " + xboxAuthResponse); - JsonObject xboxAuthJson = HttpRequest.gson().fromJson(xboxAuthResponse, JsonObject.class); - String xblToken = getJsonString(xboxAuthJson, "Token", "XBL Token"); - String xblUserhash = xboxAuthJson.getAsJsonObject("DisplayClaims") - .getAsJsonArray("xui").get(0).getAsJsonObject() - .get("uhs").getAsString(); - logInfo("Xbox Live Token and Userhash obtained."); - - // 3. Authorize with XSTS - setStep("Step 3/5: Authorizing with XSTS service..."); - JsonObject xstsProperties = new JsonObject(); - xstsProperties.addProperty("SandboxId", "RETAIL"); - xstsProperties.add("UserTokens", HttpRequest.gson().toJsonTree(new String[]{xblToken})); - - JsonObject xstsPayload = new JsonObject(); - xstsPayload.add("Properties", xstsProperties); - xstsPayload.addProperty("RelyingParty", "rp://api.minecraftservices.com/"); - xstsPayload.addProperty("TokenType", "JWT"); - - String xstsResponse = HttpRequest.postJson("https://xsts.auth.xboxlive.com/xsts/authorize", xstsPayload).getBody(); - logDebug("XSTS Response: " + xstsResponse); - JsonObject xstsJson = HttpRequest.gson().fromJson(xstsResponse, JsonObject.class); - - if (xstsJson.has("XErr")) { - long xErrCode = xstsJson.get("XErr").getAsLong(); - String message = xstsJson.has("Message") ? xstsJson.get("Message").getAsString() : "Unknown XSTS error."; - logError("XSTS Error: " + message + " (Code: " + xErrCode + ")"); - if (xErrCode == 2148916064L) { - logError("This typically means the account is a child account and requires adult verification."); - } else if (xErrCode == 2148916065L) { - logError("This usually means the account has not accepted the Xbox Live terms of service."); - } - throw new IOException("XSTS authorization failed: " + message); - } - - String xstsToken = getJsonString(xstsJson, "Token", "XSTS Token"); - String xstsUserhash = xstsJson.getAsJsonObject("DisplayClaims") - .getAsJsonArray("xui").get(0).getAsJsonObject() - .get("uhs").getAsString(); - logInfo("XSTS Token and Userhash obtained."); - - // 4. Authenticate with Minecraft - setStep("Step 4/5: Authenticating with Minecraft services..."); - JsonObject minecraftAuthPayload = new JsonObject(); - minecraftAuthPayload.addProperty("identityToken", "XBL3.0 x=" + xstsUserhash + ";" + xstsToken); - - String minecraftAuthResponse = HttpRequest.postJson("https://api.minecraftservices.com/authentication/login_with_xbox", minecraftAuthPayload).getBody(); - logDebug("Minecraft Auth Response: " + minecraftAuthResponse); - JsonObject minecraftAuthJson = HttpRequest.gson().fromJson(minecraftAuthResponse, JsonObject.class); - String mcAccessToken = getJsonString(minecraftAuthJson, "access_token", "Minecraft access token"); - String mcUsername = getJsonString(minecraftAuthJson, "username", "Minecraft username"); // This is often the UUID, not the display name - logInfo("Minecraft Access Token obtained. Username: " + mcUsername); - - - // 5. Get Minecraft Profile - setStep("Step 5/5: Retrieving Minecraft profile..."); - Map profileHeaders = new HashMap<>(); - profileHeaders.put("Authorization", "Bearer " + mcAccessToken); - - String profileResponse = HttpRequest.get("https://api.minecraftservices.com/minecraft/profile", profileHeaders).getBody(); - logDebug("Minecraft Profile Response: " + profileResponse); - JsonObject profileJson = HttpRequest.gson().fromJson(profileResponse, JsonObject.class); - - String uuid = getJsonString(profileJson, "id", "Minecraft UUID"); - String name = getJsonString(profileJson, "name", "Minecraft Username"); - boolean hasBoughtGame = profileJson.has("name") && profileJson.has("id"); // Simple check - - if (!hasBoughtGame) { - logError("Minecraft profile indicates game not owned or profile not found."); - throw new IOException("Minecraft account does not own the game or profile not found."); - } - - logInfo("Successfully retrieved Minecraft profile - Name: " + name + ", UUID: " + uuid); - - // Set Minecraft Session - logInfo("Setting Minecraft session..."); - Wrappers.minecraft().setSession(new Session(name, uuid, mcAccessToken, "mojang")); - setStep("Minecraft session updated successfully!"); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - mc.displayGuiScreen(new MainMenu()); - } - - /** - * Converts a map of parameters to a URL-encoded string. - * - * @param params The map of parameters. - * @return A URL-encoded string. - */ - private static String paramsToUrlEncoded(Map params) { - StringJoiner sj = new StringJoiner("&"); - for (Map.Entry entry : params.entrySet()) { - sj.add(urlEncode(entry.getKey()) + "=" + urlEncode(entry.getValue())); - } - return sj.toString(); - } - - /** - * Builds a URL with query parameters from a base URL and a map of parameters. - * - * @param baseUrl The base URL. - * @param params The map of parameters. - * @return The constructed URL. - */ - private static String buildUrl(String baseUrl, Map params) { - if (params.isEmpty()) { - return baseUrl; - } - return baseUrl + "?" + paramsToUrlEncoded(params); - } - - /** - * URL-encodes a string. - * - * @param value The string to encode. - * @return The URL-encoded string. - */ - private static String urlEncode(String value) { - try { - return URLEncoder.encode(value, StandardCharsets.UTF_8.toString()); - } catch (Exception e) { - logError("Failed to URL encode: " + value + " - " + e.getMessage()); - return value; // Fallback to unencoded if encoding fails - } - } - - /** - * Safely retrieves a string value from a JsonObject. - * - * @param jsonObject The JsonObject. - * @param key The key to retrieve. - * @param fieldName A user-friendly name for the field (for logging). - * @return The string value. - * @throws IOException If the key is not found or is not a string. - */ - private static String getJsonString(JsonObject jsonObject, String key, String fieldName) throws IOException { - if (jsonObject == null || !jsonObject.has(key) || !jsonObject.get(key).isJsonPrimitive()) { - logError("Missing or invalid field in JSON response: " + fieldName + " (key: " + key + ")"); - throw new IOException("Missing or invalid field in JSON response: " + fieldName); - } - return jsonObject.get(key).getAsString(); - } - - // --- Logging Utilities --- - - private static void logInfo(String message) { - System.out.println("[MicrosoftLogin INFO] " + message); - } - - private static void logDebug(String message) { - if (DEBUG_MODE) { - System.out.println("[MicrosoftLogin DEBUG] " + message); - } - } - - private static void logError(String message) { - System.err.println("[MicrosoftLogin ERROR] " + message); - } - - - - public static void loginViaBrowser() { - try { - logInfo("Starting Microsoft login process..."); - setStep("Step 1/5: Retrieving accessToken from browser..."); - boolean initiated = loginMicrosoft(); - if (initiated) { - logInfo("Browser opened. Waiting for login completion..."); - long startTime = System.currentTimeMillis(); - long timeout = 120 * 1000; // 2 minutes timeout - while (!loginCompleted.get() && (System.currentTimeMillis() - startTime < timeout)) { - try { - Thread.sleep(1000); // Wait 1 second - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - logError("Login wait interrupted: " + e.getMessage()); - setStep("Login wait interrupted"); - break; - } - } - if (loginCompleted.get()) { - logInfo("Login process finished."); - } else { - logError("Login timed out or did not complete."); - } - } else { - logError("Failed to initiate browser login."); - } - } catch (Exception e) { - logError("An unexpected error occurred in main: " + e.getMessage()); - e.printStackTrace(); - } finally { - stopLocalHttpServer(); // Ensure server is stopped on exit - } - } - - public static void setStep(String step) { - logInfo(step); - loginProgressMessage = step; - } -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/utils/thirdparty/openai/OpenAI.java b/shared/java/top/fpsmaster/utils/thirdparty/openai/OpenAI.java deleted file mode 100644 index 6f14c6c0..00000000 --- a/shared/java/top/fpsmaster/utils/thirdparty/openai/OpenAI.java +++ /dev/null @@ -1,133 +0,0 @@ -package top.fpsmaster.utils.thirdparty.openai; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.modules.logger.ClientLogger; -import top.fpsmaster.utils.os.HttpRequest; - -import java.util.HashMap; -import java.util.Map; - -public class OpenAI { - - String baseUrl; - String openAiKey; - String model; - String prompt; - - public OpenAI(String baseUrl, String openAiKey, String model, String prompt) { - this.baseUrl = baseUrl; - this.openAiKey = openAiKey; - this.model = model; - this.prompt = prompt; - } - - public String requestNewAnswer(String question, JsonArray msgs) { - JsonObject systemRole = new JsonObject(); - systemRole.addProperty("role", "system"); - systemRole.addProperty("content", prompt); - - JsonArray messages = new JsonArray(); - messages.add(systemRole); - messages.addAll(msgs); - - JsonObject body = new JsonObject(); - body.addProperty("model", model); - body.add("messages", messages); - - Map hashMap = new HashMap<>(); - hashMap.put("Content-Type", "application/json"); - hashMap.put("Authorization", "Bearer " + openAiKey); - - String text; - try { - text = HttpRequest.postJson(baseUrl + "/chat/completions", body, hashMap).getBody(); - } catch (Exception e) { - throw new RuntimeException(e); - } - - return getString(text); - } - - public String requestNewAnswer(String question) { - JsonObject body = getJsonObject(question); - - Map hashMap = new HashMap<>(); - hashMap.put("Content-Type", "application/json"); - hashMap.put("Authorization", "Bearer " + openAiKey); - - String text; - try { - text = HttpRequest.postJson(baseUrl + "/chat/completions", body, hashMap).getBody(); - } catch (Exception e) { - ClientLogger.error("Translator", e.toString()); - return ""; - } - - return getString(text); - } - - private @NotNull JsonObject getJsonObject(String question) { - JsonObject systemRole = new JsonObject(); - systemRole.addProperty("role", "system"); - systemRole.addProperty("content", prompt); - - JsonObject userRole = new JsonObject(); - userRole.addProperty("role", "user"); - userRole.addProperty("content", question); - - JsonArray messages = new JsonArray(); - messages.add(systemRole); - messages.add(userRole); - - JsonObject body = new JsonObject(); - body.addProperty("model", model); - body.add("messages", messages); - return body; - } - - private String getString(String response) { - JsonObject responseJson = new JsonParser().parse(response).getAsJsonObject(); - return responseJson.getAsJsonArray("choices") - .get(0).getAsJsonObject() - .getAsJsonObject("message") - .getAsJsonObject("content") - .getAsString(); - - } - - public static String[] requestClientAI(String prompt, String model, JsonArray messages) { - try { - String sendPostRequest = HttpRequest.postJson( - FPSMaster.SERVICE_API + "/chat?timestamp=" + System.currentTimeMillis(), - messages.getAsJsonObject(), - new HashMap() {{ - put("Content-Type", "application/json"); - put("username", FPSMaster.accountManager.getUsername()); - put("token", FPSMaster.accountManager.getToken()); - put("model", model); - put("prompt", prompt); - }} - ).getBody(); - - if (!sendPostRequest.isEmpty()) { - JsonObject json = new JsonParser().parse(sendPostRequest).getAsJsonObject(); - if ("200".equals(sendPostRequest)) { - return new String[]{ - json.get("code").getAsString(), - json.get("data").getAsString() - }; - } else { - return new String[]{"501", "Server went wrong"}; - } - } - } catch (Exception e) { - e.printStackTrace(); - return new String[]{"500", e.toString()}; - } - return new String[]{"500", "Request failed"}; - } -} diff --git a/shared/java/top/fpsmaster/utils/thirdparty/openai/OpenAIClient.java b/shared/java/top/fpsmaster/utils/thirdparty/openai/OpenAIClient.java deleted file mode 100644 index 43da1004..00000000 --- a/shared/java/top/fpsmaster/utils/thirdparty/openai/OpenAIClient.java +++ /dev/null @@ -1,174 +0,0 @@ -package top.fpsmaster.utils.thirdparty.openai; - -import com.google.gson.*; -import org.apache.commons.lang3.StringEscapeUtils; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.HttpClients; -import top.fpsmaster.exception.FileException; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -public class OpenAIClient { - - private static final String API_KEY = "sk-buhpazkvJ04hJYwp475fAb626c8c44B6AbE1D66448F5BdAd"; // 替换为你的API密钥 - private static final String API_URL = "https://api.aiskt.com/v1/chat/completions"; - private static final HttpClient client = HttpClients.createDefault(); - private static final ExecutorService executor = Executors.newSingleThreadExecutor(); - - // 阻塞式调用:等待全部数据返回后才返回 - public static String getChatResponse(ArrayList userMessages) throws IOException { - StringBuilder responseBuilder = new StringBuilder(); - String jsonBody = buildRequestJson(userMessages); - - HttpPost postRequest = createPostRequest(jsonBody); - try (BufferedReader reader = new BufferedReader(new InputStreamReader(client.execute(postRequest).getEntity().getContent()))) { - String line; - while ((line = reader.readLine()) != null) { -// responseBuilder.append(line); - if (processResponseLine(line, responseBuilder)) { - break; // 如果检测到回复已完成,则退出 - } - } - } - - return responseBuilder.toString(); // 返回拼接后的完整响应 - } - - // 非阻塞式调用:响应流将通过回调处理 - public static void getChatResponseAsync(ArrayList userMessages, ResponseCallback callback) { - executor.submit(() -> { - try { - String jsonBody = buildRequestJson(userMessages); - HttpPost postRequest = createPostRequest(jsonBody); - StringBuilder responseBuilder = new StringBuilder(); - - try (BufferedReader reader = new BufferedReader(new InputStreamReader(client.execute(postRequest).getEntity().getContent(), StandardCharsets.UTF_8))) { - String line; - while ((line = reader.readLine()) != null) { -// responseBuilder.append(line); - if (processResponseLine(line, responseBuilder)) { - callback.onFinish(responseBuilder.toString()); // 非阻塞调用,处理数据 - break; // 如果检测到回复已完成,则退出 - } - callback.onResponse(responseBuilder.toString()); // 非阻塞调用,处理数据 - } - } catch (FileException e) { - throw new RuntimeException(e); - } - } catch (IOException e) { - callback.onError(e); - } - }); - } - - // 创建POST请求 - private static HttpPost createPostRequest(String jsonBody) { - HttpPost postRequest = new HttpPost(API_URL); - postRequest.setHeader("Authorization", "Bearer " + API_KEY); - postRequest.setHeader("Content-Type", "application/json; charset=UTF-8\""); - - StringEntity entity = new StringEntity(jsonBody, "UTF-8"); - postRequest.setEntity(entity); - - return postRequest; - } - - // 构建请求体JSON - private static String buildRequestJson(ArrayList messages) { - StringBuilder messagesJson = new StringBuilder(); - - for (Message message : messages) { - messagesJson.append("{\"role\": \"").append(message.role).append("\", \"content\": \"").append(StringEscapeUtils.escapeJson(message.content)).append("\"},"); - } - - // 移除最后一个逗号 - if (messagesJson.length() > 0) { - messagesJson.deleteCharAt(messagesJson.length() - 1); - } - - return "{\n" + - " \"model\": \"gpt-3.5-turbo\",\n" + - " \"messages\": [" + messagesJson + "],\n" + - " \"stream\": true\n" + - "}"; - } - - // 处理每一行的响应数据并解析回复文本 - private static boolean processResponseLine(String line, StringBuilder responseBuilder) { - // OpenAI 的流式响应数据通常会以 "data: " 开头,我们需要忽略它 - if (line.startsWith("data: ")) { - // 去掉前缀"data: ",并解析剩余的 JSON 部分 - String jsonData = line.substring(6).trim(); - - try { - JsonElement jsonElement = new JsonParser().parse(jsonData); - if (jsonElement.isJsonObject()) { - JsonObject jsonObject = jsonElement.getAsJsonObject(); - if (jsonObject.has("choices")) { - JsonArray choices = jsonObject.getAsJsonArray("choices"); - for (JsonElement choice : choices) { - JsonObject choiceObj = choice.getAsJsonObject(); - if (choiceObj.has("delta")) { - JsonObject messageObj = choiceObj.getAsJsonObject("delta"); - if (messageObj.has("content")) { - String content = messageObj.get("content").getAsString(); - responseBuilder.append(content); // 拼接回复文本 - } - } - // 检查finish_reason字段,如果是stop,表示消息已完成 - if (choiceObj.has("finish_reason") && choiceObj.get("finish_reason").getAsString().equals("stop")) { - return true; // 发现回复完成,返回true - } - } - } - } - } catch (JsonParseException e) { - e.printStackTrace(); - } - } - return false; // 如果没有完成,继续读取 - } - - // 回调接口:非阻塞方式 - public interface ResponseCallback { - void onResponse(String response); // 当成功获取到响应时调用 - - void onError(Exception e); // 当发生错误时调用 - - void onFinish(String string) throws FileException; - } - - public static class Message { - String content; - String role; - - public Message(String role, String content) { - this.content = content; - this.role = role; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public String getRole() { - return role; - } - - public void setRole(String role) { - this.role = role; - } - } -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/utils/world/ItemsUtil.java b/shared/java/top/fpsmaster/utils/world/ItemsUtil.java index 51e461da..a90c44bd 100644 --- a/shared/java/top/fpsmaster/utils/world/ItemsUtil.java +++ b/shared/java/top/fpsmaster/utils/world/ItemsUtil.java @@ -6,7 +6,6 @@ import net.minecraft.item.ItemPotion; import net.minecraft.item.ItemStack; import net.minecraft.potion.PotionEffect; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.utils.Utility; import java.util.List; @@ -58,7 +57,7 @@ public static void renderItem(ItemStack itemStack, float x, float y) { GlStateManager.pushMatrix(); Utility.mc.getRenderItem().renderItemIntoGUI(copyItem, (int) x, (int) y); GlStateManager.popMatrix(); - Utility.mc.getRenderItem().renderItemOverlays(Wrappers.minecraft().getFontRenderer(), copyItem, (int) x, (int) y); + Utility.mc.getRenderItem().renderItemOverlays(Utility.mc.fontRendererObj, copyItem, (int) x, (int) y); RenderHelper.disableStandardItemLighting(); GlStateManager.disableRescaleNormal(); diff --git a/shared/java/top/fpsmaster/websocket/client/WsClient.java b/shared/java/top/fpsmaster/websocket/client/WsClient.java deleted file mode 100644 index 0be39257..00000000 --- a/shared/java/top/fpsmaster/websocket/client/WsClient.java +++ /dev/null @@ -1,86 +0,0 @@ -package top.fpsmaster.websocket.client; - -import org.java_websocket.client.WebSocketClient; -import org.java_websocket.handshake.ServerHandshake; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.features.impl.interfaces.ClientSettings; -import top.fpsmaster.features.impl.utility.IRC; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.utils.Utility; -import top.fpsmaster.websocket.data.message.Packet; -import top.fpsmaster.websocket.data.message.client.*; -import top.fpsmaster.websocket.data.message.server.SFetchPlayerPacket; -import top.fpsmaster.websocket.data.message.server.SMessagePacket; - -import java.net.URI; -import java.net.URISyntaxException; - -public class WsClient extends WebSocketClient { - - public WsClient(URI serverURI) { - super(serverURI); - } - - @Override - public void onOpen(ServerHandshake handshakedata) { - Utility.sendClientDebug("成功连接到irc服务器,开始验证登录信息"); - if (Wrappers.minecraft().getPlayer() != null) { - Utility.sendClientMessage(FPSMaster.i18n.get("irc.enable").replace("%s", ClientSettings.prefix.getValue())); - } - assert FPSMaster.accountManager != null; - send(new LoginPacket(FPSMaster.accountManager.getUsername(), FPSMaster.accountManager.getToken()).toJson()); - } - - public void sendMessage(String message) { - send(new MessagePacket(MessagePacket.MessageType.CHAT, message).toJson()); - } - - public void sendInformation(String skin, String cosmetics, String gameID, String serverAddress) { - send(new PlayerInfoPacket(gameID, Wrappers.minecraft().getPlayer().getUniqueID().toString(), serverAddress, skin, cosmetics).toJson()); - } - - - public void sendCommand(String message) { - send(new MessagePacket(MessagePacket.MessageType.COMMAND, message).toJson()); - } - - public void sendDM(String to, String message) { - send(new DMPacket(to, message).toJson()); - } - - @Override - public void onMessage(String message) { - Packet packet = Packet.parsePacket(message, Packet.class); - switch (packet.type) { - case SERVER_MESSAGE: - SMessagePacket parsePacket = (SMessagePacket) Packet.parsePacket(message, SMessagePacket.class); - if (IRC.using) - Utility.sendClientMessage(parsePacket.msg); - break; - case SERVER_FETCH_PLAYER: - SFetchPlayerPacket parsePacket1 = (SFetchPlayerPacket) Packet.parsePacket(message, SFetchPlayerPacket.class); - FPSMaster.clientUsersManager.addFromFetch(parsePacket1); - } - } - - @Override - public void onClose(int code, String reason, boolean remote) { - Utility.sendClientDebug("连接关闭:" + reason); - FPSMaster.INSTANCE.wsClient = null; - } - - @Override - public void onError(Exception ex) { - Utility.sendClientDebug("聊天服务错误 " + ex.getMessage()); - } - - public static WsClient start(String addr) throws URISyntaxException { - WsClient client = new WsClient(new URI(addr)); - client.connect(); - return client; - } - - public void fetchPlayer(String uuid, String name) { - send(new FetchPlayerPacket(uuid, name).toJson()); - } -} \ No newline at end of file diff --git a/shared/java/top/fpsmaster/websocket/data/message/client/LoginPacket.java b/shared/java/top/fpsmaster/websocket/data/message/client/LoginPacket.java deleted file mode 100644 index aba34d0d..00000000 --- a/shared/java/top/fpsmaster/websocket/data/message/client/LoginPacket.java +++ /dev/null @@ -1,18 +0,0 @@ -package top.fpsmaster.websocket.data.message.client; - -import com.google.gson.annotations.SerializedName; -import top.fpsmaster.websocket.data.message.Packet; -import top.fpsmaster.websocket.data.message.PacketType; - -public class LoginPacket extends Packet { - @SerializedName("username") - public String username; - @SerializedName("token") - public String token; - - public LoginPacket(String username, String token) { - super(PacketType.CLIENT_LOGIN); - this.username = username; - this.token = token; - } -} diff --git a/v1.12.2/.gitignore b/v1.12.2/.gitignore deleted file mode 100644 index 69fa48a4..00000000 --- a/v1.12.2/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.idea/ -.vscode/ -run/ -build/ -.gradle/ - diff --git a/v1.12.2/build.gradle.kts b/v1.12.2/build.gradle.kts deleted file mode 100644 index 807acb25..00000000 --- a/v1.12.2/build.gradle.kts +++ /dev/null @@ -1,175 +0,0 @@ -plugins { - idea - java - id("gg.essential.loom") version "0.10.0.+" - id("dev.architectury.architectury-pack200") version "0.1.3" - id("com.github.johnrengelman.shadow") version "8.1.1" - id("com.gorylenko.gradle-git-properties") version "2.2.1" - kotlin("jvm") version "2.0.0-Beta4" -} - -//Constants: -val baseGroup: String by project -val mcVersion: String by project -val version: String by project -val mixinGroup = "$baseGroup.forge.mixin" -val modid: String by project - -// Toolchains: -java { - toolchain.languageVersion.set(JavaLanguageVersion.of(8)) -} - -// Minecraft configuration: -loom { - log4jConfigs.from(file("log4j2.xml")) - launchConfigs { - "client" { - // If you don't want mixins, remove these lines - property("mixin.debug", "true") - property("asmhelper.verbose", "true") - arg("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker") - } - } - forge { - pack200Provider.set(dev.architectury.pack200.java.Pack200Adapter()) - // If you don't want mixins, remove this lines - mixinConfig("mixins.$modid.json") - } - // If you don't want mixins, remove these lines - mixin { - defaultRefmapName.set("mixins.$modid.refmap.json") - } -} - -sourceSets.main { - java.srcDir("../shared/java") - resources.srcDir("../shared/resources") -// output.resourcesDir = file("$buildDir/classes/java/main") -} - -// Dependencies: - -repositories { - mavenCentral() - maven("https://jitpack.io") - maven("https://repo.spongepowered.org/maven/") - // If you don't want to log in with your real minecraft account, remove this line - maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1") -} - -val shadowImpl: Configuration by configurations.creating { - configurations.implementation.get().extendsFrom(this) -} - -dependencies { - minecraft("com.mojang:minecraft:1.12.2") - mappings("de.oceanlabs.mcp:mcp_stable:39-1.12") - forge("net.minecraftforge:forge:1.12.2-14.23.5.2847") // For some reason it cant find a version newer than 2847 - - // If you don't want mixins, remove these lines - shadowImpl("org.spongepowered:mixin:0.7.11-SNAPSHOT") { - isTransitive = false - } - shadowImpl("javazoom:jlayer:1.0.1"){ - isTransitive = false - } - shadowImpl("org.jetbrains.kotlin:kotlin-stdlib-jdk8"){ - isTransitive = true - } - shadowImpl("org.java-websocket:Java-WebSocket:1.5.4"){ - isTransitive = false - } - shadowImpl("org.slf4j:slf4j-api:2.0.6"){ - isTransitive = false - } - shadowImpl("org.json:json:20230227"){ - isTransitive = false - } - annotationProcessor("org.spongepowered:mixin:0.8.5-SNAPSHOT") - implementation("org.yaml:snakeyaml:2.0") - - // If you don't want to log in with your real minecraft account, remove this line -// runtimeOnly("me.djtheredstoner:DevAuth-forge-legacy:1.1.2") - implementation("javazoom:jlayer:1.0.1") -// https://mvnrepository.com/artifact/net.sourceforge.jtransforms/jtransforms - implementation("net.sourceforge.jtransforms:jtransforms:2.4.0") - - implementation(kotlin("stdlib-jdk8")) -} - -gitProperties { - gitPropertiesResourceDir = project.file("src/main/resources") - gitPropertiesDir = project.file("src/main/resources") - gitPropertiesName = "git.properties" - keys = arrayOf("git.branch", "git.commit.id", "git.commit.time", "git.commit.id.abbrev").toMutableList() -} - -// Tasks: - -tasks.withType(JavaCompile::class) { - options.encoding = "UTF-8" -} - -tasks.withType(Jar::class) { - archiveBaseName.set(modid) - manifest.attributes.run { - this["FMLCorePluginContainsFMLMod"] = "true" - this["ForceLoadAsMod"] = "true" - - // If you don't want mixins, remove these lines - this["TweakClass"] = "org.spongepowered.asm.launch.MixinTweaker" - this["MixinConfigs"] = "mixins.$modid.json" - } - duplicatesStrategy = DuplicatesStrategy.EXCLUDE -} - -tasks.processResources { - inputs.property("version", project.version) - inputs.property("mcversion", mcVersion) - inputs.property("modid", modid) - inputs.property("mixinGroup", mixinGroup) - - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - dependsOn(tasks.generateGitProperties) - - filesMatching(listOf("mcmod.info", "mixins.$modid.json")) { - expand(inputs.properties) - } - - rename("(.+_at.cfg)", "META-INF/$1") -} - - -val remapJar by tasks.named("remapJar") { - archiveClassifier.set("") - from(tasks.shadowJar) - input.set(tasks.shadowJar.get().archiveFile) -} - -tasks.jar { - archiveClassifier.set("without-deps") - destinationDirectory.set(layout.buildDirectory.dir("badjars")) -} - -tasks.shadowJar { - destinationDirectory.set(layout.buildDirectory.dir("badjars")) - archiveClassifier.set("all-dev") - configurations = listOf(shadowImpl) - doLast { - configurations.forEach { - println("Copying jars into mod: ${it.files}") - } - } - - // If you want to include other dependencies and shadow them, you can relocate them in here - fun relocate(name: String) = relocate(name, "$baseGroup.deps.$name") -} - -tasks.register("copyDependencies") { - from(configurations.runtimeClasspath.get()) - into("libs") -} - -tasks.assemble.get().dependsOn(tasks.remapJar) - diff --git a/v1.12.2/gradle.properties b/v1.12.2/gradle.properties deleted file mode 100644 index ce370cd8..00000000 --- a/v1.12.2/gradle.properties +++ /dev/null @@ -1,6 +0,0 @@ -loom.platform=forge -org.gradle.jvmargs=-Xmx2g --add-opens java.base/java.io=ALL-UNNAMED -baseGroup = top.fpsmaster -mcVersion = 1.12.2 -modid = fpsmaster -version = v4 diff --git a/v1.12.2/gradle/wrapper/gradle-wrapper.jar b/v1.12.2/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e708b1c0..00000000 Binary files a/v1.12.2/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/v1.12.2/gradle/wrapper/gradle-wrapper.properties b/v1.12.2/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 019ef3e9..00000000 --- a/v1.12.2/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=top.fpsmaster.wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=top.fpsmaster.wrapper/dists diff --git a/v1.12.2/gradlew b/v1.12.2/gradlew deleted file mode 100644 index 4f906e0c..00000000 --- a/v1.12.2/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/env sh - -# -# Copyright 2015 the original author or authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -exec "$JAVACMD" "$@" diff --git a/v1.12.2/gradlew.bat b/v1.12.2/gradlew.bat deleted file mode 100644 index e64af50d..00000000 --- a/v1.12.2/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\top.fpsmaster.forge\gradle-top.fpsmaster.forge.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.top.fpsmaster.forge.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/v1.12.2/log4j2.xml b/v1.12.2/log4j2.xml deleted file mode 100644 index af9b1b76..00000000 --- a/v1.12.2/log4j2.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/v1.12.2/settings.gradle.kts b/v1.12.2/settings.gradle.kts deleted file mode 100644 index 477e953b..00000000 --- a/v1.12.2/settings.gradle.kts +++ /dev/null @@ -1,26 +0,0 @@ -pluginManagement { - repositories { - mavenCentral() - gradlePluginPortal() - maven("https://oss.sonatype.org/content/repositories/snapshots") - maven("https://maven.architectury.dev/") - maven("https://maven.fabricmc.net") - maven("https://maven.minecraftforge.net/") - maven("https://repo.spongepowered.org/maven/") - maven("https://repo.sk1er.club/repository/maven-releases/") - } - resolutionStrategy { - eachPlugin { - when (requested.id.id) { - "gg.essential.loom" -> useModule("gg.essential:architectury-loom:${requested.version}") - } - } - } -} - -plugins { - id("org.gradle.toolchains.foojay-resolver-convention") version("0.6.0") -} - - -rootProject.name = "v1.12.2" diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/ForgeEventAPI.java b/v1.12.2/src/main/java/top/fpsmaster/forge/ForgeEventAPI.java deleted file mode 100644 index 381a5ed8..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/ForgeEventAPI.java +++ /dev/null @@ -1,15 +0,0 @@ -package top.fpsmaster.forge; - -import net.minecraftforge.event.entity.player.AttackEntityEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import top.fpsmaster.event.EventDispatcher; -import top.fpsmaster.event.events.EventAttack; - -public class ForgeEventAPI { - - @SubscribeEvent - public void onAttack(AttackEntityEvent e){ - EventDispatcher.dispatchEvent(new EventAttack(e.getTarget())); - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/Mod.java b/v1.12.2/src/main/java/top/fpsmaster/forge/Mod.java deleted file mode 100644 index 5d4c6465..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/Mod.java +++ /dev/null @@ -1,14 +0,0 @@ -package top.fpsmaster.forge; - -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import top.fpsmaster.FPSMaster; - -@net.minecraftforge.fml.common.Mod(modid = "fpsmaster", useMetadata=true) -public class Mod { - @net.minecraftforge.fml.common.Mod.EventHandler - public void init(FMLInitializationEvent event) { - MinecraftForge.EVENT_BUS.register(new ForgeEventAPI()); - FPSMaster.INSTANCE.initialize(); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/api/IChatLine.java b/v1.12.2/src/main/java/top/fpsmaster/forge/api/IChatLine.java deleted file mode 100644 index e0d32b13..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/api/IChatLine.java +++ /dev/null @@ -1,6 +0,0 @@ -package top.fpsmaster.forge.api; - -public interface IChatLine { - void setAnimation(float a); - float getAnimation(); -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/api/IKeyBinding.java b/v1.12.2/src/main/java/top/fpsmaster/forge/api/IKeyBinding.java deleted file mode 100644 index bebb63fc..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/api/IKeyBinding.java +++ /dev/null @@ -1,5 +0,0 @@ -package top.fpsmaster.forge.api; - -public interface IKeyBinding { - void setPressed(boolean pressed); -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/api/IMinecraft.java b/v1.12.2/src/main/java/top/fpsmaster/forge/api/IMinecraft.java deleted file mode 100644 index 41ab2390..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/api/IMinecraft.java +++ /dev/null @@ -1,13 +0,0 @@ -package top.fpsmaster.forge.api; - -import net.minecraft.util.Session; -import net.minecraft.util.Timer; - -public interface IMinecraft { - Timer arch$getTimer(); - Session arch$getSession(); - void arch$setSession(Session session); - - void arch$setLeftClickCounter(int c); - void arch$setRightClickDelayTimer(int c); -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/api/INetworkPlayerInfo.java b/v1.12.2/src/main/java/top/fpsmaster/forge/api/INetworkPlayerInfo.java deleted file mode 100644 index 064caacf..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/api/INetworkPlayerInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package top.fpsmaster.forge.api; - -import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import net.minecraft.util.ResourceLocation; - -import java.util.Map; - -public interface INetworkPlayerInfo { - Map getTextures(); - String getType(); - void setTextures(Map skin); - void setType(String skinType); -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/api/IRenderManager.java b/v1.12.2/src/main/java/top/fpsmaster/forge/api/IRenderManager.java deleted file mode 100644 index 29ca6cf0..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/api/IRenderManager.java +++ /dev/null @@ -1,7 +0,0 @@ -package top.fpsmaster.forge.api; - -public interface IRenderManager { - double renderPosX(); - double renderPosY(); - double renderPosZ(); -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/api/IShaderGroup.java b/v1.12.2/src/main/java/top/fpsmaster/forge/api/IShaderGroup.java deleted file mode 100644 index 422e0321..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/api/IShaderGroup.java +++ /dev/null @@ -1,14 +0,0 @@ -package top.fpsmaster.forge.api; - -import com.google.common.collect.Lists; -import net.minecraft.client.shader.Shader; - -import java.util.List; - -public interface IShaderGroup { - - void loadShaderGroup(float partialTicks); - - List getListShaders(); - void load(float partialTicks); -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinAbstractClientPlayer.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinAbstractClientPlayer.java deleted file mode 100644 index 9f76a258..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinAbstractClientPlayer.java +++ /dev/null @@ -1,92 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.IAttributeInstance; -import net.minecraft.init.Items; -import net.minecraft.item.ItemBow; -import net.minecraft.util.ResourceLocation; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import top.fpsmaster.event.EventDispatcher; -import top.fpsmaster.event.events.EventCapeLoading; -import top.fpsmaster.features.impl.optimizes.SmoothZoom; -import top.fpsmaster.features.impl.utility.CustomFOV; -import top.fpsmaster.utils.math.MathUtils; - -import javax.annotation.Nullable; - -@Mixin(AbstractClientPlayer.class) -public abstract class MixinAbstractClientPlayer extends MixinEntityPlayer { - private ResourceLocation fpsmasterCape; - - - @Inject(method = "getFovModifier", at = @At("HEAD"), cancellable = true) - public void customFov(CallbackInfoReturnable cir) { - float f = 1.0F; - if (CustomFOV.using) { - if ((!CustomFOV.noFlyFov.getValue())) { - if (capabilities.isFlying) { - f *= 1.1F; - } - } - - if ((!CustomFOV.noSpeedFov.getValue())) { - IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); - f = (float) ((double) f * ((iattributeinstance.getAttributeValue() / (double) this.capabilities.getWalkSpeed() + 1.0D) / 2.0D)); - } - - if (this.capabilities.getWalkSpeed() == 0.0F || Float.isNaN(f) || Float.isInfinite(f)) { - f = 1.0F; - } - - if (this.isHandActive() && this.getActiveItemStack().getItem() == Items.BOW && (!CustomFOV.using || !CustomFOV.noBowFov.getValue())) { - int i = this.getItemInUseMaxCount(); - float f1 = (float) i / 20.0F; - - if (f1 > 1.0F) { - f1 = 1.0F; - } else { - f1 = f1 * f1; - } - - f *= 1.0F - f1 * 0.15F; - } - cir.setReturnValue(f); - } - } - - @Shadow - protected abstract NetworkPlayerInfo getPlayerInfo(); - - @Shadow - private NetworkPlayerInfo playerInfo; - - - /** - * @author SuperSkidder - * @reason CapeLoading - */ - @Overwrite - public ResourceLocation getLocationCape() { - EventCapeLoading event = new EventCapeLoading(playerInfo.getGameProfile().getName(), (AbstractClientPlayer) (Object) this); - EventDispatcher.dispatchEvent(event); - fpsmasterCape = event.getCape(); - - if (fpsmasterCape != null) { - return fpsmasterCape; - } - - - NetworkPlayerInfo networkplayerinfo = this.getPlayerInfo(); - return networkplayerinfo == null ? null : networkplayerinfo.getLocationCape(); - - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinChatLine.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinChatLine.java deleted file mode 100644 index d9875246..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinChatLine.java +++ /dev/null @@ -1,23 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.gui.ChatLine; -import org.spongepowered.asm.mixin.Implements; -import org.spongepowered.asm.mixin.Interface; -import org.spongepowered.asm.mixin.Mixin; -import top.fpsmaster.forge.api.IChatLine; - -@Mixin(ChatLine.class) -@Implements(@Interface(iface = IChatLine.class, prefix = "chatline$")) -public class MixinChatLine implements IChatLine{ - - float animation; - @Override - public void setAnimation(float a) { - animation = a; - } - - @Override - public float getAnimation() { - return animation; - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinEntityLivingBase.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinEntityLivingBase.java deleted file mode 100644 index 4728c9ed..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinEntityLivingBase.java +++ /dev/null @@ -1,23 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.ai.attributes.IAttribute; -import net.minecraft.entity.ai.attributes.IAttributeInstance; -import net.minecraft.item.ItemStack; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -@Mixin(EntityLivingBase.class) -public abstract class MixinEntityLivingBase { - @Shadow - public abstract IAttributeInstance getEntityAttribute(IAttribute attribute); - - @Shadow - public abstract boolean isHandActive(); - - @Shadow - public abstract ItemStack getActiveItemStack(); - - @Shadow - public abstract int getItemInUseMaxCount(); -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinEntityPlayer.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinEntityPlayer.java deleted file mode 100644 index 0061578f..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinEntityPlayer.java +++ /dev/null @@ -1,13 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.PlayerCapabilities; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; - -@Mixin(EntityPlayer.class) -public abstract class MixinEntityPlayer extends MixinEntityLivingBase{ - @Shadow - public PlayerCapabilities capabilities; - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinEntityPlayerSP.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinEntityPlayerSP.java deleted file mode 100644 index 1f7047cd..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinEntityPlayerSP.java +++ /dev/null @@ -1,17 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.entity.EntityPlayerSP; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.fpsmaster.event.EventDispatcher; -import top.fpsmaster.event.events.EventUpdate; - -@Mixin(EntityPlayerSP.class) -public class MixinEntityPlayerSP { - @Inject(method = "onLivingUpdate",at=@At("HEAD")) - public void onUpdate(CallbackInfo ci){ - EventDispatcher.dispatchEvent(new EventUpdate()); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinEntityRenderer.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinEntityRenderer.java deleted file mode 100644 index 815b2e08..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinEntityRenderer.java +++ /dev/null @@ -1,283 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.renderer.EntityRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; -import net.minecraft.client.shader.ShaderGroup; -import net.minecraft.crash.CrashReport; -import net.minecraft.crash.CrashReportCategory; -import net.minecraft.crash.ICrashReportDetail; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.passive.EntityAnimal; -import net.minecraft.util.ReportedException; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; -import net.minecraftforge.client.ForgeHooksClient; -import net.minecraftforge.client.event.EntityViewRenderEvent; -import net.minecraftforge.common.MinecraftForge; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.Display; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; -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.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import top.fpsmaster.event.EventDispatcher; -import top.fpsmaster.event.events.EventRender3D; -import top.fpsmaster.features.impl.optimizes.NoHurtCam; -import top.fpsmaster.features.impl.optimizes.OldAnimations; -import top.fpsmaster.features.impl.optimizes.SmoothZoom; -import top.fpsmaster.features.impl.render.FreeLook; -import top.fpsmaster.features.impl.render.MinimizedBobbing; -import top.fpsmaster.utils.math.MathUtils; - -import static top.fpsmaster.utils.Utility.mc; - -@Mixin(EntityRenderer.class) -public abstract class MixinEntityRenderer { - - @Shadow - private float thirdPersonDistancePrev = 4.0F; - - @Shadow - private boolean cloudFog; - @Shadow - private boolean debugView = false; - - @Shadow - private float fovModifierHand; - @Shadow - private float fovModifierHandPrev; - private float screenScale = -1; - - @Inject(method = "getFOVModifier", at = @At("HEAD"), cancellable = true) - private void getFOVModifier(float partialTicks, boolean useFOVSetting, CallbackInfoReturnable cir) { - if (SmoothZoom.using) { - if (this.debugView) { - cir.setReturnValue(90.0F); - } else { - Entity entity = mc.getRenderViewEntity(); - float f = 70.0F; - if (useFOVSetting) { - f = mc.gameSettings.fovSetting; - f *= this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks; - } - - if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).getHealth() <= 0.0F) { - float f1 = (float) ((EntityLivingBase) entity).deathTime + partialTicks; - f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F; - } - - IBlockState iblockstate = ActiveRenderInfo.getBlockStateAtEntityViewpoint(mc.world, entity, partialTicks); - if (iblockstate.getMaterial() == Material.WATER) { - f = f * 60.0F / 70.0F; - } - if (screenScale == -1) - screenScale = f; - - if (SmoothZoom.using && SmoothZoom.zoom) { - if (SmoothZoom.smoothCamera.getValue()) { - screenScale = MathUtils.decreasedSpeed(screenScale, f, f / 4.0F, SmoothZoom.speed.getValue().floatValue() / (float) Minecraft.getDebugFPS() * 150.0f); - } else { - screenScale = f / 4.0F; - } - } else { - screenScale = f; - } - cir.setReturnValue(ForgeHooksClient.getFOVModifier((EntityRenderer) (Object) this, entity, iblockstate, partialTicks, screenScale)); - } - } - } - - - @Inject(method = "renderWorldPass", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/EntityRenderer;renderHand:Z", shift = At.Shift.BEFORE)) - private void renderWorldPass(int pass, float partialTicks, long finishTimeNano, CallbackInfo callbackInfo) { - EventDispatcher.dispatchEvent(new EventRender3D(partialTicks)); - } - - @Inject(method = "applyBobbing", at = @At("HEAD"), cancellable = true) - public void bobbing(float partialTicks, CallbackInfo ci) { - if (MinimizedBobbing.using) - ci.cancel(); - } - - @Inject(method = "hurtCameraEffect", at = @At("HEAD"), cancellable = true) - public void hurtCameraEffect(float amount, CallbackInfo ci) { - if (NoHurtCam.using) - ci.cancel(); - } - @Unique - private float partialTicks; - - - @Redirect(method = "renderWor", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getEyeHeight()F")) - public float modifyEyeHeight_renderWorldDirections(Entity entity) { - if (mc.getRenderViewEntity() != mc.player) return entity.getEyeHeight(); - return OldAnimations.Companion.getClientEyeHeight(partialTicks); - } - - /** - * @author SuperSkidder - * @reason Free Look - */ - @Overwrite - private void orientCamera(float partialTicks) { - Entity entity = mc.getRenderViewEntity(); - - this.partialTicks = partialTicks; - float f = entity.getEyeHeight(); - if (mc.getRenderViewEntity() == mc.player){ - f = OldAnimations.Companion.getClientEyeHeight(partialTicks); - } - double d0 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double) partialTicks; - double d1 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double) partialTicks + (double) f; - double d2 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double) partialTicks; - float f1; - if (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isPlayerSleeping()) { - f = (float) ((double) f + 1.0); - GlStateManager.translate(0.0F, 0.3F, 0.0F); - if (!mc.gameSettings.debugCamEnable) { - BlockPos blockpos = new BlockPos(entity); - IBlockState iblockstate = mc.world.getBlockState(blockpos); - ForgeHooksClient.orientBedCamera(mc.world, blockpos, iblockstate, entity); - if (FreeLook.using) { - GlStateManager.rotate(FreeLook.getCameraPrevYaw() + (FreeLook.getCameraYaw() - FreeLook.getCameraPrevYaw()) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); - GlStateManager.rotate(FreeLook.getCameraPrevPitch() + (FreeLook.getCameraPitch() - FreeLook.getCameraPrevPitch()) * partialTicks, -1.0F, 0.0F, 0.0F); - } else { - GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F, 0.0F, -1.0F, 0.0F); - GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, -1.0F, 0.0F, 0.0F); - } - } - } else if (mc.gameSettings.thirdPersonView > 0) { - double d3 = this.thirdPersonDistancePrev + (4.0F - this.thirdPersonDistancePrev) * partialTicks; - if (mc.gameSettings.debugCamEnable) { - GlStateManager.translate(0.0F, 0.0F, (float) (-d3)); - } else { - f1 = entity.rotationYaw; - float f2 = entity.rotationPitch; - if (mc.gameSettings.thirdPersonView == 2) { - f2 += 180.0F; - } - - double d4 = (double) (-MathHelper.sin(f1 * 0.017453292F) * MathHelper.cos(f2 * 0.017453292F)) * d3; - double d5 = (double) (MathHelper.cos(f1 * 0.017453292F) * MathHelper.cos(f2 * 0.017453292F)) * d3; - double d6 = (double) (-MathHelper.sin(f2 * 0.017453292F)) * d3; - - for (int i = 0; i < 8; ++i) { - float f3 = (float) ((i & 1) * 2 - 1); - float f4 = (float) ((i >> 1 & 1) * 2 - 1); - float f5 = (float) ((i >> 2 & 1) * 2 - 1); - f3 *= 0.1F; - f4 *= 0.1F; - f5 *= 0.1F; - RayTraceResult raytraceresult = mc.world.rayTraceBlocks(new Vec3d(d0 + (double) f3, d1 + (double) f4, d2 + (double) f5), new Vec3d(d0 - d4 + (double) f3 + (double) f5, d1 - d6 + (double) f4, d2 - d5 + (double) f5)); - if (raytraceresult != null) { - double d7 = raytraceresult.hitVec.distanceTo(new Vec3d(d0, d1, d2)); - if (d7 < d3) { - d3 = d7; - } - } - } - - if (mc.gameSettings.thirdPersonView == 2) { - GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); - } - - GlStateManager.rotate(entity.rotationPitch - f2, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(entity.rotationYaw - f1, 0.0F, 1.0F, 0.0F); - GlStateManager.translate(0.0F, 0.0F, (float) (-d3)); - GlStateManager.rotate(f1 - entity.rotationYaw, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(f2 - entity.rotationPitch, 1.0F, 0.0F, 0.0F); - } - } else { - GlStateManager.translate(0.0F, 0.0F, 0.05F); - } - - if (!mc.gameSettings.debugCamEnable) { - float yaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks + 180.0F; - float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks; - - if (FreeLook.using) { - yaw = FreeLook.getCameraPrevYaw() + (FreeLook.getCameraYaw() - FreeLook.getCameraPrevYaw()) * partialTicks + 180.0F; - pitch = FreeLook.getCameraPrevPitch() + (FreeLook.getCameraPitch() - FreeLook.getCameraPrevPitch()) * partialTicks; - } - f1 = 0.0F; - if (entity instanceof EntityAnimal) { - EntityAnimal entityanimal = (EntityAnimal) entity; - yaw = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * partialTicks + 180.0F; - } - - IBlockState state = ActiveRenderInfo.getBlockStateAtEntityViewpoint(mc.world, entity, partialTicks); - EntityViewRenderEvent.CameraSetup event = new EntityViewRenderEvent.CameraSetup((EntityRenderer) ((Object) this), entity, state, partialTicks, yaw, pitch, f1); - MinecraftForge.EVENT_BUS.post(event); - GlStateManager.rotate(event.getRoll(), 0.0F, 0.0F, 1.0F); - GlStateManager.rotate(event.getPitch(), 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(event.getYaw(), 0.0F, 1.0F, 0.0F); - } - - GlStateManager.translate(0.0F, -f, 0.0F); - d0 = entity.prevPosX + (entity.posX - entity.prevPosX) * (double) partialTicks; - d1 = entity.prevPosY + (entity.posY - entity.prevPosY) * (double) partialTicks + (double) f; - d2 = entity.prevPosZ + (entity.posZ - entity.prevPosZ) * (double) partialTicks; - this.cloudFog = mc.renderGlobal.hasCloudFog(d0, d1, d2, partialTicks); - } - - @Shadow - private long prevFrameTime = Minecraft.getSystemTime(); - - @Shadow - private float smoothCamYaw; - @Shadow - private float smoothCamPitch; - @Shadow - private float smoothCamFilterX; - @Shadow - private float smoothCamFilterY; - @Shadow - private float smoothCamPartialTicks; - @Shadow - public static boolean anaglyphEnable; - - @Shadow - public abstract void setupOverlayRendering(); - - @Shadow - private long renderEndNanoTime; - - @Shadow - public abstract void renderWorld(float partialTicks, long finishTimeNano); - - @Shadow - private long timeWorldIcon; - - @Shadow - protected abstract void createWorldIcon(); - - @Shadow - private ShaderGroup shaderGroup; - @Shadow - private boolean useShader; - - @Shadow - protected abstract void renderItemActivation(int p_190563_1_, int p_190563_2_, float p_190563_3_); - - @Inject(method = "updateCameraAndRender", at = @At(value = "HEAD")) - public void freelook(float partialTicks, long nanoTime, CallbackInfo ci) { - FreeLook.overrideMouse(); - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinFontRender.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinFontRender.java deleted file mode 100644 index 9e1f6872..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinFontRender.java +++ /dev/null @@ -1,84 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; -import top.fpsmaster.modules.client.GlobalTextFilter; -import top.fpsmaster.features.impl.utility.NameProtect; - -@Mixin(FontRenderer.class) -public abstract class MixinFontRender { - @Shadow - protected abstract void resetStyles(); - - @Shadow - protected abstract int renderString(String text, float x, float y, int color, boolean dropShadow); - - - - /** - * @author SuperSkidder - * @reason NameProtect - */ - @Overwrite - public int drawString(String text, float x, float y, int color, boolean dropShadow) { - text = GlobalTextFilter.filter(text); - GlStateManager.enableAlpha(); - this.resetStyles(); - int i; - if (dropShadow) { - i = this.renderString(text, x + 1.0F, y + 1.0F, color, true); - i = Math.max(i, this.renderString(text, x, y, color, false)); - } else { - i = this.renderString(text, x, y, color, false); - } - - return i; - } - - - @Shadow - public abstract int getCharWidth(char character); - - /** - * @author SuperSkidder - * @reason NameProtect - */ - @Overwrite - public int getStringWidth(String text) { - text = GlobalTextFilter.filter(text); - if (text == null) { - return 0; - } else { - int i = 0; - boolean flag = false; - - for(int j = 0; j < text.length(); ++j) { - char c0 = text.charAt(j); - int k = this.getCharWidth(c0); - if (k < 0 && j < text.length() - 1) { - ++j; - c0 = text.charAt(j); - if (c0 != 'l' && c0 != 'L') { - if (c0 == 'r' || c0 == 'R') { - flag = false; - } - } else { - flag = true; - } - - k = 0; - } - - i += k; - if (flag && k > 0) { - ++i; - } - } - - return i; - } - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiContainer.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiContainer.java deleted file mode 100644 index dc7d52b0..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiContainer.java +++ /dev/null @@ -1,32 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.util.ResourceLocation; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.fpsmaster.utils.render.Render2DUtils; - -@Mixin(GuiContainer.class) -public class MixinGuiContainer { - - @Shadow - protected int xSize = 176; - @Shadow - protected int ySize = 166; - @Shadow - protected int guiLeft; - @Shadow - protected int guiTop; - - @Inject(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;drawGuiContainerBackgroundLayer(FII)V")) - public void logo(int mouseX, int mouseY, float partialTicks, CallbackInfo ci){ - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - Render2DUtils.drawImage(new ResourceLocation("client/gui/settings/logo.png"), 0, sr.getScaledHeight() - 32, 163 / 2f, 32, -1); - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiIngame.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiIngame.java deleted file mode 100644 index 83664c42..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiIngame.java +++ /dev/null @@ -1,35 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.gui.GuiIngame; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.scoreboard.ScoreObjective; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.fpsmaster.event.EventDispatcher; -import top.fpsmaster.event.events.EventMotionBlur; -import top.fpsmaster.event.events.EventRender2D; -import top.fpsmaster.features.impl.interfaces.Scoreboard; -import top.fpsmaster.features.impl.render.Crosshair; - -@Mixin(GuiIngame.class) -public class MixinGuiIngame { - @Inject(method = "renderHotbar", at = @At("RETURN")) - private void renderTooltipPost(ScaledResolution sr, float partialTicks, CallbackInfo callbackInfo) { - EventDispatcher.dispatchEvent(new EventRender2D(partialTicks)); - } - - @Inject(method = "renderAttackIndicator", at = @At("HEAD"), cancellable = true) - protected void renderAttackIndicator(float partialTicks, ScaledResolution p_184045_2_, CallbackInfo ci) { - if (Crosshair.using) - ci.cancel(); - } - - - @Inject(method = "renderScoreboard", at = @At("HEAD"), cancellable = true) - public void scoreboard(ScoreObjective objective, ScaledResolution scaledRes, CallbackInfo ci) { - if (Scoreboard.using) - ci.cancel(); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiIngameForge.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiIngameForge.java deleted file mode 100644 index cce12bf8..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiIngameForge.java +++ /dev/null @@ -1,17 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraftforge.client.GuiIngameForge; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.fpsmaster.event.EventDispatcher; -import top.fpsmaster.event.events.EventMotionBlur; - -@Mixin(GuiIngameForge.class) -public class MixinGuiIngameForge { - @Inject(method = "renderGameOverlay",at = @At("RETURN")) - public void motionblur(float partialTicks, CallbackInfo ci){ - EventDispatcher.dispatchEvent(new EventMotionBlur()); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiNewChat.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiNewChat.java deleted file mode 100644 index 22d937e1..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiNewChat.java +++ /dev/null @@ -1,273 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import com.google.common.collect.Lists; -import net.minecraft.client.gui.*; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentString; -import org.spongepowered.asm.mixin.*; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.forge.api.IChatLine; -import top.fpsmaster.features.impl.interfaces.BetterChat; -import top.fpsmaster.utils.math.animation.AnimationUtils; -import top.fpsmaster.utils.render.Render2DUtils; - -import java.awt.*; -import java.util.Iterator; -import java.util.List; - -import static top.fpsmaster.utils.Utility.mc; - -@Mixin(GuiNewChat.class) -public abstract class MixinGuiNewChat { - - private boolean isChatOpenAnimationNeed = true; - - @Shadow - public abstract int getLineCount(); - - @Final - @Shadow - private List drawnChatLines = Lists.newArrayList(); - - - @Shadow - public abstract boolean getChatOpen(); - - @Shadow - public abstract float getChatScale(); - - @Shadow - public abstract int getChatWidth(); - - @Shadow - private int scrollPos; - - @Shadow - private boolean isScrolled; - - /** - * @author SuperSkidder - * @reason betterchat - */ - @Overwrite - public void drawChat(int updateCounter) { - if (mc.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN) { - if (!BetterChat.using) { - int i = this.getLineCount(); - int j = this.drawnChatLines.size(); - float f = mc.gameSettings.chatOpacity * 0.9F + 0.1F; - if (j > 0) { - boolean bl = this.getChatOpen(); - - float g = this.getChatScale(); - int k = MathHelper.ceil((float) this.getChatWidth() / g); - GlStateManager.pushMatrix(); - GlStateManager.translate(2.0F, 8.0F, 0.0F); - GlStateManager.scale(g, g, 1.0F); - int l = 0; - - int m; - int n; - int o; - for (m = 0; m + this.scrollPos < this.drawnChatLines.size() && m < i; ++m) { - ChatLine chatLine = this.drawnChatLines.get(m + this.scrollPos); - if (chatLine != null) { - n = updateCounter - chatLine.getUpdatedCounter(); - if (n < 200 || bl) { - double d = (double) n / 200.0; - d = 1.0 - d; - d *= 10.0; - d = MathHelper.clamp(d, 0.0, 1.0); - d *= d; - o = (int) (255.0 * d); - if (bl) { - o = 255; - } - - o = (int) ((float) o * f); - ++l; - if (o > 3) { - int q = -m * 9; - Gui.drawRect(-2, q - 9, k + 4, q, o / 2 << 24); - String string = chatLine.getChatComponent().getFormattedText(); - GlStateManager.enableBlend(); - mc.fontRenderer.drawStringWithShadow(string, 0.0F, (float) (q - 8), 16777215 + (o << 24)); - GlStateManager.disableAlpha(); - GlStateManager.disableBlend(); - } - } - } - } - - if (bl) { - m = mc.fontRenderer.FONT_HEIGHT; - GlStateManager.translate(-3.0F, 0.0F, 0.0F); - int r = j * m + j; - n = l * m + l; - int s = this.scrollPos * n / j; - int t = n * n / r; - if (r != n) { - o = s > 0 ? 170 : 96; - int p = this.isScrolled ? 13382451 : 3355562; - Gui.drawRect(0, -s, 2, -s - t, p + (o << 24)); - Gui.drawRect(2, -s, 1, -s - t, 13421772 + (o << 24)); - } - } - - GlStateManager.popMatrix(); - } - } else { - BetterChat module = (BetterChat) FPSMaster.moduleManager.getModule(BetterChat.class); - int i = this.getLineCount(); - int j = this.drawnChatLines.size(); - float f = mc.gameSettings.chatOpacity * 0.9F + 0.1F; - if (j > 0) { - boolean bl = this.getChatOpen(); - - float g = this.getChatScale(); - int k = MathHelper.ceil((float) this.getChatWidth() / g); - GlStateManager.pushMatrix(); - GlStateManager.translate(2.0F, 8.0F, 0.0F); - GlStateManager.scale(g, g, 1.0F); - int l = 0; - - int m; - int n; - int o; - for (m = 0; m + this.scrollPos < this.drawnChatLines.size() && m < i; ++m) { - ChatLine chatLine = this.drawnChatLines.get(m + this.scrollPos); - if (chatLine != null) { - if (getChatOpen() && isChatOpenAnimationNeed) { - for (int i1 = 0; i1 + this.scrollPos < this.drawnChatLines.size() && i1 < i; ++i1) { - ChatLine chatline = this.drawnChatLines.get(i1 + this.scrollPos); - ((IChatLine) chatline).setAnimation(100); - } - isChatOpenAnimationNeed = false; - } - if (!getChatOpen()) { - isChatOpenAnimationNeed = true; - } - - n = updateCounter - chatLine.getUpdatedCounter(); - if (n < 200 || bl) { - if (n < 150 || getChatOpen()) { - ((IChatLine) chatLine).setAnimation((float) AnimationUtils.base(((IChatLine) chatLine).getAnimation(), 255, 0.1f)); - } else { - ((IChatLine) chatLine).setAnimation((float) AnimationUtils.base(((IChatLine) chatLine).getAnimation(), 0, 0.1f)); - } - int alpha = (int) (((IChatLine) chatLine).getAnimation() * f); - - if (alpha > 3) { - int q = -m * 9; - int alpha1 = (int) ((alpha / 255f) * module.backgroundColor.getColor().getAlpha()); - if (module.bg.getValue()) - Gui.drawRect(-2, q - 9, k + 4, q, Render2DUtils.reAlpha(module.backgroundColor.getColor(), alpha1).getRGB()); - String string = chatLine.getChatComponent().getFormattedText(); - GlStateManager.enableBlend(); - if (module.betterFont.getValue()) { - if (module.fontShadow.getValue()) - FPSMaster.fontManager.s16.drawStringWithShadow(string, 0.0F, (float) (q - 8) + (6 - (alpha / 255f) * 6), Render2DUtils.reAlpha(new Color(16777215), alpha).getRGB()); - else - FPSMaster.fontManager.s16.drawString(string, 0.0F, (float) (q - 8) + (6 - (alpha / 255f) * 6), Render2DUtils.reAlpha(new Color(16777215), alpha).getRGB()); - } else { - mc.fontRenderer.drawStringWithShadow(string, 0.0F, (float) (q - 8) + (6 - (alpha / 255f) * 6), Render2DUtils.reAlpha(new Color(16777215), alpha).getRGB()); - } - GlStateManager.disableAlpha(); - GlStateManager.disableBlend(); - } - } - } - } - - if (bl) { - m = mc.fontRenderer.FONT_HEIGHT; - GlStateManager.translate(-3.0F, 0.0F, 0.0F); - int r = j * m + j; - n = l * m + l; - int s = this.scrollPos * n / j; - int t = n * n / r; - if (r != n) { - o = s > 0 ? 170 : 96; - int p = this.isScrolled ? 13382451 : 3355562; - Gui.drawRect(0, -s, 2, -s - t, module.backgroundColor.getColor().getRGB()); - Gui.drawRect(2, -s, 1, -s - t, module.backgroundColor.getColor().getRGB()); - } - } - - GlStateManager.popMatrix(); - } - } - } - } - - /** - * @author SuperSkidder - * @reason handle click - */ - @Overwrite - public ITextComponent getChatComponent(int mouseX, int mouseY) { - if (!this.getChatOpen()) { - return null; - } else { - ScaledResolution scaledResolution = new ScaledResolution(mc); - int i = scaledResolution.getScaleFactor(); - float f = this.getChatScale(); - int j = mouseX / i - 2; - int k = mouseY / i - 40; - j = MathHelper.floor((float) j / f); - k = MathHelper.floor((float) k / f); - if (j >= 0 && k >= 0) { - BetterChat module = (BetterChat) FPSMaster.moduleManager.getModule(BetterChat.class); - int l = Math.min(this.getLineCount(), this.drawnChatLines.size()); - int fontHeight = mc.fontRenderer.FONT_HEIGHT; - if (BetterChat.using && module.betterFont.getValue()) { - fontHeight = FPSMaster.fontManager.s16.getHeight(); - } - if (j <= MathHelper.floor((float) this.getChatWidth() / this.getChatScale()) && k < fontHeight * l + l) { - int m = k / fontHeight + this.scrollPos; - if (m >= 0 && m < this.drawnChatLines.size()) { - ChatLine chatLine = this.drawnChatLines.get(m); - int n = 0; - Iterator var12 = chatLine.getChatComponent().iterator(); - - while (var12.hasNext()) { - ITextComponent iTextComponent = (ITextComponent) var12.next(); - if (iTextComponent instanceof TextComponentString) { - if (BetterChat.using && module.betterFont.getValue()) { - n += FPSMaster.fontManager.s16.getStringWidth(GuiUtilRenderComponents.removeTextColorsIfConfigured(((TextComponentString) iTextComponent).getText(), false)); - } else { - n += mc.fontRenderer.getStringWidth(GuiUtilRenderComponents.removeTextColorsIfConfigured(((TextComponentString) iTextComponent).getText(), false)); - } - if (n > j) { - return iTextComponent; - } - } - } - } - - return null; - } else { - return null; - } - } else { - return null; - } - } - } - - @Redirect(method = "setChatLine", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiUtilRenderComponents;splitText(Lnet/minecraft/util/text/ITextComponent;ILnet/minecraft/client/gui/FontRenderer;ZZ)Ljava/util/List;")) - public List spilt(ITextComponent chatComponent, int i, FontRenderer fontRenderer, boolean b, boolean b1) { - BetterChat module = (BetterChat) FPSMaster.moduleManager.getModule(BetterChat.class); - - if (BetterChat.using && module.betterFont.getValue()) { - return GuiUtilRenderComponents.splitText(chatComponent, i, FPSMaster.fontManager.s16, false, false); - } else { - return GuiUtilRenderComponents.splitText(chatComponent, i, mc.fontRenderer, false, false); - } - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiPlayerOverlay.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiPlayerOverlay.java deleted file mode 100644 index 99daf4fe..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiPlayerOverlay.java +++ /dev/null @@ -1,54 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import com.google.common.collect.Ordering; -import com.mojang.authlib.GameProfile; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiPlayerTabOverlay; -import net.minecraft.client.network.NetHandlerPlayClient; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EnumPlayerModelParts; -import net.minecraft.scoreboard.IScoreCriteria; -import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.scoreboard.Scoreboard; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.GameType; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.modules.client.PlayerManager; -import top.fpsmaster.utils.render.Render2DUtils; - -import javax.annotation.Nullable; -import java.util.Iterator; -import java.util.List; - -@Mixin(GuiPlayerTabOverlay.class) -public abstract class MixinGuiPlayerOverlay { - - @Final - @Shadow - private static Ordering ENTRY_ORDERING; - - @Shadow - public abstract String getPlayerName(NetworkPlayerInfo networkPlayerInfoIn); - - @Shadow - private ITextComponent header; - - @Shadow - private ITextComponent footer; - - @Shadow - protected abstract void drawScoreboardValues(ScoreObjective objective, int i, String name, int j, int k, NetworkPlayerInfo info); - - @Shadow - protected abstract void drawPing(int i, int j, int k, NetworkPlayerInfo networkPlayerInfoIn); - - } diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiScreen.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiScreen.java deleted file mode 100644 index d7f3e5da..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinGuiScreen.java +++ /dev/null @@ -1,69 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; -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; -import top.fpsmaster.event.EventDispatcher; -import top.fpsmaster.event.events.EventSendChatMessage; -import top.fpsmaster.features.impl.interfaces.BetterScreen; -import top.fpsmaster.api.ProviderManager; -import top.fpsmaster.utils.math.animation.AnimationUtils; -import top.fpsmaster.utils.render.Render2DUtils; - -import java.util.List; - -@Mixin(GuiScreen.class) -public abstract class MixinGuiScreen extends Gui { - @Shadow - protected List buttonList; - - - @Shadow public int width; - @Shadow public int height; - - @Shadow public abstract void drawBackground(int tint); - - @Unique - float arch$alpha = 0; - - /** - * @author SuperSkidder - * @reason 自定义背景 - */ - @Overwrite - public void drawWorldBackground(int tint) { - if (ProviderManager.mcProvider.getWorld() != null) { - if (BetterScreen.using) { - if (BetterScreen.useBG.getValue()) { - if (BetterScreen.backgroundAnimation.getValue()) { - arch$alpha = (float) AnimationUtils.base(arch$alpha, 170, 0.2f); - } else { - arch$alpha = 170; - } - this.drawGradientRect(0, 0, this.width, this.height, Render2DUtils.reAlpha(Render2DUtils.intToColor(-1072689136), ((int) arch$alpha)).getRGB(), Render2DUtils.reAlpha(Render2DUtils.intToColor(-804253680), ((int) arch$alpha)).getRGB()); - } - } else { - this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680); - } - } else { - this.drawBackground(tint); - } - } - - @Inject(method = "sendChatMessage(Ljava/lang/String;Z)V", at = @At("HEAD"), cancellable = true) - public void sendChat(String msg, boolean addToChat, CallbackInfo ci){ - EventSendChatMessage eventSendChatMessage = new EventSendChatMessage(msg); - EventDispatcher.dispatchEvent(eventSendChatMessage); - if (eventSendChatMessage.isCanceled()) { - ci.cancel(); - } - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinInventoryEffectRenderer.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinInventoryEffectRenderer.java deleted file mode 100644 index f347111c..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinInventoryEffectRenderer.java +++ /dev/null @@ -1,50 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.InventoryEffectRenderer; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.fpsmaster.features.impl.optimizes.FixedInventory; - -import java.util.Iterator; - -import static top.fpsmaster.utils.Utility.mc; - -@Mixin(InventoryEffectRenderer.class) -public class MixinInventoryEffectRenderer extends MixinGuiContainer{ - - @Shadow - private boolean hasActivePotionEffects; - - @Inject(method = "updateActivePotionEffects", at = @At("RETURN")) - private void renderPotionEffects(CallbackInfo ci) { - boolean hasVisibleEffect = false; - Iterator var2 = mc.player.getActivePotionEffects().iterator(); - - while(var2.hasNext()) { - PotionEffect potioneffect = (PotionEffect)var2.next(); - Potion potion = potioneffect.getPotion(); - if (potion.shouldRender(potioneffect)) { - hasVisibleEffect = true; - break; - } - } - - if (!mc.player.getActivePotionEffects().isEmpty() && hasVisibleEffect) { - if (FixedInventory.using){ - this.guiLeft = (mc.currentScreen.width - this.xSize) / 2; - }else { - this.guiLeft = 160 + (mc.currentScreen.width - this.xSize - 200) / 2; - } - this.hasActivePotionEffects = true; - } else { - this.guiLeft = (mc.currentScreen.width - this.xSize) / 2; - this.hasActivePotionEffects = false; - } - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinItemRenderer.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinItemRenderer.java deleted file mode 100644 index 990b3362..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinItemRenderer.java +++ /dev/null @@ -1,299 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.entity.AbstractClientPlayer; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.ItemRenderer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemCarrotOnAStick; -import net.minecraft.item.ItemFishingRod; -import net.minecraft.item.ItemMap; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumHand; -import net.minecraft.util.EnumHandSide; -import net.minecraft.util.math.MathHelper; -import net.minecraftforge.client.ForgeHooksClient; -import org.lwjgl.input.Mouse; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.fpsmaster.features.impl.optimizes.OldAnimations; -import top.fpsmaster.features.impl.render.FireModifier; - -import java.awt.*; -import java.util.Objects; - -import static top.fpsmaster.features.impl.optimizes.OldAnimations.*; -import static top.fpsmaster.utils.Utility.mc; - -@Mixin(ItemRenderer.class) -public abstract class MixinItemRenderer { - - @Shadow - private float equippedProgressMainHand; - @Shadow - private float prevEquippedProgressMainHand; - @Shadow - private float equippedProgressOffHand; - @Shadow - private float prevEquippedProgressOffHand; - @Shadow - private ItemStack itemStackMainHand; - - /** - * @author SuperSkidder - * @reason prevent cooldown animation - */ - @Overwrite - public void updateEquippedItem() { - this.prevEquippedProgressMainHand = this.equippedProgressMainHand; - this.prevEquippedProgressOffHand = this.equippedProgressOffHand; - EntityPlayerSP entityplayersp = mc.player; - ItemStack itemstack = entityplayersp.getHeldItemMainhand(); - ItemStack itemstack1 = entityplayersp.getHeldItemOffhand(); - if (entityplayersp.isRowingBoat()) { - this.equippedProgressMainHand = MathHelper.clamp(this.equippedProgressMainHand - 0.4F, 0.0F, 1.0F); - this.equippedProgressOffHand = MathHelper.clamp(this.equippedProgressOffHand - 0.4F, 0.0F, 1.0F); - } else { - float f = entityplayersp.getCooledAttackStrength(1.0F); - boolean requipM = ForgeHooksClient.shouldCauseReequipAnimation(this.itemStackMainHand, itemstack, entityplayersp.inventory.currentItem); - boolean requipO = ForgeHooksClient.shouldCauseReequipAnimation(this.itemStackOffHand, itemstack1, -1); - if (!requipM && !Objects.equals(this.itemStackMainHand, itemstack)) { - this.itemStackMainHand = itemstack; - } - - if (!requipM && !Objects.equals(this.itemStackOffHand, itemstack1)) { - this.itemStackOffHand = itemstack1; - } - if (OldAnimations.using && oldSwing.getValue()) { - this.equippedProgressMainHand += MathHelper.clamp((Objects.equals(this.itemStackMainHand, itemstack) ? 1F : 0.0F) - this.equippedProgressMainHand, -0.4F, 0.4F); - } else { - this.equippedProgressMainHand += MathHelper.clamp((!requipM ? f * f * f : 0.0F) - this.equippedProgressMainHand, -0.4F, 0.4F); - } - this.equippedProgressOffHand += MathHelper.clamp((float)(!requipO ? 1 : 0) - this.equippedProgressOffHand, -0.4F, 0.4F); - } - - if (this.equippedProgressMainHand < 0.1F) { - this.itemStackMainHand = itemstack; - } - - if (this.equippedProgressOffHand < 0.1F) { - this.itemStackOffHand = itemstack1; - } - - } - - @Inject(method = "renderFireInFirstPerson", at = @At("HEAD"), cancellable = true) - public void renderFireInFirstPerson(CallbackInfo ci) { - if (FireModifier.using) { - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 0.9F); - GlStateManager.depthFunc(519); - GlStateManager.depthMask(false); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - float f = 1.0F; - - for (int i = 0; i < 2; ++i) { - GlStateManager.pushMatrix(); - TextureAtlasSprite textureatlassprite = mc.getTextureMapBlocks().getAtlasSprite("minecraft:blocks/fire_layer_1"); - mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - float f1 = textureatlassprite.getMinU(); - float f2 = textureatlassprite.getMaxU(); - float f3 = textureatlassprite.getMinV(); - float f4 = textureatlassprite.getMaxV(); - float f5 = -0.5F; - float f6 = 0.5F; - float f7 = -0.5F; - float f8 = 0.5F; - float f9 = -0.5F; - GlStateManager.translate(0, FireModifier.using ? -FireModifier.height.getValue().floatValue() : 0, 0); - if (FireModifier.using && FireModifier.customColor.getValue()) { - Color color = FireModifier.colorSetting.getColor(); - GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, 0.9F); - } - GlStateManager.translate((float) (-(i * 2 - 1)) * 0.24F, -0.3F, 0.0F); - GlStateManager.rotate((float) (i * 2 - 1) * 10.0F, 0.0F, 1.0F, 0.0F); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); - bufferbuilder.pos(-0.5, -0.5, -0.5).tex(f2, f4).endVertex(); - bufferbuilder.pos(0.5, -0.5, -0.5).tex(f1, f4).endVertex(); - bufferbuilder.pos(0.5, 0.5, -0.5).tex(f1, f3).endVertex(); - bufferbuilder.pos(-0.5, 0.5, -0.5).tex(f2, f3).endVertex(); - tessellator.draw(); - GlStateManager.popMatrix(); - } - - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.disableBlend(); - GlStateManager.depthMask(true); - GlStateManager.depthFunc(515); - ci.cancel(); - } - } - - @Shadow - protected abstract void renderArmFirstPerson(float p_187456_1_, float p_187456_2_, EnumHandSide p_187456_3_); - - @Shadow - private ItemStack itemStackOffHand; - - @Shadow - protected abstract void renderMapFirstPersonSide(float p_187465_1_, EnumHandSide hand, float p_187465_3_, ItemStack stack); - - @Shadow - protected abstract void renderMapFirstPerson(float p_187463_1_, float p_187463_2_, float p_187463_3_); - - @Shadow - protected abstract void transformSideFirstPerson(EnumHandSide hand, float p_187459_2_); - - @Shadow - protected abstract void transformEatFirstPerson(float p_187454_1_, EnumHandSide hand, ItemStack stack); - - @Shadow - protected abstract void transformFirstPerson(EnumHandSide hand, float p_187453_2_); - - @Shadow - public abstract void renderItemSide(EntityLivingBase entitylivingbaseIn, ItemStack heldStack, ItemCameraTransforms.TransformType transform, boolean leftHanded); - - /** - * @author SuperSkidder - * @reason animation - */ - @Overwrite - public void renderItemInFirstPerson(AbstractClientPlayer player, float partialTick, float p_187457_3_, EnumHand hand, float swingProgress, ItemStack stack, float equippedProgress) { - boolean flag = hand == EnumHand.MAIN_HAND; - EnumHandSide enumhandside = flag ? player.getPrimaryHand() : player.getPrimaryHand().opposite(); - GlStateManager.pushMatrix(); - if (stack.isEmpty()) { - if (flag && !player.isInvisible()) { - this.renderArmFirstPerson(equippedProgress, swingProgress, enumhandside); - } - } else { - if (OldAnimations.using && OldAnimations.oldRod.getValue() && (stack.getItem() instanceof ItemCarrotOnAStick || stack.getItem() instanceof ItemFishingRod)) { - GlStateManager.translate(0.08F, -0.027F, -0.33F); - GlStateManager.scale(0.93F, 1.0F, 1.0F); - } - if (OldAnimations.using && OldAnimations.oldSwing.getValue() && swingProgress != 0.0F && !mc.player.isHandActive()) { - GlStateManager.scale(0.85F, 0.85F, 0.85F); - GlStateManager.translate(-0.06F, 0.003F, 0.05F); - } - if (stack.getItem() instanceof ItemMap) { - if (flag && this.itemStackOffHand.isEmpty()) { - this.renderMapFirstPerson(p_187457_3_, equippedProgress, swingProgress); - } else { - this.renderMapFirstPersonSide(equippedProgress, enumhandside, swingProgress, stack); - } - } else { - boolean flag1 = enumhandside == EnumHandSide.RIGHT; - float f5; - float f6; - if ((player.isHandActive() && player.getItemInUseCount() > 0 && player.getActiveHand() == hand) || (!PreventBanning.canBlock() && PreventBanning.using && Mouse.isButtonDown(1))) { - int j = flag1 ? 1 : -1; - switch (stack.getItemUseAction()) { - case NONE: - this.transformSideFirstPerson(enumhandside, equippedProgress); - break; - case EAT: - case DRINK: - if (OldAnimations.using && oldUsing.getValue() && swingProgress != 0.0f) { - GlStateManager.translate(j * 0.56, -0.52 + equippedProgress * -0.6, -0.72); - GlStateManager.rotate(45.0F, 0, 0, 0); - float f = MathHelper.sin(swingProgress * swingProgress * (float) Math.PI); - float f1 = MathHelper.sin(MathHelper.sqrt(swingProgress) * (float) Math.PI); - GlStateManager.rotate(f * 20.0F, 0, -1, 0); - GlStateManager.rotate(f1 * 20.0F, 0, 0, -1); - GlStateManager.rotate(f1 * 80.0F, -1, 0, 0); - GlStateManager.translate(-0.8f, 0.2f, 0f); - GlStateManager.rotate(30f, 0f, 1f, 0f); - GlStateManager.rotate(-80f, 1f, 0f, 0f); - GlStateManager.rotate(60f, 0f, 1f, 0f); - GlStateManager.scale(1.4f, 1.4f, 1.4f); - break; - } - this.transformEatFirstPerson(partialTick, enumhandside, stack); - this.transformSideFirstPerson(enumhandside, equippedProgress); - if (OldAnimations.using && oldUsing.getValue()) { - float f = MathHelper.sin(swingProgress * swingProgress * (float) Math.PI); - float f1 = MathHelper.sin(MathHelper.sqrt(swingProgress) * (float) Math.PI); - GlStateManager.rotate(f * -20.0F, 0, 1, 0); - GlStateManager.rotate(f1 * -20.0F, 0, 0, 1); - GlStateManager.rotate(f1 * -80.0F, 1, 0, 0); - } - break; - case BLOCK: - if (oldBlock.getValue()) { - this.blockAnimation(enumhandside == EnumHandSide.RIGHT ? 1.0F : -1.0F, oldBlock.getValue() ? 0 : equippedProgress, swingProgress); - } else { - this.transformSideFirstPerson(enumhandside, equippedProgress); - } - break; - case BOW: - this.transformSideFirstPerson(enumhandside, equippedProgress); - if (oldBow.getValue()) { - transformFirstPerson(enumhandside, swingProgress); - } - GlStateManager.translate((float) j * -0.2785682F, 0.18344387F, 0.15731531F); - GlStateManager.rotate(-13.935F, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate((float) j * 35.3F, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate((float) j * -9.785F, 0.0F, 0.0F, 1.0F); - f5 = (float) stack.getMaxItemUseDuration() - ((float) mc.player.getItemInUseCount() - partialTick + 1.0F); - f6 = f5 / 20.0F; - f6 = (f6 * f6 + f6 * 2.0F) / 3.0F; - if (f6 > 1.0F) { - f6 = 1.0F; - } - - if (f6 > 0.1F) { - float f7 = MathHelper.sin((f5 - 0.1F) * 1.3F); - float f3 = f6 - 0.1F; - float f4 = f7 * f3; - GlStateManager.translate(f4 * 0.0F, f4 * 0.004F, f4 * 0.0F); - } - - GlStateManager.translate(f6 * 0.0F, f6 * 0.0F, f6 * 0.04F); - GlStateManager.scale(1.0F, 1.0F, 1.0F + f6 * 0.2F); - GlStateManager.rotate((float) j * 45.0F, 0.0F, -1.0F, 0.0F); - } - } else { - float f = -0.4F * MathHelper.sin(MathHelper.sqrt(swingProgress) * 3.1415927F); - f5 = 0.2F * MathHelper.sin(MathHelper.sqrt(swingProgress) * 6.2831855F); - f6 = -0.2F * MathHelper.sin(swingProgress * 3.1415927F); - int i = flag1 ? 1 : -1; - GlStateManager.translate((float) i * f, f5, f6); - this.transformSideFirstPerson(enumhandside, equippedProgress); - this.transformFirstPerson(enumhandside, swingProgress); - } - - this.renderItemSide(player, stack, flag1 ? ItemCameraTransforms.TransformType.FIRST_PERSON_RIGHT_HAND : ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND, !flag1); - } - } - - GlStateManager.popMatrix(); - } - - private void blockAnimation(float side, float equipProgress, float swingProgress) { - GlStateManager.translate(x.getValue().floatValue(), y.getValue().floatValue(), z.getValue().floatValue()); - GlStateManager.translate(side * 0.56F, -0.52F + equipProgress * -0.6F, -0.71999997F); - float f = MathHelper.sin(swingProgress * swingProgress * (float) Math.PI); - float f1 = MathHelper.sin(MathHelper.sqrt(swingProgress) * (float) Math.PI); - GlStateManager.rotate(side * (45.0F + f * -20.0F), 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(side * f1 * -20.0F, 0.0F, 0.0F, 1.0F); - GlStateManager.rotate(f1 * -80.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(side * -45.0F, 0.0F, 1.0F, 0.0F); - GlStateManager.scale(0.9F, 0.9F, 0.9F); - GlStateManager.translate(-0.2F, 0.126F, 0.2F); - GlStateManager.rotate(-102.25F, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(side * 15.0F, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(side * 80.0F, 0.0F, 0.0F, 1.0F); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinItemSword.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinItemSword.java deleted file mode 100644 index 9fa8803b..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinItemSword.java +++ /dev/null @@ -1,65 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.EnumAction; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; -import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import top.fpsmaster.features.impl.optimizes.OldAnimations; - -import static top.fpsmaster.features.impl.optimizes.OldAnimations.oldBlock; - -@Mixin(Item.class) -public class MixinItemSword { - /** - * @author SuperSkidder - * @reason blockAnimation - */ - @Overwrite - public EnumAction getItemUseAction(ItemStack stack) { - if (!(stack.getItem() instanceof ItemSword)) - return EnumAction.NONE; - if (OldAnimations.using && oldBlock.getValue()) { - return EnumAction.BLOCK; - } else { - return EnumAction.NONE; - } - } - /** - * @author SuperSkidder - * @reason blockAnimation - */ - @Overwrite - public int getMaxItemUseDuration(ItemStack stack) { - if (!(stack.getItem() instanceof ItemSword)) - return 0; - if (OldAnimations.using && oldBlock.getValue()) { - return 72000; - } else { - return 0; - } - } - /** - * @author SuperSkidder - * @reason blockAnimation - */ - @Overwrite - public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { - ItemStack itemstack = playerIn.getHeldItem(handIn); - if (!(itemstack.getItem() instanceof ItemSword)) - return new ActionResult<>(EnumActionResult.PASS, itemstack); - - if (!oldBlock.getValue() || !OldAnimations.using) { - return new ActionResult<>(EnumActionResult.PASS, playerIn.getHeldItem(handIn)); - } - playerIn.setActiveHand(handIn); - return new ActionResult<>(EnumActionResult.PASS, itemstack); - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinKeybinding.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinKeybinding.java deleted file mode 100644 index 725d2e73..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinKeybinding.java +++ /dev/null @@ -1,21 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.settings.KeyBinding; -import org.spongepowered.asm.mixin.Implements; -import org.spongepowered.asm.mixin.Interface; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import top.fpsmaster.forge.api.IKeyBinding; - -@Mixin(KeyBinding.class) -@Implements(@Interface(iface = IKeyBinding.class, prefix = "fpsmaster$")) -public class MixinKeybinding implements IKeyBinding { - - @Shadow - private boolean pressed; - - @Override - public void setPressed(boolean pressed) { - this.pressed = pressed; - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinLayerArmorBase.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinLayerArmorBase.java deleted file mode 100644 index 8957d8ce..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinLayerArmorBase.java +++ /dev/null @@ -1,18 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.renderer.entity.layers.LayerArmorBase; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import top.fpsmaster.features.impl.optimizes.OldAnimations; - -@Mixin(LayerArmorBase.class) -public class MixinLayerArmorBase { - /** - * @author SuperSkidder - * @reason old hurt Animation - */ - @Overwrite - public boolean shouldCombineTextures() { - return OldAnimations.using && OldAnimations.oldDamage.getValue(); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinMainMenu.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinMainMenu.java deleted file mode 100644 index 111e0844..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinMainMenu.java +++ /dev/null @@ -1,20 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiMainMenu; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import top.fpsmaster.ui.screens.mainmenu.MainMenu; - -@Mixin(GuiMainMenu.class) -public class MixinMainMenu { - - /** - * @author SuperSkidder - * @reason replace - */ - @Overwrite - public void initGui(){ - Minecraft.getMinecraft().displayGuiScreen(new MainMenu()); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinMinecraft.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinMinecraft.java deleted file mode 100644 index 20ba3c32..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinMinecraft.java +++ /dev/null @@ -1,354 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.*; -import net.minecraft.client.gui.advancements.GuiScreenAdvancements; -import net.minecraft.client.gui.inventory.GuiContainerCreative; -import net.minecraft.client.gui.inventory.GuiInventory; -import net.minecraft.client.multiplayer.PlayerControllerMP; -import net.minecraft.client.network.NetHandlerPlayClient; -import net.minecraft.client.renderer.EntityRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderGlobal; -import net.minecraft.client.renderer.texture.TextureManager; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.client.tutorial.Tutorial; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.network.play.client.CPacketPlayerDigging; -import net.minecraft.util.*; -import net.minecraft.util.math.BlockPos; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.Display; -import org.spongepowered.asm.mixin.*; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.forge.api.IMinecraft; -import top.fpsmaster.event.EventDispatcher; -import top.fpsmaster.event.events.EventKey; -import top.fpsmaster.event.events.EventMouseClick; -import top.fpsmaster.event.events.EventTick; -import top.fpsmaster.features.impl.optimizes.OldAnimations; -import top.fpsmaster.features.impl.optimizes.Performance; -import top.fpsmaster.utils.render.Render2DUtils; - -import javax.annotation.Nullable; -import java.awt.*; - -import static top.fpsmaster.FPSMaster.getClientTitle; - -@Mixin(Minecraft.class) -@Implements(@Interface(iface = IMinecraft.class, prefix = "fpsmaster$")) -public abstract class MixinMinecraft implements IMinecraft { - @Final - @Shadow - private net.minecraft.util.Timer timer; - - @Shadow - public GameSettings gameSettings; - - @Shadow - public EntityRenderer entityRenderer; - - @Shadow - public abstract Entity getRenderViewEntity(); - - @Shadow - public RenderGlobal renderGlobal; - @Shadow - public EntityPlayerSP player; - - @Shadow - public GuiIngame ingameGUI; - @Shadow - public GuiScreen currentScreen; - - @Shadow - public PlayerControllerMP playerController; - - @Shadow - public abstract void displayGuiScreen(@Nullable GuiScreen guiScreenIn); - - @Final - @Shadow - private Tutorial tutorial; - - @Shadow - public abstract NetHandlerPlayClient getConnection(); - - @Shadow - private int rightClickDelayTimer; - @Shadow - public boolean inGameHasFocus; - - @Final - @Mutable - @Shadow - private Session session; - - @Override - public Session arch$getSession() { - return session; - } - - - @Override - public void arch$setSession(Session session) { - this.session = session; - } - - @Inject(method = "shutdown", at = @At("HEAD")) - public void shutdown(CallbackInfo ci) { - FPSMaster.INSTANCE.shutdown(); - } - - @Override - public void arch$setLeftClickCounter(int c) { - this.leftClickCounter = c; - } - - @Override - public void arch$setRightClickDelayTimer(int c) { - this.rightClickDelayTimer = c; - } - - @Override - public Timer arch$getTimer() { - return timer; - } - - @Inject(method = "runTick", at = @At("HEAD")) - public void onTick(CallbackInfo ci) { - EventDispatcher.dispatchEvent(new EventTick()); - } - - - - /** - * @author SuperSkidder - * @reason fps Limit - */ - @Overwrite - public int getLimitFramerate(){ - return (Display.isActive()) ? this.gameSettings.limitFramerate : Performance.using ? Performance.fpsLimit.getValue().intValue() : this.gameSettings.limitFramerate; - } - - /** - * FastLoad - */ - @Redirect(method = "launchIntegratedServer",at = @At(value = "INVOKE", target = "Ljava/lang/System;gc()V")) - public void gc1() { - if (!Performance.using || !Performance.fastLoad.getValue()){ - System.gc(); - } - } - - @Redirect(method = "loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Ljava/lang/String;)V",at = @At(value = "INVOKE", target = "Ljava/lang/System;gc()V")) - public void gc2() { - if (!Performance.using || !Performance.fastLoad.getValue()){ - System.gc(); - } - } - - - @Shadow - public abstract void updateDisplay(); - /** - * @author SuperSkidder - * @reason splash - */ - @Overwrite - public void drawSplashScreen(TextureManager textureManagerInstance){ - ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); - int i = sr.getScaleFactor(); - Framebuffer framebuffer = new Framebuffer(sr.getScaledWidth() * i, sr.getScaledHeight() * i, true); - framebuffer.bindFramebuffer(false); - GlStateManager.matrixMode(5889); - GlStateManager.loadIdentity(); - GlStateManager.ortho(0.0D, sr.getScaledWidth(), sr.getScaledHeight(), 0.0D, 1000.0D, 3000.0D); - GlStateManager.matrixMode(5888); - GlStateManager.loadIdentity(); - GlStateManager.translate(0.0F, 0.0F, -2000.0F); - GlStateManager.disableLighting(); - GlStateManager.disableFog(); - GlStateManager.resetColor(); - - Gui.drawRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight(), new Color(20,20,20).getRGB()); - - float width = 400; - float height = 250; - Render2DUtils.drawImage(new ResourceLocation("client/textures/ui/splash.png"), sr.getScaledWidth() / 2f - width / 2, sr.getScaledHeight() / 2f - height / 2, width, height, -1); - GlStateManager.disableLighting(); - GlStateManager.disableFog(); - framebuffer.unbindFramebuffer(); - framebuffer.framebufferRender(sr.getScaledWidth() * i, sr.getScaledHeight() * i); - GlStateManager.enableAlpha(); - GlStateManager.alphaFunc(516, 0.1F); - updateDisplay(); - } - - /** - * @author SuperSkidder - * @reason Fix for blockhit - */ - @Overwrite - private void processKeyBinds() { - for (; this.gameSettings.keyBindTogglePerspective.isPressed(); this.renderGlobal.setDisplayListEntitiesDirty()) { - ++this.gameSettings.thirdPersonView; - - if (this.gameSettings.thirdPersonView > 2) { - this.gameSettings.thirdPersonView = 0; - } - - if (this.gameSettings.thirdPersonView == 0) { - this.entityRenderer.loadEntityShader(this.getRenderViewEntity()); - } else if (this.gameSettings.thirdPersonView == 1) { - this.entityRenderer.loadEntityShader(null); - } - } - - while (this.gameSettings.keyBindSmoothCamera.isPressed()) { - this.gameSettings.smoothCamera = !this.gameSettings.smoothCamera; - } - - for (int i = 0; i < 9; ++i) { - boolean flag = this.gameSettings.keyBindSaveToolbar.isKeyDown(); - boolean flag1 = this.gameSettings.keyBindLoadToolbar.isKeyDown(); - - if (this.gameSettings.keyBindsHotbar[i].isPressed()) { - if (this.player.isSpectator()) { - this.ingameGUI.getSpectatorGui().onHotbarSelected(i); - } else if (!this.player.isCreative() || this.currentScreen != null || !flag1 && !flag) { - this.player.inventory.currentItem = i; - } else { - GuiContainerCreative.handleHotbarSnapshots(Minecraft.getMinecraft(), i, flag1, flag); - } - } - } - - while (this.gameSettings.keyBindInventory.isPressed()) { - if (this.playerController.isRidingHorse()) { - this.player.sendHorseInventory(); - } else { - this.tutorial.openInventory(); - this.displayGuiScreen(new GuiInventory(this.player)); - } - } - - while (this.gameSettings.keyBindAdvancements.isPressed()) { - this.displayGuiScreen(new GuiScreenAdvancements(this.player.connection.getAdvancementManager())); - } - - while (this.gameSettings.keyBindSwapHands.isPressed()) { - if (!this.player.isSpectator()) { - this.getConnection().sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.SWAP_HELD_ITEMS, BlockPos.ORIGIN, EnumFacing.DOWN)); - } - } - - while (this.gameSettings.keyBindDrop.isPressed()) { - if (!this.player.isSpectator()) { - this.player.dropItem(GuiScreen.isCtrlKeyDown()); - } - } - - boolean flag2 = this.gameSettings.chatVisibility != EntityPlayer.EnumChatVisibility.HIDDEN; - - if (flag2) { - while (this.gameSettings.keyBindChat.isPressed()) { - this.displayGuiScreen(new GuiChat()); - } - - if (this.currentScreen == null && this.gameSettings.keyBindCommand.isPressed()) { - this.displayGuiScreen(new GuiChat("/")); - } - } - - if (this.player.isHandActive()) { - - if (!this.gameSettings.keyBindUseItem.isKeyDown()) { - this.playerController.onStoppedUsingItem(this.player); - } - - if (this.gameSettings.keyBindAttack.isPressed()) { - if (OldAnimations.using && OldAnimations.blockHit.getValue()) { - ((EntityLivingBase) Minecraft.getMinecraft().player).swingArm(EnumHand.MAIN_HAND); - } - return; - } - - if (this.gameSettings.keyBindUseItem.isPressed()) { - return; - } - - if (this.gameSettings.keyBindPickBlock.isPressed()) { - return; - } - - } else { - while (this.gameSettings.keyBindAttack.isPressed()) { - EventDispatcher.dispatchEvent(new EventMouseClick(0)); - this.clickMouse(); - } - - while (this.gameSettings.keyBindUseItem.isPressed()) { - EventDispatcher.dispatchEvent(new EventMouseClick(1)); - this.rightClickMouse(); - } - - while (this.gameSettings.keyBindPickBlock.isPressed()) { - EventDispatcher.dispatchEvent(new EventMouseClick(2)); - this.middleClickMouse(); - } - } - - if (this.gameSettings.keyBindUseItem.isKeyDown() && this.rightClickDelayTimer == 0 && !this.player.isHandActive()) { - this.rightClickMouse(); - } - - this.sendClickBlockToController(this.currentScreen == null && this.gameSettings.keyBindAttack.isKeyDown() && this.inGameHasFocus); - } - - - @Shadow - protected abstract void sendClickBlockToController(boolean leftClick); - - @Shadow - protected abstract void clickMouse(); - - @Shadow - protected abstract void rightClickMouse(); - - - - - @Inject(method = "rightClickMouse", at = @At("HEAD"), cancellable = true) - public void preventBanning(CallbackInfo ci) { - if (PreventBanning.using && !PreventBanning.canBlock()) - ci.cancel(); - } - - @Shadow - protected abstract void middleClickMouse(); - - @Shadow private int leftClickCounter; - - @Inject(method="clickMouse",at = @At("RETURN")) - public void onClickMouse(CallbackInfo ci){ - leftClickCounter = 0; - } - @Inject(method = "runTickKeyboard", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;dispatchKeypresses()V", shift = At.Shift.AFTER)) - public void keyEvent(CallbackInfo ci) { - EventKey key = new EventKey(Keyboard.getEventKey() == 0 ? Keyboard.getEventCharacter() + 256 : Keyboard.getEventKey()); - EventDispatcher.dispatchEvent(key); - } - @Inject(method = "createDisplay", at = @At(value = "RETURN")) - public void setTitle(CallbackInfo ci){ - Display.setTitle(getClientTitle()); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinMultiPlayer.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinMultiPlayer.java deleted file mode 100644 index 9fd9f7ec..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinMultiPlayer.java +++ /dev/null @@ -1,42 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import com.google.common.collect.Lists; -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiMultiplayer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.fpsmaster.modules.logger.Logger; -import top.fpsmaster.modules.plugin.api.client.PluginGuiButton; -import top.fpsmaster.modules.plugin.api.wrapper.Util; - -import java.util.List; -import java.util.Map; - -@Mixin(GuiMultiplayer.class) -public abstract class MixinMultiPlayer extends MixinGuiScreen { - - - @Inject(method = "createButtons", at = @At("RETURN")) - public void onButton(CallbackInfo ci) { - for (Map.Entry plugin : Util.buttons.entrySet()) { - PluginGuiButton pluginGuiButton = plugin.getValue(); - this.buttonList.add(new GuiButton(pluginGuiButton.id, pluginGuiButton.x, pluginGuiButton.y, pluginGuiButton.width, pluginGuiButton.height, pluginGuiButton.text)); - } - } - - @Inject(method = "actionPerformed", at = @At("RETURN")) - public void action(GuiButton button, CallbackInfo ci) { - Util.buttons.forEach((s, pluginGuiButton) -> { - if (button.id == pluginGuiButton.id) { - try { - pluginGuiButton.runnable.run(); - } catch (Exception e) { - Logger.error("Plugin Button", e.getMessage()); - } - } - }); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinNetHandlerLoginClient.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinNetHandlerLoginClient.java deleted file mode 100644 index a8b7120b..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinNetHandlerLoginClient.java +++ /dev/null @@ -1,39 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import com.mojang.authlib.exceptions.AuthenticationException; -import com.mojang.authlib.exceptions.AuthenticationUnavailableException; -import com.mojang.authlib.exceptions.InvalidCredentialsException; -import com.mojang.authlib.minecraft.MinecraftSessionService; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.GenericFutureListener; -import net.minecraft.client.network.NetHandlerLoginClient; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.login.client.CPacketEncryptionResponse; -import net.minecraft.network.login.server.SPacketEncryptionRequest; -import net.minecraft.util.CryptManager; -import net.minecraft.util.text.TextComponentTranslation; -import org.apache.logging.log4j.Logger; -import org.spongepowered.asm.mixin.*; -import top.fpsmaster.event.EventDispatcher; -import top.fpsmaster.event.events.EventJoinServer; - -import javax.crypto.SecretKey; -import java.math.BigInteger; -import java.security.PublicKey; - -import static top.fpsmaster.utils.Utility.mc; - -@Mixin(NetHandlerLoginClient.class) -public abstract class MixinNetHandlerLoginClient { - - @Final - @Shadow - private NetworkManager networkManager; - @Final - @Shadow - private static Logger LOGGER; - - - @Shadow - protected abstract MinecraftSessionService getSessionService(); -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinNetworkManager.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinNetworkManager.java deleted file mode 100644 index ed0de1cd..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinNetworkManager.java +++ /dev/null @@ -1,31 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import io.netty.channel.ChannelHandlerContext; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.fpsmaster.event.EventDispatcher; -import top.fpsmaster.event.events.EventPacket; - -@Mixin(NetworkManager.class) -public class MixinNetworkManager { - - @Inject(method = "channelRead0*", at = @At("HEAD"), cancellable = true) - private void read(ChannelHandlerContext context, Packet packet, CallbackInfo callback) { - EventPacket eventPacket = new EventPacket(EventPacket.PacketType.RECEIVE, packet); - EventDispatcher.dispatchEvent(eventPacket); - if (eventPacket.isCanceled()) - callback.cancel(); - } - - @Inject(method = "sendPacket(Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true) - private void send(Packet packet, CallbackInfo callback) { - EventPacket eventPacket = new EventPacket(EventPacket.PacketType.SEND, packet); - EventDispatcher.dispatchEvent(eventPacket); - if (eventPacket.isCanceled()) - callback.cancel(); - } -} \ No newline at end of file diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinNetworkPlayerInfo.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinNetworkPlayerInfo.java deleted file mode 100644 index a38a68f9..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinNetworkPlayerInfo.java +++ /dev/null @@ -1,42 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import com.google.common.collect.Maps; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.util.ResourceLocation; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import top.fpsmaster.forge.api.INetworkPlayerInfo; - -import java.util.Map; - -@Mixin(NetworkPlayerInfo.class) -public class MixinNetworkPlayerInfo implements INetworkPlayerInfo { - - @Shadow - Map playerTextures = Maps.newEnumMap(MinecraftProfileTexture.Type.class); - - @Shadow - private String skinType; - - @Override - public Map getTextures() { - return playerTextures; - } - - - @Override - public String getType() { - return skinType; - } - - @Override - public void setTextures(Map skin) { - this.playerTextures = skin; - } - - @Override - public void setType(String skinType) { - this.skinType = skinType; - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinParticleManager.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinParticleManager.java deleted file mode 100644 index 29801ee8..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinParticleManager.java +++ /dev/null @@ -1,47 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import com.google.common.collect.Lists; -import com.google.common.collect.Queues; -import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.ParticleEmitter; -import net.minecraft.client.particle.ParticleManager; -import net.minecraft.entity.Entity; -import net.minecraft.util.EnumParticleTypes; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; -import top.fpsmaster.features.impl.optimizes.Performance; - -import java.util.List; -import java.util.Queue; - -@Mixin(ParticleManager.class) -public class MixinParticleManager { - - @Final - @Shadow - private Queue particleEmitters = Queues.newArrayDeque(); - - /** - * @author SuperSkidder - * @reason particles limit - */ - @Overwrite - public void emitParticleAtEntity(Entity entityIn, EnumParticleTypes particleTypes) { - if (!Performance.using || particleEmitters.size() < Performance.particlesLimit.getValue().intValue()) { - this.particleEmitters.add(new ParticleEmitter(Minecraft.getMinecraft().world, entityIn, particleTypes)); - } - } - - /** - * @author SuperSkidder - * @reason particles limit - */ - @Overwrite - public void emitParticleAtEntity(Entity entityIn, EnumParticleTypes particleTypes, int p_191271_3_) { - if (!Performance.using || particleEmitters.size() < Performance.particlesLimit.getValue().intValue()) { - this.particleEmitters.add(new ParticleEmitter(Minecraft.getMinecraft().world, entityIn, particleTypes,p_191271_3_)); - } - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRender.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRender.java deleted file mode 100644 index 82d73bd5..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRender.java +++ /dev/null @@ -1,99 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.EntityRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityArmorStand; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.features.impl.utility.LevelTag; -import top.fpsmaster.api.ProviderManager; -import top.fpsmaster.modules.client.PlayerManager; -import top.fpsmaster.features.impl.optimizes.CheckEntity; -import top.fpsmaster.features.impl.optimizes.Performance; - -import static org.lwjgl.opengl.GL11.*; -import static org.lwjgl.opengl.GL11.GL_DEPTH_TEST; -import static top.fpsmaster.utils.Utility.mc; -import static top.fpsmaster.utils.render.Render2DUtils.drawModalRectWithCustomSizedTexture; - -@Mixin(Render.class) -public abstract class MixinRender { - protected MixinRender() { - } - - @Shadow - protected abstract boolean bindEntityTexture(Entity entity); - @Shadow - protected boolean renderOutlines; - @Shadow - protected abstract int getTeamColor(Entity entityIn); - @Final - @Shadow - protected RenderManager renderManager; - @Shadow - public void doRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks){} - - @Shadow - public abstract void bindTexture(ResourceLocation location); - - @Inject(method = "doRender(Lnet/minecraft/entity/Entity;DDDFF)V", at = @At("HEAD"),cancellable = true) - public void preRender(Entity entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci){ - if (Performance.using && entity != Minecraft.getMinecraft().player) { - if (Performance.entitiesOptimize.getValue()) { - if (!Performance.isVisible(new CheckEntity(entity))) { - ci.cancel(); - } - } - } - } - - @Inject(method = "renderLivingLabel", at = @At("HEAD"), cancellable = true) - protected void renderLivingLabel(Entity entityIn, String str, double x, double y, double z, int maxDistance, CallbackInfo ci) { - if (LevelTag.using && LevelTag.health.getValue()) { - double d = entityIn.getDistanceSq(this.renderManager.renderViewEntity); - if (d < 100) { - float f = 1.6F; - float g = 0.016666668F * f; - GlStateManager.pushMatrix(); - GlStateManager.translate((float) x + 0.0F, (float) y + entityIn.height + 0.5F, (float) z); - GL11.glNormal3f(0.0F, 1.0F, 0.0F); - GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); - GlStateManager.scale(-g, -g, g); - GlStateManager.disableLighting(); - GlStateManager.depthMask(false); - GlStateManager.disableDepth(); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - ProviderManager.guiIngameProvider.drawHealth(entityIn); - GlStateManager.disableTexture2D(); - GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); - GlStateManager.disableBlend(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.popMatrix(); - } - } - } - - - @Inject(method = "renderName",at = @At("HEAD"), cancellable = true) - public void ignore(Entity entity, double x, double y, double z, CallbackInfo ci){ - if (Performance.using && Performance.ignoreStands.getValue() && entity instanceof EntityArmorStand) { - ci.cancel(); - } - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRenderEntityItem.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRenderEntityItem.java deleted file mode 100644 index 53cabc06..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRenderEntityItem.java +++ /dev/null @@ -1,199 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.RenderItem; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.entity.RenderEntityItem; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.ForgeHooksClient; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import top.fpsmaster.features.impl.render.ItemPhysics; - -import java.util.Random; - -@Mixin(RenderEntityItem.class) -public abstract class MixinRenderEntityItem extends MixinRender{ - @Final - @Shadow - private final Random random = new Random(); - - @Shadow - protected abstract ResourceLocation getEntityTexture(EntityItem entity); - - @Final - @Shadow - private RenderItem itemRenderer; - - @Shadow - protected abstract int transformModelCount(EntityItem itemIn, double p_177077_2_, double p_177077_4_, double p_177077_6_, float p_177077_8_, IBakedModel p_177077_9_); - @Shadow - public abstract boolean shouldSpreadItems(); - - @Shadow - protected abstract int getModelCount(ItemStack stack); - - /** - * @author SuperSkidder - * @reason ItemPhysics - */ - @Overwrite - public void doRender(EntityItem entity, double x, double y, double z, float entityYaw, float partialTicks) { - ItemStack itemstack = entity.getItem(); - int i = itemstack.isEmpty() ? 187 : Item.getIdFromItem(itemstack.getItem()) + itemstack.getMetadata(); - this.random.setSeed(i); - boolean flag = false; - if (this.bindEntityTexture(entity)) { - this.renderManager.renderEngine.getTexture(this.getEntityTexture(entity)).setBlurMipmap(false, false); - flag = true; - } - - GlStateManager.enableRescaleNormal(); - GlStateManager.alphaFunc(516, 0.1F); - GlStateManager.enableBlend(); - RenderHelper.enableStandardItemLighting(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.pushMatrix(); - IBakedModel ibakedmodel = this.itemRenderer.getItemModelWithOverrides(itemstack, entity.world, null); - int j; - if (ItemPhysics.using) { - j = getModelCount(itemstack); - } else { - j = this.transformModelCount(entity, x, y, z, partialTicks, ibakedmodel); - } - - float f = 0.4f; - float f1 = 0.4f; - float f2 = 0.4f; - boolean flag1 = ibakedmodel.isGui3d(); - - if (ItemPhysics.using) { - GlStateManager.translate((float) x, (float) y, (float) z); - GlStateManager.scale(f, f1, f2); - GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(entity.rotationYaw, 0.0F, 0.0F, 1.0F); - if (flag1) { - GlStateManager.translate(0.0D, 0.0D, -0.08D); - } else { - GlStateManager.translate(0.0D, 0.0D, -0.04D); - } - if (flag1 || Minecraft.getMinecraft().getRenderManager().options != null) { - double rotation; - if (flag1) { - if (!entity.onGround) { - rotation = 1.1D; - entity.rotationPitch = (float) ((double) entity.rotationPitch + rotation); - } - } else if (!Double.isNaN(entity.posX) && !Double.isNaN(entity.posY) && !Double.isNaN(entity.posZ) && entity.world != null) { - if (entity.onGround) { - entity.rotationPitch = 0.0F; - } else { - rotation = 1.1D; - entity.rotationPitch = (float) ((double) entity.rotationPitch + rotation); - } - } - GlStateManager.rotate(entity.rotationPitch, 1.0F, 0.0F, 0.0F); - } - - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - - for (int k = 0; k < j; ++k) { - GlStateManager.pushMatrix(); - if (flag1) { - if (k > 0) { - float f7 = (random.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f9 = (random.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f6 = (random.nextFloat() * 2.0F - 1.0F) * 0.15F; - GlStateManager.translate(f7, f9, f6); - } - - Minecraft.getMinecraft().getRenderItem().renderItem(itemstack, ibakedmodel); - GlStateManager.popMatrix(); - } else { - Minecraft.getMinecraft().getRenderItem().renderItem(itemstack, ibakedmodel); - GlStateManager.popMatrix(); - GlStateManager.translate(0.0F, 0.0F, 0.05375F); - } - } - - GlStateManager.popMatrix(); - GlStateManager.disableRescaleNormal(); - GlStateManager.disableBlend(); - this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE); - Minecraft.getMinecraft().getRenderManager().renderEngine.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap(); - return; - } - - - float f7; - float f9; - if (!flag1) { - float f3 = -0.0F * (float)(j - 1) * 0.5F; - f7 = -0.0F * (float)(j - 1) * 0.5F; - f9 = -0.09375F * (float)(j - 1) * 0.5F; - GlStateManager.translate(f3, f7, f9); - } - - if (this.renderOutlines) { - GlStateManager.enableColorMaterial(); - GlStateManager.enableOutlineMode(this.getTeamColor(entity)); - } - - for(int k = 0; k < j; ++k) { - IBakedModel transformedModel; - if (flag1) { - GlStateManager.pushMatrix(); - if (k > 0) { - f7 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; - f9 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; - float f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F; - GlStateManager.translate(this.shouldSpreadItems() ? f7 : 0.0F, this.shouldSpreadItems() ? f9 : 0.0F, f6); - } - - transformedModel = ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); - this.itemRenderer.renderItem(itemstack, transformedModel); - GlStateManager.popMatrix(); - } else { - GlStateManager.pushMatrix(); - if (k > 0) { - f7 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; - f9 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.15F * 0.5F; - GlStateManager.translate(f7, f9, 0.0F); - } - - transformedModel = ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false); - this.itemRenderer.renderItem(itemstack, transformedModel); - GlStateManager.popMatrix(); - GlStateManager.translate(0.0F, 0.0F, 0.09375F); - } - } - - if (this.renderOutlines) { - GlStateManager.disableOutlineMode(); - GlStateManager.disableColorMaterial(); - } - - GlStateManager.popMatrix(); - GlStateManager.disableRescaleNormal(); - GlStateManager.disableBlend(); - this.bindEntityTexture(entity); - if (flag) { - this.renderManager.renderEngine.getTexture(this.getEntityTexture(entity)).restoreLastBlurMipmap(); - } - - super.doRender(entity, x, y, z, entityYaw, partialTicks); - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRenderLivingBase.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRenderLivingBase.java deleted file mode 100644 index cff61948..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRenderLivingBase.java +++ /dev/null @@ -1,123 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.renderer.GLAllocation; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.entity.RenderLivingBase; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.entity.EntityLivingBase; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import top.fpsmaster.features.impl.render.HitColor; -import top.fpsmaster.features.impl.utility.LevelTag; - -import java.nio.FloatBuffer; - -@Mixin(RenderLivingBase.class) -public abstract class MixinRenderLivingBase { - @Inject(method = "canRenderName(Lnet/minecraft/entity/EntityLivingBase;)Z", at = @At("HEAD"), cancellable = true) - public void tag(EntityLivingBase entity, CallbackInfoReturnable cir) { - if (LevelTag.using && LevelTag.showSelf.getValue()) { - EntityPlayerSP entityplayersp = Minecraft.getMinecraft().player; - boolean flag = !entity.isInvisibleToPlayer(entityplayersp); - - cir.setReturnValue(flag); - } - } - - @Shadow - protected abstract int getColorMultiplier(EntityLivingBase entitylivingbaseIn, float lightBrightness, float partialTickTime); - - @Shadow - protected FloatBuffer brightnessBuffer = GLAllocation.createDirectFloatBuffer(4); - - @Final - @Shadow - private static final DynamicTexture TEXTURE_BRIGHTNESS = new DynamicTexture(16, 16); - - @Inject(method = "setBrightness", at = @At("HEAD"), cancellable = true) - protected void setBrightness(EntityLivingBase entitylivingbaseIn, float partialTicks, boolean combineTextures, CallbackInfoReturnable cir) { - if (HitColor.using) { - float f = entitylivingbaseIn.getBrightness(); - int i = this.getColorMultiplier(entitylivingbaseIn, f, partialTicks); - boolean flag = (i >> 24 & 255) > 0; - boolean flag1 = entitylivingbaseIn.hurtTime > 0 || entitylivingbaseIn.deathTime > 0; - if (!flag && !flag1) { - cir.setReturnValue(false); - } else if (!flag && !combineTextures) { - cir.setReturnValue(false); - } else { - GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); - GlStateManager.enableTexture2D(); - GlStateManager.glTexEnvi(8960, 8704, OpenGlHelper.GL_COMBINE); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_COMBINE_RGB, 8448); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_SOURCE0_RGB, OpenGlHelper.defaultTexUnit); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_SOURCE1_RGB, OpenGlHelper.GL_PRIMARY_COLOR); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_OPERAND0_RGB, 768); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_OPERAND1_RGB, 768); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_COMBINE_ALPHA, 7681); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_SOURCE0_ALPHA, OpenGlHelper.defaultTexUnit); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_OPERAND0_ALPHA, 770); - GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit); - GlStateManager.enableTexture2D(); - GlStateManager.glTexEnvi(8960, 8704, OpenGlHelper.GL_COMBINE); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_COMBINE_RGB, OpenGlHelper.GL_INTERPOLATE); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_SOURCE0_RGB, OpenGlHelper.GL_CONSTANT); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_SOURCE1_RGB, OpenGlHelper.GL_PREVIOUS); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_SOURCE2_RGB, OpenGlHelper.GL_CONSTANT); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_OPERAND0_RGB, 768); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_OPERAND1_RGB, 768); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_OPERAND2_RGB, 770); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_COMBINE_ALPHA, 7681); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_SOURCE0_ALPHA, OpenGlHelper.GL_PREVIOUS); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_OPERAND0_ALPHA, 770); - this.brightnessBuffer.position(0); - if (flag1) { - if (HitColor.using) { - this.brightnessBuffer.put(HitColor.getRed()); - this.brightnessBuffer.put(HitColor.getGreen()); - this.brightnessBuffer.put(HitColor.getBlue()); - this.brightnessBuffer.put(HitColor.getAlpha()); - } else { - this.brightnessBuffer.put(1.0F); - this.brightnessBuffer.put(0.0F); - this.brightnessBuffer.put(0.0F); - this.brightnessBuffer.put(0.3F); - } - } else { - float f1 = (float) (i >> 24 & 255) / 255.0F; - float f2 = (float) (i >> 16 & 255) / 255.0F; - float f3 = (float) (i >> 8 & 255) / 255.0F; - float f4 = (float) (i & 255) / 255.0F; - this.brightnessBuffer.put(f2); - this.brightnessBuffer.put(f3); - this.brightnessBuffer.put(f4); - this.brightnessBuffer.put(1.0F - f1); - } - - this.brightnessBuffer.flip(); - GlStateManager.glTexEnv(8960, 8705, this.brightnessBuffer); - GlStateManager.setActiveTexture(OpenGlHelper.GL_TEXTURE2); - GlStateManager.enableTexture2D(); - GlStateManager.bindTexture(TEXTURE_BRIGHTNESS.getGlTextureId()); - GlStateManager.glTexEnvi(8960, 8704, OpenGlHelper.GL_COMBINE); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_COMBINE_RGB, 8448); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_SOURCE0_RGB, OpenGlHelper.GL_PREVIOUS); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_SOURCE1_RGB, OpenGlHelper.lightmapTexUnit); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_OPERAND0_RGB, 768); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_OPERAND1_RGB, 768); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_COMBINE_ALPHA, 7681); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_SOURCE0_ALPHA, OpenGlHelper.GL_PREVIOUS); - GlStateManager.glTexEnvi(8960, OpenGlHelper.GL_OPERAND0_ALPHA, 770); - GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit); - cir.setReturnValue(true); - } - } - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRenderManager.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRenderManager.java deleted file mode 100644 index adacfdee..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRenderManager.java +++ /dev/null @@ -1,100 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import org.spongepowered.asm.mixin.*; -import top.fpsmaster.forge.api.IRenderManager; -import top.fpsmaster.features.impl.render.FreeLook; - -@Mixin(RenderManager.class) -@Implements(@Interface(iface = IRenderManager.class, prefix = "fpsmaster$")) -public class MixinRenderManager implements IRenderManager { - - @Shadow - private double renderPosX; - @Shadow - private double renderPosY; - @Shadow - private double renderPosZ; - - @Override - public double renderPosX() { - return renderPosX; - } - - @Override - public double renderPosY() { - return renderPosY; - } - - @Override - public double renderPosZ() { - return renderPosZ; - } - @Shadow - public float playerViewY; - @Shadow - public float playerViewX; - @Shadow - public double viewerPosX; - @Shadow - public double viewerPosY; - @Shadow - public double viewerPosZ; - @Shadow - public World world; - @Shadow - public GameSettings options; - @Shadow - public Entity renderViewEntity; - @Shadow - public Entity pointedEntity; - @Shadow - private FontRenderer textRenderer; - - - /** - * @author SuperSkidder - * @reason FreeLook - */ - @Overwrite - public void cacheActiveRenderInfo(World worldIn, FontRenderer textRendererIn, Entity livingPlayerIn, Entity pointedEntityIn, GameSettings optionsIn, float partialTicks) { - this.world = worldIn; - this.options = optionsIn; - this.renderViewEntity = livingPlayerIn; - this.pointedEntity = pointedEntityIn; - this.textRenderer = textRendererIn; - if (livingPlayerIn instanceof EntityLivingBase && ((EntityLivingBase)livingPlayerIn).isPlayerSleeping()) { - IBlockState iblockstate = worldIn.getBlockState(new BlockPos(livingPlayerIn)); - Block block = iblockstate.getBlock(); - if (block.isBed(iblockstate, worldIn, new BlockPos(livingPlayerIn), livingPlayerIn)) { - int i = block.getBedDirection(iblockstate, worldIn, new BlockPos(livingPlayerIn)).getHorizontalIndex(); - this.playerViewY = (float)(i * 90 + 180); - this.playerViewX = 0.0F; - } - } else { - if (FreeLook.using) { - this.playerViewY = FreeLook.getCameraPrevYaw() + (FreeLook.getCameraYaw() - FreeLook.getCameraPrevYaw()) * partialTicks; - this.playerViewX = FreeLook.getCameraPrevPitch() + (FreeLook.getCameraPitch() - FreeLook.getCameraPrevPitch()) * partialTicks; - } else { - this.playerViewY = livingPlayerIn.prevRotationYaw + (livingPlayerIn.rotationYaw - livingPlayerIn.prevRotationYaw) * partialTicks; - this.playerViewX = livingPlayerIn.prevRotationPitch + (livingPlayerIn.rotationPitch - livingPlayerIn.prevRotationPitch) * partialTicks; - } - } - - if (optionsIn.thirdPersonView == 2) { - this.playerViewY += 180.0F; - } - - this.viewerPosX = livingPlayerIn.lastTickPosX + (livingPlayerIn.posX - livingPlayerIn.lastTickPosX) * (double)partialTicks; - this.viewerPosY = livingPlayerIn.lastTickPosY + (livingPlayerIn.posY - livingPlayerIn.lastTickPosY) * (double)partialTicks; - this.viewerPosZ = livingPlayerIn.lastTickPosZ + (livingPlayerIn.posZ - livingPlayerIn.lastTickPosZ) * (double)partialTicks; - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRenderTNTPrimed.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRenderTNTPrimed.java deleted file mode 100644 index 89bb6aeb..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinRenderTNTPrimed.java +++ /dev/null @@ -1,22 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BlockRendererDispatcher; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.entity.RenderTNTPrimed; -import net.minecraft.entity.item.EntityTNTPrimed; -import net.minecraft.init.Blocks; -import net.minecraft.util.math.MathHelper; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.fpsmaster.features.impl.utility.TNTTimer; - -@Mixin(RenderTNTPrimed.class) -public abstract class MixinRenderTNTPrimed extends MixinRender { - @Inject(method = "doRender(Lnet/minecraft/entity/item/EntityTNTPrimed;DDDFF)V", at = @At("HEAD")) - public void timer(EntityTNTPrimed entity, double x, double y, double z, float entityYaw, float partialTicks, CallbackInfo ci){ - TNTTimer.doRender(entity); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinShaderGroup.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinShaderGroup.java deleted file mode 100644 index 9b965e1e..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinShaderGroup.java +++ /dev/null @@ -1,35 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.shader.Shader; -import net.minecraft.client.shader.ShaderGroup; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import top.fpsmaster.forge.api.IShaderGroup; - -import java.util.List; - -@Mixin(ShaderGroup.class) -public abstract class MixinShaderGroup implements IShaderGroup { - - @Shadow - @Final - private List listShaders; - - @Shadow - public abstract void render(float partialTicks); - - @Override - public void loadShaderGroup(float partialTicks){ - render(partialTicks); - } - - @Override - public void load(float partialTicks){ - loadShaderGroup(partialTicks); - } - @Override - public List getListShaders() { - return listShaders; - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinSplashScreen.java b/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinSplashScreen.java deleted file mode 100644 index d6ba2786..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/forge/mixin/MixinSplashScreen.java +++ /dev/null @@ -1,55 +0,0 @@ -package top.fpsmaster.forge.mixin; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.shader.Framebuffer; -import net.minecraftforge.fml.client.SplashProgress; -import org.lwjgl.opengl.Display; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Overwrite; -import org.spongepowered.asm.mixin.Unique; -import top.fpsmaster.utils.render.Render2DUtils; - -import java.awt.*; - -@Mixin(SplashProgress.class) -public class MixinSplashScreen { - - /** - * @author SuperSkidder - * @reason Custom Loading Screen - */ - @Overwrite - public static void start() { - ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); - int i = scaledresolution.getScaleFactor(); - Framebuffer framebuffer = new Framebuffer(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i, true); - framebuffer.bindFramebuffer(false); - GlStateManager.matrixMode(5889); - GlStateManager.loadIdentity(); - GlStateManager.ortho(0.0, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight(), 0.0, 1000.0, 3000.0); - GlStateManager.matrixMode(5888); - GlStateManager.loadIdentity(); - GlStateManager.translate(0.0F, 0.0F, -2000.0F); - GlStateManager.disableLighting(); - GlStateManager.disableFog(); - GlStateManager.disableDepth(); - - Render2DUtils.drawRect(0, 0, scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight(), new Color(20,20,20)); - - GlStateManager.disableLighting(); - GlStateManager.disableFog(); - framebuffer.unbindFramebuffer(); - framebuffer.framebufferRender(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i); - GlStateManager.enableAlpha(); - GlStateManager.alphaFunc(516, 0.1F); - arch$updateDisplay(); - } - - @Unique - private static void arch$updateDisplay() { - Display.update(); - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/minimap/Minimap.java b/v1.12.2/src/main/java/top/fpsmaster/minimap/Minimap.java deleted file mode 100644 index 6c90269d..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/minimap/Minimap.java +++ /dev/null @@ -1,1008 +0,0 @@ -package top.fpsmaster.minimap; - -import net.minecraft.block.*; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.texture.TextureUtil; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.resources.IResource; -import net.minecraft.client.settings.GameSettings; -import net.minecraft.client.shader.Framebuffer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.util.EnumBlockRenderType; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.EnumSkyBlock; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.chunk.Chunk; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL14; -import org.lwjgl.opengl.GLContext; -import top.fpsmaster.ui.minimap.animation.MinimapAnimation; -import top.fpsmaster.ui.minimap.interfaces.Interface; -import top.fpsmaster.ui.minimap.interfaces.InterfaceHandler; -import top.fpsmaster.ui.minimap.minimap.DynamicTexture; -import top.fpsmaster.ui.minimap.minimap.MinimapChunk; - -import java.awt.*; -import java.awt.image.BufferedImage; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.HashMap; - -public class Minimap -{ - public Interface screen; - public static final int frame = 9; - public static int loadingSide; - public static int loadedSide; - public static int updateRadius; - public static boolean enlargedMap; - public static Minecraft mc; - private int loadedCaving; - private int loadingCaving; - public static final Color radarPlayers; - public static final Color radarShadow; - public static ArrayList loadedPlayers; - public static ArrayList loadedLiving; - public static ArrayList loadedHostile; - public static ArrayList loadedItems; - public static ArrayList loadedEntities; - public static int blocksLoaded; - public int loadingMapX; - public int loadingMapZ; - public int loadedMapX; - public int loadedMapZ; - public double minimapZoom; - public int minimapWidth; - public int minimapHeight; - public MapLoader loader; - public MinimapChunk[][] currentBlocks; - public MinimapChunk[][] loadingBlocks; - public static boolean frameIsUpdating; - public static boolean frameUpdateNeeded; - public static int bufferSizeToUpdate; - public static float frameUpdatePartialTicks; - public static boolean updatePause; - private Integer previousTransparentBlock; - private int underRed; - private int underGreen; - private int underBlue; - private float divider; - private int sun; - public float postBrightness; - private int blockY; - private int blockColor; - public static HashMap textureColours; - public static HashMap blockColours; - public static boolean clearBlockColours; - boolean isglowing; - public int[] lastBlockY; - public static float sunBrightness; - private byte[] bytes; - private byte drawYState; - private static boolean toResetImage; - public static double zoom; - public static final int[] minimapSizes; - public static final int[] bufferSizes; - public static final int[] FBOMinimapSizes; - public static final int[] FBOBufferSizes; - public static boolean triedFBO; - public static boolean loadedFBO; - public static DynamicTexture mapTexture; - public static Framebuffer scalingFrameBuffer; - public static Framebuffer rotationFrameBuffer; - public static int mapUpdateX; - public static int mapUpdateZ; - - public static int getLoadSide() { - return Minimap.enlargedMap ? 31 : Minimap.FBOMinimapSizes[2]; - } - - public static int getUpdateRadius() { - return (int)Math.ceil(Minimap.loadingSide); - } - - public Minimap(final Interface i) { - this.loadedCaving = -1; - this.loadingCaving = -1; - this.loadingMapX = 0; - this.loadingMapZ = 0; - this.loadedMapX = 0; - this.loadedMapZ = 0; - this.minimapZoom = 1.0; - this.minimapWidth = 0; - this.minimapHeight = 0; - this.loader = new MapLoader(); - this.currentBlocks = new MinimapChunk[16][16]; - this.loadingBlocks = new MinimapChunk[16][16]; - this.previousTransparentBlock = null; - this.divider = 1.0f; - this.blockY = 0; - this.blockColor = 0; - this.isglowing = false; - this.lastBlockY = new int[16]; - this.drawYState = 0; - this.screen = i; - new Thread(this.loader).start(); - } - - public static int loadBlockColourFromTexture(final IBlockState state, final Block b, final BlockPos pos, final boolean convert) { - final int stateId = state.toString().hashCode(); - Integer c = Minimap.blockColours.get(stateId); - int red = 0; - int green = 0; - int blue = 0; - if (c == null) { - final TextureAtlasSprite texture = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(state); - String name = null; - try { - name = texture.getIconName() + ".png"; - if (b instanceof BlockGrass) { - name = "minecraft:blocks/grass_top.png"; - } - else if (b == Blocks.RED_MUSHROOM_BLOCK) { - name = "minecraft:blocks/mushroom_block_skin_red.png"; - } - else if (b == Blocks.BROWN_MUSHROOM_BLOCK) { - name = "minecraft:blocks/mushroom_block_skin_brown.png"; - } - else if (b instanceof BlockOre && b != Blocks.QUARTZ_ORE) { - name = "minecraft:blocks/stone.png"; - } - if (convert) { - name = name.replaceAll("_side", "_top").replaceAll("_front.png", "_top.png"); - } - c = -1; - String[] args = name.split(":"); - if (args.length < 2) { - args = new String[] { "minecraft", args[0] }; - } - final Integer cachedColour = Minimap.textureColours.get(name); - if (cachedColour == null) { - final ResourceLocation location = new ResourceLocation(args[0], "textures/" + args[1]); - final IResource resource = Minecraft.getMinecraft().getResourceManager().getResource(location); - final InputStream input = resource.getInputStream(); - final BufferedImage img = TextureUtil.readBufferedImage(input); - red = 0; - green = 0; - blue = 0; - int total = 64; - final int tw = img.getWidth(); - final int diff = tw / 8; - for (int i = 0; i < 8; ++i) { - for (int j = 0; j < 8; ++j) { - final int rgb = img.getRGB(i * diff, j * diff); - if (rgb == 0) { - --total; - } - else { - red += (rgb >> 16 & 0xFF); - green += (rgb >> 8 & 0xFF); - blue += (rgb & 0xFF); - } - } - } - input.close(); - if (total == 0) { - total = 1; - } - red /= total; - green /= total; - blue /= total; - c = (0xFF000000 | red << 16 | green << 8 | blue); - Minimap.textureColours.put(name, c); - } - else { - c = cachedColour; - } - } - catch (FileNotFoundException e) { - if (convert) { - return loadBlockColourFromTexture(state, b, pos, false); - } - c = b.getMapColor(state, mc.world, pos).colorValue; - if (name != null) { - Minimap.textureColours.put(name, c); - } - System.out.println("Block file not found: " + b.getLocalizedName()); - } - catch (Exception e2) { - c = b.getMapColor(state, mc.world, pos).colorValue; - if (name != null) { - Minimap.textureColours.put(name, c); - } - System.out.println("Block " + b.getLocalizedName() + " has no texture, using material colour."); - } - if (c != null) { - Minimap.blockColours.put(stateId, c); - } - } - final int grassColor = b.getMapColor(state, Minecraft.getMinecraft().world, pos).colorValue; - if (grassColor != 16777215) { - final float rMultiplier = (c >> 16 & 0xFF) / 255.0f; - final float gMultiplier = (c >> 8 & 0xFF) / 255.0f; - final float bMultiplier = (c & 0xFF) / 255.0f; - red = (int)((grassColor >> 16 & 0xFF) * rMultiplier); - green = (int)((grassColor >> 8 & 0xFF) * gMultiplier); - blue = (int)((grassColor & 0xFF) * bMultiplier); - c = (0xFF000000 | red << 16 | green << 8 | blue); - } - return c; - } - - public boolean applyTransparentBlock(final Chunk bchunk, final Block b, final IBlockState state, final BlockPos globalPos, final BlockPos pos) { - int red = 0; - int green = 0; - int blue = 0; - int intensity = 1; - boolean skip = false; - if (b instanceof BlockLiquid && b.getLightOpacity(state) != 255 && b.getLightOpacity(state) != 0) { - final int waterColor = loadBlockColourFromTexture(state, b, globalPos, true); - red = (waterColor >> 16 & 0xFF); - green = (waterColor >> 8 & 0xFF); - blue = (waterColor & 0xFF); - intensity = 2; - skip = true; - } - else if (/*(b.getBlockLayer() == EnumWorldBlockLayer.TRANSLUCENT ||*/ b instanceof BlockGlass) { - final int glassColor = loadBlockColourFromTexture(state, b, globalPos, true); - red = (glassColor >> 16 & 0xFF); - green = (glassColor >> 8 & 0xFF); - blue = (glassColor & 0xFF); - skip = true; - } - if (skip) { - if (this.previousTransparentBlock == null) { - this.postBrightness = this.getBlockBrightness(bchunk, new BlockPos(pos.getX(), Math.min(pos.getY() + 1, 255), pos.getZ()), 5.0f, this.sun, true); - } - final int rgb = red << 16 | green << 8 | blue; - if (this.previousTransparentBlock == null || this.previousTransparentBlock != rgb) { - this.previousTransparentBlock = rgb; - final float overlayIntensity = intensity * this.getBlockBrightness(bchunk, new BlockPos(pos.getX(), Math.min(pos.getY() + 1, 255), pos.getZ()), 5.0f, this.sun, false); - if (this.isGlowing(b)) { - final int[] colours = this.getBrightestColour(red, green, blue); - red = colours[0]; - green = colours[1]; - blue = colours[2]; - } - this.divider += overlayIntensity; - this.underRed += (int)(red * overlayIntensity); - this.underGreen += (int)(green * overlayIntensity); - this.underBlue += (int)(blue * overlayIntensity); - } - this.sun -= b.getLightOpacity(state); - if (this.sun < 0) { - this.sun = 0; - } - } - return skip; - } - - public Block findBlock(final Chunk bchunk, final int insideX, final int insideZ, final int highY, final int lowY) { - boolean underair = false; - for (int i = highY; i >= lowY; --i) { - IBlockState state1 = bchunk.getBlockState(insideX, i, insideZ); - final IBlockState got = state1; - if (!(got instanceof BlockAir) && (underair || this.loadingCaving == -1)) { - if (state1.getRenderType() != EnumBlockRenderType.INVISIBLE) { - if (got != Blocks.TORCH) { - if (got != Blocks.TALLGRASS) { - this.blockY = i; - int color = 0; - final BlockPos pos = new BlockPos(insideX, this.blockY, insideZ); - final BlockPos globalPos = this.getGlobalBlockPos(bchunk.x, bchunk.z, insideX, this.blockY, insideZ); - IBlockState state = bchunk.getBlockState(pos); - state = state1.getActualState(mc.world, globalPos); - if (!this.applyTransparentBlock(bchunk, got.getBlock(), state, globalPos, pos)) { - color = loadBlockColourFromTexture(state, got.getBlock(), globalPos, true); - if (color != 0) { - this.blockColor = color; - return got.getBlock(); - } - } - } - } - } - } - else if (got instanceof BlockAir) { - underair = true; - } - } - return null; - } - - public BlockPos getGlobalBlockPos(final int chunkX, final int chunkZ, final int x, final int y, final int z) { - return new BlockPos(chunkX * 16 + x, y, chunkZ * 16 + z); - } - - public float getBlockBrightness(final Chunk c, final BlockPos pos, final float min, final int sun, final boolean dayLight) { - return (min + Math.max((dayLight ? Minimap.sunBrightness : 1.0f) * c.getLightFor(EnumSkyBlock.SKY, pos), c.getLightFor(EnumSkyBlock.BLOCK, pos))) / (15.0f + min); - } - - public int[] getBrightestColour(int r, int g, int b) { - final int max = Math.max(r, Math.max(g, b)); - if (max == 0) { - return new int[] { r, g, b }; - } - r = 255 * r / max; - g = 255 * g / max; - b = 255 * b / max; - return new int[] { r, g, b }; - } - - public boolean isGlowing(final Block b) { - return b.getLightValue(b.getDefaultState()) >= 0.5; - } - - public void loadBlockColor(final int par1, final int par2, final Chunk bchunk, final int chunkX, final int chunkZ) { - final int insideX = par1 & 0xF; - final int insideZ = par2 & 0xF; - final int playerY = (int)Minimap.mc.player.posY; - final int height = bchunk.getHeightValue(insideX, insideZ); - final int highY = (this.loadingCaving != -1) ? this.loadingCaving : (height + 3); - int lowY = (this.loadingCaving != -1) ? (playerY - 30) : 0; - if (lowY < 0) { - lowY = 0; - } - this.blockY = 0; - this.blockColor = 0; - this.underRed = 0; - this.underGreen = 0; - this.underBlue = 0; - this.divider = 1.0f; - this.sun = 15; - this.previousTransparentBlock = null; - this.postBrightness = 1.0f; - this.isglowing = false; - final Block block = this.findBlock(bchunk, insideX, insideZ, highY, lowY); - this.isglowing = (block != null && !(block instanceof BlockOre) && this.isGlowing(block)); - float brightness = 1.0f; - final BlockPos pos = new BlockPos(insideX, Math.min(this.blockY + 1, 255), insideZ); - brightness = this.getBlockBrightness(bchunk, pos, 5.0f, this.sun, this.previousTransparentBlock == null); - - double secondaryB = 1.0; - if (this.lastBlockY[insideX] <= 0) { - this.lastBlockY[insideX] = this.blockY; - final Chunk prevChunk = Minimap.mc.world.getChunk(this.loadingMapX + chunkX, this.loadingMapZ + chunkZ - 1); - if (prevChunk != null && prevChunk.isLoaded()) { - this.lastBlockY[insideX] = prevChunk.getHeightValue(insideX, 15) - 1; - } - } - if (this.blockY < this.lastBlockY[insideX]) { - secondaryB -= 0.15; - } - if (this.blockY > this.lastBlockY[insideX]) { - secondaryB += 0.15; - } - brightness *= (float)secondaryB; - this.lastBlockY[insideX] = this.blockY; - if (this.blockColor == 0) { - this.blockColor = 1; - } - int l = this.blockColor >> 16 & 0xFF; - int i1 = this.blockColor >> 8 & 0xFF; - int j1 = this.blockColor & 0xFF; - if (this.isglowing) { - final int[] colours = this.getBrightestColour(l, i1, j1); - l = colours[0]; - i1 = colours[1]; - j1 = colours[2]; - } - l = (int)((l * brightness + this.underRed) / this.divider * this.postBrightness); - if (l > 255) { - l = 255; - } - i1 = (int)((i1 * brightness + this.underGreen) / this.divider * this.postBrightness); - if (i1 > 255) { - i1 = 255; - } - j1 = (int)((j1 * brightness + this.underBlue) / this.divider * this.postBrightness); - if (j1 > 255) { - j1 = 255; - } - this.blockColor = (0xFF000000 | l << 16 | i1 << 8 | j1); - if (chunkX < 0 || chunkX >= Minimap.loadingSide || chunkZ < 0 || chunkZ >= Minimap.loadingSide) { - return; - } - MinimapChunk[] chunkmap = this.loadingBlocks[chunkX]; - if (chunkmap == null) { - chunkmap = new MinimapChunk[Minimap.loadingSide]; - this.loadingBlocks[chunkX] = chunkmap; - } - MinimapChunk chunk = chunkmap[chunkZ]; - if (chunk == null) { - chunk = new MinimapChunk(bchunk.x, bchunk.z); - chunkmap[chunkZ] = chunk; - } - chunk.colors[insideX][insideZ] = this.blockColor; - } - - public int getMapCoord(final int side, final double coord) { - return (myFloor(coord) >> 4) - side / 2; - } - - public int getLoadedBlockColor(final int par1, final int par2) { - final int cX = (par1 >> 4) - this.loadedMapX; - final int cZ = (par2 >> 4) - this.loadedMapZ; - if (cX < 0 || cX >= Minimap.loadedSide || cZ < 0 || cZ >= Minimap.loadedSide) { - return 1; - } - final MinimapChunk current = this.currentBlocks[cX][cZ]; - if (current != null) { - return this.chunkOverlay(current.colors[par1 & 0xF][par2 & 0xF], current); - } - return 1; - } - - public MinimapChunk[] getLoadedYChunks(final int par1) { - final int cX = (par1 >> 4) - this.loadedMapX; - if (cX < 0 || cX >= Minimap.loadedSide) { - return null; - } - return this.currentBlocks[cX]; - } - - public int getLoadedBlockColor(final MinimapChunk[] yChunks, final int par1, final int par2) { - final int cZ = (par2 >> 4) - this.loadedMapZ; - if (cZ < 0 || cZ >= Minimap.loadedSide) { - return 1; - } - final MinimapChunk current = yChunks[cZ]; - if (current != null) { - return this.chunkOverlay(current.colors[par1 & 0xF][par2 & 0xF], current); - } - return 1; - } - - public int chunkOverlay(final int color, final MinimapChunk c) { - return color; - } - - public static double getRenderAngle() { - return getActualAngle(); - } - - public static double getActualAngle() { - double rotation = Minimap.mc.player.rotationYaw; - if (rotation < 0.0 || rotation > 360.0) { - rotation %= 360.0; - } - double angle = 270.0 - rotation; - if (angle < 0.0 || angle > 360.0) { - angle %= 360.0; - } - return angle; - } - - public double getZoom() { - return this.minimapZoom; - } - - public void updateZoom() { - double target = 2 * ((this.loadedCaving != -1) ? 3.0f : 1.0f); - - double off = target - this.minimapZoom; - if (off > 0.01 || off < -0.01) { - off = (float) MinimapAnimation.animate(off, 0.8); - } - else { - off = 0.0; - } - this.minimapZoom = target - off; - } - - public static double getEntityX(final Entity e, final float partial) { - return e.lastTickPosX + (e.posX - e.lastTickPosX) * partial; - } - - public static double getEntityZ(final Entity e, final float partial) { - return e.lastTickPosZ + (e.posZ - e.lastTickPosZ) * partial; - } - - public static void resetImage() { - Minimap.toResetImage = true; - } - - public static int myFloor(double d) { - if (d < 0.0) { - --d; - } - return (int)d; - } - - public int getMinimapWidth() { - return 149; - } - - public int getBufferSize() { - return Minimap.enlargedMap ? 512 : Minimap.bufferSizes[2]; - } - - public int getFBOBufferSize() { - return Minimap.enlargedMap ? 512 : Minimap.FBOBufferSizes[2]; - } - - public static boolean usingFBO() { - return Minimap.loadedFBO; - } - - public void updateMapFrame(final int bufferSize, final float partial) { - if (Minimap.toResetImage || usingFBO()) { - this.bytes = new byte[bufferSize * bufferSize * 3]; - Minimap.toResetImage = false; - } - final int increaseY = 2; - int mapW = 0; - int mapH = 0; - int halfW = 0; - int halfH = 0; - if (!usingFBO()) { - mapW = (mapH = this.getMinimapWidth()); - halfW = (mapW + 1) / 2; - halfH = (mapH + 1) / 2; - } - final double halfWZoomed = halfW / Minimap.zoom; - final double halfHZoomed = halfH / Minimap.zoom; - if (usingFBO()) { - final int chunkAmount = Minimap.loadedSide; - final int actualSize = getLoadSide(); - Minimap.mapUpdateX = this.getMapCoord(actualSize, getEntityX(Minimap.mc.player, partial)); - Minimap.mapUpdateZ = this.getMapCoord(actualSize, getEntityZ(Minimap.mc.player, partial)); - final int chunkOffsetX = Minimap.mapUpdateX - this.loadedMapX; - final int chunkOffsetZ = Minimap.mapUpdateZ - this.loadedMapZ; - mapW = (mapH = Math.min(bufferSize, actualSize * 16)); - final double corner = Minimap.enlargedMap ? 0.0 : ((double)(int)(actualSize * (Math.sqrt(2.0) - 1.0) / Math.sqrt(2.0))); - final int cornerZoomed = (int)(corner + actualSize * Math.sqrt(0.5) * (1.0 - 1.0 / Minimap.zoom) - 1.0); - final int thing = actualSize - 1; - for (int chunkX = 0; chunkX < chunkAmount - chunkOffsetX; ++chunkX) { - final int transformedX = chunkX + chunkOffsetX; - if (transformedX >= 0) { - if (transformedX < chunkAmount) { - final MinimapChunk[] yChunks = this.currentBlocks[transformedX]; - if (yChunks != null) { - final int drawX = 16 * chunkX; - for (int chunkZ = 0; chunkZ < yChunks.length - chunkOffsetZ; ++chunkZ) { - if (chunkX + chunkZ >= cornerZoomed && thing - chunkZ + chunkX >= cornerZoomed && thing - chunkX + chunkZ >= cornerZoomed) { - if (2 * thing - chunkX - chunkZ >= cornerZoomed) { - final int transformedZ = chunkZ + chunkOffsetZ; - if (transformedZ >= 0) { - if (transformedZ < chunkAmount) { - final MinimapChunk c = yChunks[transformedZ]; - if (c != null) { - final int drawY = 16 * chunkZ; - for (int insideX = 0; insideX < 16; ++insideX) { - final int[] blocks = c.colors[insideX]; - final int pixelX = drawX + insideX; - if (pixelX <= mapW) { - if (pixelX >= 0) { - for (int insideZ = 0; insideZ < 16; ++insideZ) { - final int pixelY = drawY + insideZ; - if (pixelY >= 0) { - if (pixelY <= mapH) { - this.putColor(this.bytes, pixelX, pixelY, blocks[insideZ] == -16777216 ? 0xff8cafff : this.chunkOverlay(blocks[insideZ], c), bufferSize); - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - else { - byte currentState = this.drawYState; - final double angle = Math.toRadians(getRenderAngle()); - final double ps = Math.sin(3.141592653589793 - angle); - final double pc = Math.cos(3.141592653589793 - angle); - final double playerX = getEntityX(Minimap.mc.player, partial); - final double playerZ = getEntityZ(Minimap.mc.player, partial); - for (int currentX = 0; currentX <= mapW + 1; ++currentX) { - final double currentXZoomed = currentX / Minimap.zoom; - final double offx = currentXZoomed - halfWZoomed; - final double psx = ps * offx; - final double pcx = pc * offx; - for (int currentY = currentState; currentY <= mapH + 1; currentY += increaseY) { - final double offy = currentY / Minimap.zoom - halfHZoomed; - this.putColor(this.bytes, currentX, currentY, this.getLoadedBlockColor(myFloor(playerX + psx + pc * offy), myFloor(playerZ + ps * offy - pcx)), bufferSize); - } - currentState = (byte)((currentState != 1) ? 1 : 0); - } - this.drawYState = (byte)((this.drawYState != 1) ? 1 : 0); - final ByteBuffer buffer = Minimap.mapTexture.getBuffer(bufferSize); - buffer.put(this.bytes); - buffer.flip(); - } - } - - private int getCaving() { - final int x = myFloor(Minimap.mc.player.posX); - final int y = Math.max((int)Minimap.mc.player.posY + 1, 0); - final int z = myFloor(Minimap.mc.player.posZ); - final int chunkX = x >> 4; - final int chunkZ = z >> 4; - final int insideX = x & 0xF; - final int insideZ = z & 0xF; - final Chunk bchunk = Minimap.mc.world.getChunk(chunkX, chunkZ); - final int top = bchunk.getHeightValue(insideX, insideZ); - if (y < top) { - for (int i = y; i < top; ++i) { - final IBlockState got = bchunk.getBlockState(insideX, i, insideZ); - if (got.getMaterial().isOpaque()) { - return Math.min(y + 3, i); - } - } - } - return -1; - } - - private void putColor(final byte[] bytes, final int x, final int y, final int color, final int size) { - int pixel = (y * size + x) * 3; - bytes[pixel] = (byte)(color >> 16 & 0xFF); - bytes[++pixel] = (byte)(color >> 8 & 0xFF); - bytes[++pixel] = (byte)(color & 0xFF); - } - - public static void loadFrameBuffer() { - if (!GLContext.getCapabilities().GL_EXT_framebuffer_object) { - System.out.println("FBO not supported! Using minimap safe mode."); - } - else { - if (!Minecraft.getMinecraft().gameSettings.fboEnable) { - Minecraft.getMinecraft().gameSettings.setOptionValue(GameSettings.Options.FBO_ENABLE, 0); - System.out.println("FBO is supported but off. Turning it on."); - } - Minimap.scalingFrameBuffer = new Framebuffer(512, 512, false); - Minimap.rotationFrameBuffer = new Framebuffer(512, 512, false); - Minimap.loadedFBO = (Minimap.scalingFrameBuffer.framebufferObject != -1); - } - Minimap.triedFBO = true; - } - - public void renderFrameToFBO(final int bufferSize, final int viewW, final float sizeFix, final float partial, final boolean retryIfError) { - Minimap.updatePause = true; - final int chunkAmount = getLoadSide(); - final int mapW = chunkAmount * 16; - final double playerX = getEntityX(Minimap.mc.player, partial); - final double playerZ = getEntityZ(Minimap.mc.player, partial); - final int xFloored = myFloor(playerX); - final int zFloored = myFloor(playerZ); - int offsetX = xFloored & 0xF; - int offsetZ = zFloored & 0xF; - final int mapX = this.getMapCoord(chunkAmount, playerX); - final int mapZ = this.getMapCoord(chunkAmount, playerZ); - final boolean zooming = (int)Minimap.zoom != Minimap.zoom; - final ByteBuffer buffer = Minimap.mapTexture.getBuffer(bufferSize); - if (mapX != Minimap.mapUpdateX || mapZ != Minimap.mapUpdateZ || zooming || !retryIfError) { - if (!Minimap.frameIsUpdating) { - Minimap.frameIsUpdating = true; - this.updateMapFrame(bufferSize, partial); - Minimap.frameIsUpdating = false; - buffer.put(this.bytes); - buffer.flip(); - Minimap.bufferSizeToUpdate = -1; - Minimap.frameUpdateNeeded = false; - } - else { - offsetX += 16 * (mapX - Minimap.mapUpdateX); - offsetZ += 16 * (mapZ - Minimap.mapUpdateZ); - } - } - Minimap.scalingFrameBuffer.bindFramebuffer(true); - GL11.glClear(16640); - GL11.glEnable(3553); - RenderHelper.disableStandardItemLighting(); - try { - bindTextureBuffer(buffer, bufferSize, bufferSize, Minimap.mapTexture.getGlTextureId()); - } - catch (Exception e) { - if (retryIfError) { - System.out.println("Error when binding texture buffer. Retrying..."); - this.renderFrameToFBO(bufferSize, viewW, sizeFix, partial, false); - } - else { - System.out.println("Error after retrying... :( Please report to Xaero96 on MinecraftForum of PlanetMinecraft!"); - } - } - - if (!zooming) { - GL11.glTexParameteri(3553, 10240, 9728); - } - else { - GL11.glTexParameteri(3553, 10240, 9729); - } - GlStateManager.clear(256); - GlStateManager.matrixMode(5889); - GL11.glPushMatrix(); - GlStateManager.loadIdentity(); - GlStateManager.ortho(0.0, 512.0, 512.0, 0.0, 1000.0, 3000.0); - GlStateManager.matrixMode(5888); - GL11.glPushMatrix(); - GlStateManager.loadIdentity(); - - double xInsidePixel = getEntityX(Minimap.mc.player, partial) - xFloored; - if (xInsidePixel < 0.0) { - ++xInsidePixel; - } - double zInsidePixel = getEntityZ(Minimap.mc.player, partial) - zFloored; - if (zInsidePixel < 0.0) { - ++zInsidePixel; - } - zInsidePixel = 1.0 - zInsidePixel; - final float halfW = mapW / 2.0f; - final float halfWView = viewW / 2.0f; - final float angle = (float)(90.0 - getRenderAngle()); - GlStateManager.translate(256.0f, 256.0f, -2000.0f); - GlStateManager.scale(Minimap.zoom, Minimap.zoom, 1.0); - drawMyTexturedModalRect(-halfW - offsetX + 8.0f, -halfW - offsetZ + 7.0f, 0, 0, mapW + offsetX, mapW + offsetZ, bufferSize); - Minimap.scalingFrameBuffer.unbindFramebuffer(); - Minimap.rotationFrameBuffer.bindFramebuffer(false); - GL11.glClear(16640); - Minimap.scalingFrameBuffer.bindFramebufferTexture(); - GlStateManager.loadIdentity(); - GL11.glTexParameteri(3553, 10240, 9729); - GL11.glTexParameteri(3553, 10241, 9729); - GlStateManager.translate(halfWView + 0.5f, 511.5f - halfWView, -2000.0f); - GL11.glRotatef(angle, 0.0f, 0.0f, 1.0f); - GL11.glPushMatrix(); - GlStateManager.translate(-xInsidePixel * Minimap.zoom, -zInsidePixel * Minimap.zoom, 0.0); - GlStateManager.disableBlend(); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 100.0f); - drawMyTexturedModalRect(-256.0f, -256.0f, 0, 0, 512.0f, 512.0f, 512.0f); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - GL11.glPopMatrix(); - - GL11.glTexParameteri(3553, 10240, 9729); - GL11.glTexParameteri(3553, 10241, 9729); - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(770, 771, 1, 771); - GL11.glTexParameteri(3553, 10240, 9728); - GL11.glTexParameteri(3553, 10241, 9728); - Minimap.rotationFrameBuffer.unbindFramebuffer(); - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - GlStateManager.disableBlend(); - Minimap.updatePause = false; - GlStateManager.matrixMode(5889); - GL11.glPopMatrix(); - GlStateManager.matrixMode(5888); - GL11.glPopMatrix(); - } - - private static void drawMyTexturedModalRect(final float x, final float y, final int textureX, final int textureY, final float width, final float height, final float factor) { - float f = 1.0F / factor; - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder worldrenderer = tessellator.getBuffer(); - - worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldrenderer.pos(x + 0.0F, y + height, 0.0D).tex((float) (textureX) * f, ((float) textureY + height) * f).endVertex(); - worldrenderer.pos(x + width, y + height, 0.0D).tex(((float) textureX + width) * f, ((float) textureY + height) * f).endVertex(); - worldrenderer.pos(x + width, y + 0.0F, 0.0D).tex(((float) textureX + width) * f, (float) (textureY) * f).endVertex(); - worldrenderer.pos(x + 0.0F, y + 0.0F, 0.0D).tex((float) (textureX) * f, (float) (textureY) * f).endVertex(); - tessellator.draw(); - } - - public static void bindTextureBuffer(final ByteBuffer image, final int width, final int height, final int par0) { - GL11.glBindTexture(3553, par0); - GL11.glTexImage2D(3553, 0, 6407, width, height, 0, 6407, 5121, image); - } - - public static boolean shouldRenderEntity(final Entity e) { - return !e.isSneaking() && !e.isInvisible(); - } - - static { - Minimap.loadingSide = 16; - Minimap.loadedSide = 16; - Minimap.updateRadius = 16; - Minimap.enlargedMap = false; - Minimap.mc = Minecraft.getMinecraft(); - radarPlayers = new Color(255, 255, 255); - radarShadow = new Color(0, 0, 0); - Minimap.loadedPlayers = new ArrayList(); - Minimap.loadedLiving = new ArrayList(); - Minimap.loadedHostile = new ArrayList(); - Minimap.loadedItems = new ArrayList(); - Minimap.loadedEntities = new ArrayList(); - Minimap.blocksLoaded = 0; - Minimap.frameIsUpdating = false; - Minimap.frameUpdateNeeded = false; - Minimap.bufferSizeToUpdate = -1; - Minimap.frameUpdatePartialTicks = 1.0f; - Minimap.updatePause = false; - Minimap.textureColours = new HashMap(); - Minimap.blockColours = new HashMap(); - Minimap.clearBlockColours = false; - Minimap.toResetImage = true; - Minimap.zoom = 1.0; - minimapSizes = new int[] { 112, 168, 224, 336 }; - bufferSizes = new int[] { 128, 256, 256, 512 }; - FBOMinimapSizes = new int[] { 11, 17, 21, 31 }; - FBOBufferSizes = new int[] { 256, 512, 512, 512 }; - Minimap.triedFBO = false; - Minimap.loadedFBO = false; - Minimap.mapTexture = new DynamicTexture(InterfaceHandler.mapTextures); - } - - public class MapLoader implements Runnable - { - @Override - public void run() { - int updateChunkX = 0; - int updateChunkZ = 0; - while (true) { - final long before = System.currentTimeMillis(); - boolean sleep = true; - try { - if (Minimap.mc.player == null || Minimap.mc.world == null) { - Thread.sleep(100L); - } - else { - if (updateChunkX == 0 && updateChunkZ == 0) { - if (Minimap.clearBlockColours) { - Minimap.clearBlockColours = false; - if (!Minimap.blockColours.isEmpty()) { - Minimap.blockColours.clear(); - Minimap.textureColours.clear(); - } - } - Minimap.sunBrightness = Minimap.mc.world.getSunBrightness(1.0f); - Minimap.loadingSide = Minimap.getLoadSide(); - Minimap.updateRadius = Minimap.getUpdateRadius(); - Minimap.this.loadingMapX = Minimap.this.getMapCoord(Minimap.loadingSide, Minimap.mc.player.posX); - Minimap.this.loadingMapZ = Minimap.this.getMapCoord(Minimap.loadingSide, Minimap.mc.player.posZ); - Minimap.this.loadingCaving = Minimap.this.getCaving(); - Minimap.this.loadingBlocks = new MinimapChunk[Minimap.loadingSide][Minimap.loadingSide]; - } - sleep = this.updateChunk(updateChunkX, updateChunkZ); - if (updateChunkX == Minimap.loadingSide - 1 && updateChunkZ == Minimap.loadingSide - 1) { - Minimap.this.currentBlocks = Minimap.this.loadingBlocks; - Minimap.loadedSide = Minimap.loadingSide; - Minimap.this.loadedMapX = Minimap.this.loadingMapX; - Minimap.this.loadedMapZ = Minimap.this.loadingMapZ; - Minimap.this.loadedCaving = Minimap.this.loadingCaving; - Minimap.frameUpdateNeeded = Minimap.usingFBO(); - } - updateChunkZ = (updateChunkZ + 1) % Minimap.loadingSide; - if (updateChunkZ == 0) { - updateChunkX = (updateChunkX + 1) % Minimap.loadingSide; - Minimap.this.lastBlockY = new int[16]; - final EntityPlayer p = Minimap.mc.player; - final ArrayList loadingPlayers = new ArrayList(); - final ArrayList loadingHostile = new ArrayList(); - final ArrayList loadingLiving = new ArrayList(); - final ArrayList loadingItems = new ArrayList(); - final ArrayList loadingEntities = new ArrayList(); - for (int i = 0; i < mc.world.loadedEntityList.size(); ++i) { - try { - final Entity e = mc.world.loadedEntityList.get(i); - int type = 0; - final double offx = e.posX - p.posX; - final double offy = e.posZ - p.posZ; - final double offh = p.posY - e.posY; - final double offheight2 = offh * offh; - final double offx2 = offx * offx; - final double offy2 = offy * offy; - final double maxDistance = 31250.0 / (Minimap.this.getZoom() * Minimap.this.getZoom()); - if (offx2 <= maxDistance && offy2 <= maxDistance && offheight2 <= 400.0) { - ArrayList typeList = loadingEntities; - switch (type) { - case 1: { - typeList = loadingPlayers; - break; - } - case 2: { - typeList = loadingHostile; - break; - } - case 3: { - typeList = loadingLiving; - break; - } - case 4: { - typeList = loadingItems; - break; - } - } - typeList.add(e); - if (typeList.size() >= 100) { - break; - } - } - } - catch (Exception e4) {} - } - Minimap.loadedPlayers = loadingPlayers; - Minimap.loadedHostile = loadingHostile; - Minimap.loadedLiving = loadingLiving; - Minimap.loadedItems = loadingItems; - Minimap.loadedEntities = loadingEntities; - } - if (!Minimap.frameIsUpdating && Minimap.frameUpdateNeeded) { - Minimap.frameUpdateNeeded = false; - Minimap.frameIsUpdating = true; - Minimap.bufferSizeToUpdate = Minimap.this.getFBOBufferSize(); - Minimap.this.updateMapFrame(Minimap.bufferSizeToUpdate, Minimap.frameUpdatePartialTicks); - Minimap.frameIsUpdating = false; - } - if (!Minimap.updatePause && Minimap.bufferSizeToUpdate != -1) { - final ByteBuffer buffer = Minimap.mapTexture.getBuffer(Minimap.bufferSizeToUpdate); - buffer.put(Minimap.this.bytes); - buffer.flip(); - Minimap.bufferSizeToUpdate = -1; - } - } - } - catch (Exception e2) { - e2.printStackTrace(); - Minimap.frameIsUpdating = false; - } - final int passed = (int)(System.currentTimeMillis() - before); - try { - if (sleep && passed <= 5) { - Thread.sleep(5 - passed); - } - else { - Thread.sleep(1L); - } - } - catch (InterruptedException e3) { - e3.printStackTrace(); - } - } - } - - public boolean updateChunk(final int x, final int z) { - final int chunkX = Minimap.this.loadingMapX + x; - final int chunkZ = Minimap.this.loadingMapZ + z; - final int halfSide = Minimap.loadingSide / 2; - final int fromCenterX = x - halfSide; - final int fromCenterZ = z - halfSide; - final int xOld = chunkX - Minimap.this.loadedMapX; - final int zOld = chunkZ - Minimap.this.loadedMapZ; - MinimapChunk current = null; - if (Minimap.this.currentBlocks != null && xOld > -1 && xOld < Minimap.this.currentBlocks.length && zOld > -1 && zOld < Minimap.this.currentBlocks.length) { - current = Minimap.this.currentBlocks[xOld][zOld]; - } - final Chunk bchunk = Minimap.mc.world.getChunk(chunkX, chunkZ); - if ((int)Minimap.zoom == Minimap.zoom && (!bchunk.isLoaded() || ((fromCenterX > Minimap.updateRadius || fromCenterZ > Minimap.updateRadius || fromCenterX < -Minimap.updateRadius || fromCenterZ < -Minimap.updateRadius) && current != null))) { - if (current != null) { - Minimap.this.loadingBlocks[x][z] = current; - System.arraycopy(current.lastHeights, 0, Minimap.this.lastBlockY, 0, 16); - } - else { - Minimap.this.lastBlockY = new int[16]; - } - return false; - } - final int x2 = chunkX * 16; - final int z2 = chunkZ * 16; - for (int blockX = x2; blockX < x2 + 16; ++blockX) { - for (int blockZ = z2; blockZ < z2 + 16; ++blockZ) { - Minimap.this.loadBlockColor(blockX, blockZ, bchunk, x, z); - if ((blockZ & 0xF) == 0xF) { - Minimap.this.loadingBlocks[x][z].lastHeights[blockX & 0xF] = Minimap.this.lastBlockY[blockX & 0xF]; - } - } - } - return true; - } - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/Constants.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/Constants.java deleted file mode 100644 index 4b799ad3..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/Constants.java +++ /dev/null @@ -1,21 +0,0 @@ -package top.fpsmaster.wrapper; - -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.provider.client.IConstantsProvider; - -public class Constants implements IConstantsProvider { - public static final String VERSION = "1.12.2"; - public static final String EDITION = "Forge"; - - @NotNull - @Override - public String getVersion() { - return VERSION; - } - - @NotNull - @Override - public String getEdition() { - return EDITION; - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/EffectRendererProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/EffectRendererProvider.java deleted file mode 100644 index 20eb928a..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/EffectRendererProvider.java +++ /dev/null @@ -1,16 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.wrapper.EffectRendererWrap; -import top.fpsmaster.wrapper.blockpos.WrapperBlockPos; - -import static top.fpsmaster.utils.Utility.mc; - -public class EffectRendererProvider implements EffectRendererWrap { - @Override - public void addRedStoneBreak(@NotNull WrapperBlockPos pos) { - mc.effectRenderer.addBlockDestroyEffects(pos.getPos(), Blocks.REDSTONE_BLOCK.getBlockState().getBaseState()); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/GameSettingsProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/GameSettingsProvider.java deleted file mode 100644 index 9a06f60f..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/GameSettingsProvider.java +++ /dev/null @@ -1,11 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.client.settings.KeyBinding; -import top.fpsmaster.forge.api.IKeyBinding; -import top.fpsmaster.api.wrapper.GameSettingsWrap; - -public class GameSettingsProvider implements GameSettingsWrap { - public void setKeyPress(KeyBinding key, boolean value){ - ((IKeyBinding) key).setPressed(value); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/GuiIngameProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/GuiIngameProvider.java deleted file mode 100644 index de2676f4..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/GuiIngameProvider.java +++ /dev/null @@ -1,168 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.Entity; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.IAttributeInstance; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.MobEffects; -import net.minecraft.potion.Potion; -import net.minecraft.util.math.MathHelper; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.wrapper.GuiIngameWrap; - -import java.util.Random; - -import static net.minecraft.client.gui.Gui.ICONS; -import static top.fpsmaster.utils.Utility.mc; - -public class GuiIngameProvider implements GuiIngameWrap { - protected static final Random rand = new Random(); - protected static int playerHealth = 0; - protected static int lastPlayerHealth = 0; - protected static long lastSystemTime = 0L; - protected static long healthUpdateCounter = 0L; - - public void drawHealth(@NotNull Entity entity) { - if (!(entity instanceof EntityPlayer)) - return; - mc.getTextureManager().bindTexture(ICONS); - GlStateManager.enableBlend(); - GlStateManager.enableTexture2D(); - EntityPlayer entityPlayer = (EntityPlayer) entity; - int i = MathHelper.ceil(entityPlayer.getHealth()); - boolean bl = healthUpdateCounter > (long) mc.ingameGUI.getUpdateCounter() && (healthUpdateCounter - (long) mc.ingameGUI.getUpdateCounter()) / 3L % 2L == 1L; - if (i < playerHealth && entityPlayer.hurtResistantTime > 0) { - lastSystemTime = Minecraft.getSystemTime(); - healthUpdateCounter = mc.ingameGUI.getUpdateCounter() + 20; - } else if (i > playerHealth && entityPlayer.hurtResistantTime > 0) { - lastSystemTime = Minecraft.getSystemTime(); - healthUpdateCounter = mc.ingameGUI.getUpdateCounter() + 10; - } - - if (Minecraft.getSystemTime() - lastSystemTime > 1000L) { - playerHealth = i; - lastPlayerHealth = i; - lastSystemTime = Minecraft.getSystemTime(); - } - - playerHealth = i; - int j = lastPlayerHealth; - rand.setSeed(mc.ingameGUI.getUpdateCounter() * 312871L); - IAttributeInstance iAttributeInstance = entityPlayer.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH); - int m = -45; - int o = -10; - float f = (float) iAttributeInstance.getAttributeValue(); - float g = entityPlayer.getAbsorptionAmount(); - int p = MathHelper.ceil((f + g) / 2.0F / 10.0F); - int q = Math.max(10 - (p - 2), 3); - int r = o - (p - 1) * q - 10; - float h = g; - int s = entityPlayer.getTotalArmorValue(); - int t = -1; - if (entityPlayer.isPotionActive(MobEffects.REGENERATION)) { - t = mc.ingameGUI.getUpdateCounter() % MathHelper.ceil(f + 5.0F); - } - - int u; - int v; - for (u = 0; u < 10; ++u) { - if (s > 0) { - v = m + u * 8; - if (u * 2 + 1 < s) { - drawTexturedModalRect(v, r, 34, 9, 9, 9); - } - - if (u * 2 + 1 == s) { - drawTexturedModalRect(v, r, 25, 9, 9, 9); - } - - if (u * 2 + 1 > s) { - drawTexturedModalRect(v, r, 16, 9, 9, 9); - } - } - } - - int w; - int x; - int y; - int z; - int aa; - for (u = MathHelper.ceil((f + g) / 2.0F) - 1; u >= 0; --u) { - v = 16; - if (entityPlayer.isPotionActive(MobEffects.POISON)) { - v += 36; - } else if (entityPlayer.isPotionActive(MobEffects.WITHER)) { - v += 72; - } - - w = 0; - if (bl) { - w = 1; - } - - x = MathHelper.ceil((float) (u + 1) / 10.0F) - 1; - y = m + u % 10 * 8; - z = o - x * q; - if (i <= 4) { - z += rand.nextInt(2); - } - - if (u == t) { - z -= 2; - } - - aa = 0; - if (entityPlayer.world.getWorldInfo().isHardcoreModeEnabled()) { - aa = 5; - } - - drawTexturedModalRect(y, z, 16 + w * 9, 9 * aa, 9, 9); - if (bl) { - if (u * 2 + 1 < j) { - drawTexturedModalRect(y, z, v + 54, 9 * aa, 9, 9); - } - - if (u * 2 + 1 == j) { - drawTexturedModalRect(y, z, v + 63, 9 * aa, 9, 9); - } - } - - if (h > 0.0F) { - if (h == g && g % 2.0F == 1.0F) { - drawTexturedModalRect(y, z, v + 153, 9 * aa, 9, 9); - } else { - drawTexturedModalRect(y, z, v + 144, 9 * aa, 9, 9); - } - - h -= 2.0F; - } else { - if (u * 2 + 1 < i) { - drawTexturedModalRect(y, z, v + 36, 9 * aa, 9, 9); - } - - if (u * 2 + 1 == i) { - drawTexturedModalRect(y, z, v + 45, 9 * aa, 9, 9); - } - } - } - GlStateManager.disableTexture2D(); - } - - public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) { - float f = 0.00390625F; - float g = 0.00390625F; - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder worldRenderer = tessellator.getBuffer(); - worldRenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldRenderer.pos(x, y + height, 0.0).tex((float) (textureX) * f, (float) (textureY + height) * g).endVertex(); - worldRenderer.pos(x + width, y + height, 0.0).tex((float) (textureX + width) * f, (float) (textureY + height) * g).endVertex(); - worldRenderer.pos(x + width, y, 0.0).tex((float) (textureX + width) * f, (float) (textureY) * g).endVertex(); - worldRenderer.pos(x, y, 0.0).tex((float) (textureX) * f, (float) (textureY) * g).endVertex(); - tessellator.draw(); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/GuiMainMenuProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/GuiMainMenuProvider.java deleted file mode 100644 index b08ba095..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/GuiMainMenuProvider.java +++ /dev/null @@ -1,188 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiWorldSelection; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.math.MathHelper; -import org.lwjgl.util.glu.Project; -import top.fpsmaster.api.wrapper.MainMenuWrap; - -import static top.fpsmaster.utils.Utility.mc; - -public class GuiMainMenuProvider implements MainMenuWrap { - private static final ResourceLocation[] TITLE_PANORAMA_PATHS = new ResourceLocation[]{new ResourceLocation("client/background/panorama_0.png"), new ResourceLocation("client/background/panorama_1.png"), new ResourceLocation("client/background/panorama_2.png"), new ResourceLocation("client/background/panorama_3.png"), new ResourceLocation("client/background/panorama_4.png"), new ResourceLocation("client/background/panorama_5.png")}; - private float panoramaTimer; - private ResourceLocation backgroundTexture; - - /** - * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the - * window resizes, the buttonList is cleared beforehand. - */ - public void initGui() { - DynamicTexture viewportTexture = new DynamicTexture(256, 256); - this.backgroundTexture = mc.getTextureManager().getDynamicTextureLocation("background", viewportTexture); - } - - - /** - * Draws the main menu panorama - */ - public void drawPanorama(int mouseX, int mouseY, float partialTicks) { - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - GlStateManager.matrixMode(5889); - GlStateManager.pushMatrix(); - GlStateManager.loadIdentity(); - Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F); - GlStateManager.matrixMode(5888); - GlStateManager.pushMatrix(); - GlStateManager.loadIdentity(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GlStateManager.disableCull(); - GlStateManager.depthMask(false); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - int i = 8; - int j = 64; - - for (int k = 0; k < j; ++k) { - GlStateManager.pushMatrix(); - float f = ((float) (k % 8) / 8.0F - 0.5F) / 64.0F; - float f1 = ((float) (k / 8) / 8.0F - 0.5F) / 64.0F; - float f2 = 0.0F; - GlStateManager.translate(f, f1, 0.0F); - GlStateManager.rotate(MathHelper.sin(this.panoramaTimer / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(-this.panoramaTimer * 0.1F, 0.0F, 1.0F, 0.0F); - - for (int l = 0; l < 6; ++l) { - GlStateManager.pushMatrix(); - - if (l == 1) { - GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); - } - - if (l == 2) { - GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); - } - - if (l == 3) { - GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); - } - - if (l == 4) { - GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); - } - - if (l == 5) { - GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); - } - - ResourceLocation[] aresourcelocation = TITLE_PANORAMA_PATHS; - - mc.getTextureManager().bindTexture(aresourcelocation[l]); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - int i1 = 255 / (k + 1); - float f3 = 0.0F; - bufferbuilder.pos(-1.0D, -1.0D, 1.0D).tex(0.0D, 0.0D).color(255, 255, 255, i1).endVertex(); - bufferbuilder.pos(1.0D, -1.0D, 1.0D).tex(1.0D, 0.0D).color(255, 255, 255, i1).endVertex(); - bufferbuilder.pos(1.0D, 1.0D, 1.0D).tex(1.0D, 1.0D).color(255, 255, 255, i1).endVertex(); - bufferbuilder.pos(-1.0D, 1.0D, 1.0D).tex(0.0D, 1.0D).color(255, 255, 255, i1).endVertex(); - tessellator.draw(); - GlStateManager.popMatrix(); - } - - GlStateManager.popMatrix(); - GlStateManager.colorMask(true, true, true, false); - } - - bufferbuilder.setTranslation(0.0D, 0.0D, 0.0D); - GlStateManager.colorMask(true, true, true, true); - GlStateManager.matrixMode(5889); - GlStateManager.popMatrix(); - GlStateManager.matrixMode(5888); - GlStateManager.popMatrix(); - GlStateManager.depthMask(true); - GlStateManager.enableCull(); - GlStateManager.enableDepth(); - } - - /** - * Rotate and blurs the skybox view in the main menu - */ - public void rotateAndBlurSkybox(int width, int height, float zLevel) { - mc.getTextureManager().bindTexture(this.backgroundTexture); - GlStateManager.glTexParameteri(3553, 10241, 9729); - GlStateManager.glTexParameteri(3553, 10240, 9729); - GlStateManager.glCopyTexSubImage2D(3553, 0, 0, 0, 0, 0, 256, 256); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.colorMask(true, true, true, false); - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - GlStateManager.disableAlpha(); - int i = 3; - int j = 3; - - for (int k = 0; k < j; ++k) { - float f = 1.0F / (float) (k + 1); - int l = width; - int i1 = height; - float f1 = (float) (k - 1) / 256.0F; - bufferbuilder.pos(l, i1, zLevel).tex(0.0F + f1, 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); - bufferbuilder.pos(l, 0.0D, zLevel).tex(1.0F + f1, 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); - bufferbuilder.pos(0.0D, 0.0D, zLevel).tex(1.0F + f1, 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); - bufferbuilder.pos(0.0D, i1, zLevel).tex(0.0F + f1, 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); - } - - tessellator.draw(); - GlStateManager.enableAlpha(); - GlStateManager.colorMask(true, true, true, true); - } - - /** - * Renders the skybox in the main menu - */ - public void renderSkybox(int mouseX, int mouseY, float partialTicks, int width, int height, float zLevel) { - this.panoramaTimer += partialTicks; - mc.getFramebuffer().unbindFramebuffer(); - GlStateManager.viewport(0, 0, 256, 256); - this.drawPanorama(mouseX, mouseY, partialTicks); - this.rotateAndBlurSkybox(width, height, zLevel); - int i = 3; - - for (int j = 0; j < i; ++j) { - this.rotateAndBlurSkybox(width, height, zLevel); - this.rotateAndBlurSkybox(width, height, zLevel); - } - - mc.getFramebuffer().bindFramebuffer(true); - GlStateManager.viewport(0, 0, mc.displayWidth, mc.displayHeight); - float f2 = 120.0F / (float) (width > height ? width : height); - float f = (float) height * f2 / 256.0F; - float f1 = (float) width * f2 / 256.0F; - int k = width; - int l = height; - Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuffer(); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(0.0D, l, zLevel).tex(0.5F - f, 0.5F + f1).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); - bufferbuilder.pos(k, l, zLevel).tex(0.5F - f, 0.5F - f1).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); - bufferbuilder.pos(k, 0.0D, zLevel).tex(0.5F + f, 0.5F - f1).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); - bufferbuilder.pos(0.0D, 0.0D, zLevel).tex(0.5F + f, 0.5F + f1).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); - tessellator.draw(); - } - - @Override - public void showSinglePlayer(GuiScreen screen) { - mc.displayGuiScreen(new GuiWorldSelection(screen)); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/MinecraftProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/MinecraftProvider.java deleted file mode 100644 index 270074aa..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/MinecraftProvider.java +++ /dev/null @@ -1,111 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.network.NetHandlerPlayClient; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumHand; -import net.minecraft.util.Session; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.text.ITextComponent; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import top.fpsmaster.forge.api.IMinecraft; -import top.fpsmaster.api.wrapper.MinecraftWrap; - -import java.io.File; -import java.util.Collection; -import java.util.Objects; - -public class MinecraftProvider implements MinecraftWrap { - - @Override - public File getGameDir() { - return Minecraft.getMinecraft().gameDir; - } - - - @Override - public FontRenderer getFontRenderer() { - return Minecraft.getMinecraft().fontRenderer; - } - - - @Override - public EntityPlayerSP getPlayer() { - return Minecraft.getMinecraft().player; - } - - @Override - public boolean isHoveringOverBlock() { - return Minecraft.getMinecraft().objectMouseOver != null && Minecraft.getMinecraft().objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK; - } - - @Override - public ItemStack getPlayerHeldItem() { - return getPlayer().getHeldItem(EnumHand.MAIN_HAND); - } - - @Override - public WorldClient getWorld() { - return Minecraft.getMinecraft().world; - } - - @Override - public ItemStack[] getArmorInventory() { - return getPlayer().inventory.armorInventory.toArray(new ItemStack[0]); - } - - @Override - public void setSession(Session mojang) { - ((IMinecraft) Minecraft.getMinecraft()).arch$setSession(mojang); - } - - @Override - public Integer getRespondTime() { - NetHandlerPlayClient connection = Minecraft.getMinecraft().getConnection(); - if (connection == null || getPlayer() == null) - return -1; - if (Minecraft.getMinecraft().isSingleplayer()) - return 0; - return connection.getPlayerInfo(getPlayer().getUniqueID()).getResponseTime(); - } - - @Override - public void drawString(String text, float x, float y, int color) { - Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(text, (int) x, (int) y, color); - } - - @Override - public String getServerAddress() { - if (Minecraft.getMinecraft().getConnection() == null || Minecraft.getMinecraft().isSingleplayer()) - return "localhost"; - return Minecraft.getMinecraft().getConnection().getNetworkManager().getRemoteAddress().toString(); - } - - @Override - public Collection getPlayerInfoMap() { - return Objects.requireNonNull(Minecraft.getMinecraft().getConnection()).getPlayerInfoMap(); - } - - @Override - public void removeClickDelay() { - ((IMinecraft) Minecraft.getMinecraft()).arch$setLeftClickCounter(0); -// Minecraft.getMinecraft().rightClickDelayTimer = 0; - } - - @Override - public void printChatMessage(@NotNull Object message) { - Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage((ITextComponent) message); - } - - @Nullable - @Override - public Object getCurrentScreen() { - return Minecraft.getMinecraft().currentScreen; - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/RenderManagerProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/RenderManagerProvider.java deleted file mode 100644 index a2681f07..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/RenderManagerProvider.java +++ /dev/null @@ -1,19 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.client.Minecraft; -import top.fpsmaster.forge.api.IRenderManager; -import top.fpsmaster.api.wrapper.RenderManagerWrap; - -public class RenderManagerProvider implements RenderManagerWrap { - public double renderPosX(){ - return ((IRenderManager) Minecraft.getMinecraft().getRenderManager()).renderPosX(); - } - - public double renderPosY(){ - return ((IRenderManager) Minecraft.getMinecraft().getRenderManager()).renderPosY(); - } - - public double renderPosZ(){ - return ((IRenderManager) Minecraft.getMinecraft().getRenderManager()).renderPosZ(); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/SkinProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/SkinProvider.java deleted file mode 100644 index c63c28db..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/SkinProvider.java +++ /dev/null @@ -1,63 +0,0 @@ -package top.fpsmaster.wrapper; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonObject; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import net.minecraft.client.Minecraft; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.util.ResourceLocation; -import top.fpsmaster.forge.api.INetworkPlayerInfo; -import top.fpsmaster.api.wrapper.SkinWrap; -import top.fpsmaster.utils.os.HttpRequest; - -import java.util.Map; -import java.util.UUID; - -public class SkinProvider implements SkinWrap { - public void updateSkin(String name, String uuid, String skin) { - try { - if (Minecraft.getMinecraft().player != null) { - Minecraft mc = Minecraft.getMinecraft(); - NetworkPlayerInfo info = new NetworkPlayerInfo(new GameProfile(UUID.fromString(uuid), name)); - - for (NetworkPlayerInfo player : mc.getConnection().getPlayerInfoMap()) { - if (player.getGameProfile().getName().equals(name) && player.getGameProfile().getId().toString().equals(uuid)) { - info = player; - } - } - - String json = HttpRequest.get("https://api.mojang.com/users/profiles/minecraft/" + skin); - Gson gson = new GsonBuilder().create(); - JsonObject jsonObject = gson.fromJson(json, JsonObject.class); - if (jsonObject != null && jsonObject.has("id")) { - String raw = jsonObject.getAsJsonPrimitive("id").getAsString(); - GameProfile gameProfile = new GameProfile(toUUID(raw), jsonObject.getAsJsonPrimitive("name").getAsString()); - gameProfile = mc.getSessionService().fillProfileProperties(gameProfile, false); - NetworkPlayerInfo finalInfo = info; - mc.getSkinManager().loadProfileTextures(gameProfile, (typeIn, location, profileTexture) -> { - switch (typeIn) { - case SKIN: - Map textures = ((INetworkPlayerInfo) finalInfo).getTextures(); - textures.put(MinecraftProfileTexture.Type.SKIN, location); - ((INetworkPlayerInfo)finalInfo).setTextures(textures); - ((INetworkPlayerInfo)finalInfo).setType(profileTexture.getMetadata("model")); - if (finalInfo.getSkinType() == null) { - ((INetworkPlayerInfo) finalInfo).setType("default"); - } - break; - } - }, false); - } - } - }catch (Exception e){ - - } - } - - private UUID toUUID(String uuid) { - return UUID.fromString(uuid.substring(0, 8) + "-" + uuid.substring(8, 12) + "-" + uuid.substring(12, 16) + "-" + - uuid.substring(16, 20) + "-" + uuid.substring(20, 32)); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/TextFormattingProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/TextFormattingProvider.java deleted file mode 100644 index 9f084c0e..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/TextFormattingProvider.java +++ /dev/null @@ -1,87 +0,0 @@ -package top.fpsmaster.wrapper; - - -import net.minecraft.util.text.TextFormatting; - -public class TextFormattingProvider { - public static TextFormatting getRed() { - return TextFormatting.RED; - } - - public static TextFormatting getGreen() { - return TextFormatting.GREEN; - } - - public static TextFormatting getBlue() { - return TextFormatting.BLUE; - } - - public static TextFormatting getYellow() { - return TextFormatting.YELLOW; - } - - public static TextFormatting getWhite() { - return TextFormatting.WHITE; - } - - public static TextFormatting getBlack() { - return TextFormatting.BLACK; - } - - public static TextFormatting getGray() { - return TextFormatting.GRAY; - } - - public static TextFormatting getDarkGray() { - return TextFormatting.DARK_GRAY; - } - - public static TextFormatting getLightPurple() { - return TextFormatting.LIGHT_PURPLE; - } - - public static TextFormatting getDarkPurple() { - return TextFormatting.DARK_PURPLE; - } - - public static TextFormatting getDarkBlue() { - return TextFormatting.DARK_BLUE; - } - - public static TextFormatting getDarkGreen() { - return TextFormatting.DARK_GREEN; - } - - public static TextFormatting getDarkAqua() { - return TextFormatting.DARK_AQUA; - } - - public static TextFormatting getDarkRed() { - return TextFormatting.DARK_RED; - } - - public static TextFormatting getBold() { - return TextFormatting.BOLD; - } - - public static TextFormatting getItalic() { - return TextFormatting.ITALIC; - } - - public static TextFormatting getUnderline() { - return TextFormatting.UNDERLINE; - } - - public static TextFormatting getStrikethrough() { - return TextFormatting.STRIKETHROUGH; - } - - public static TextFormatting getObfuscated() { - return TextFormatting.OBFUSCATED; - } - - public static TextFormatting getReset() { - return TextFormatting.RESET; - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/TimerProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/TimerProvider.java deleted file mode 100644 index 330e45fd..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/TimerProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.client.Minecraft; -import top.fpsmaster.forge.api.IMinecraft; -import top.fpsmaster.interfaces.ProviderManager; -import top.fpsmaster.api.wrapper.TimerWrap; - -public class TimerProvider implements TimerWrap { - public float getRenderPartialTicks(){ - return ((IMinecraft) Minecraft.getMinecraft()).arch$getTimer().renderPartialTicks; - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/UtilityProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/UtilityProvider.java deleted file mode 100644 index b22e90b9..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/UtilityProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentString; -import top.fpsmaster.api.provider.game.IUtilityProvider; - -public class UtilityProvider implements IUtilityProvider { - public String getResourcePath(ResourceLocation resourceLocation){ - return resourceLocation.getPath(); - } - - public double getDistanceToEntity(Entity e1, Entity e2){ - return e1.getDistance(e2); - } - - public boolean isItemEnhancementEmpty(ItemStack i){ - return i.getEnchantmentTagList().isEmpty(); - } - - public int getPotionIconIndex(PotionEffect effect){ - return effect.getPotion().getStatusIconIndex(); - } - - public ITextComponent makeChatComponent(String msg) { - return new TextComponentString(msg); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/WorldClientProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/WorldClientProvider.java deleted file mode 100644 index 0e567091..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/WorldClientProvider.java +++ /dev/null @@ -1,46 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.entity.effect.EntityLightningBolt; -import top.fpsmaster.api.wrapper.WorldWrap; -import top.fpsmaster.wrapper.blockpos.WrapperBlockPos; -import top.fpsmaster.wrapper.util.WrapperAxisAlignedBB; - -public class WorldClientProvider implements WorldWrap { - public static WorldClient getWorldClient() { - return Minecraft.getMinecraft().world; - } - - @Override - public IBlockState getBlockState(WrapperBlockPos pos) { - return getWorldClient().getBlockState(pos.getPos()); - } - - @Override - public Block getBlock(WrapperBlockPos pos) { - return getWorldClient().getBlockState(pos.getPos()).getBlock(); - } - - @Override - public WrapperAxisAlignedBB getBlockBoundingBox(WrapperBlockPos pos, IBlockState state) { - return new WrapperAxisAlignedBB(state.getBoundingBox(getWorld(), pos.getPos())); - } - - @Override - public void addWeatherEffect(EntityLightningBolt entityLightningBolt) { - getWorldClient().addWeatherEffect(entityLightningBolt); - } - - @Override - public WorldClient getWorld() { - return getWorldClient(); - } - - @Override - public void setWorldTime(long l) { - getWorldClient().setWorldTime(l); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/WrapperEntityLightningBolt.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/WrapperEntityLightningBolt.java deleted file mode 100644 index ae7727be..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/WrapperEntityLightningBolt.java +++ /dev/null @@ -1,10 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.world.World; - -public class WrapperEntityLightningBolt extends EntityLightningBolt { - public WrapperEntityLightningBolt(World worldIn, double x, double y, double z, boolean effectOnlyIn) { - super(worldIn, x, y, z, effectOnlyIn); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/blockpos/WrapperBlockPos.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/blockpos/WrapperBlockPos.java deleted file mode 100644 index 115c755e..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/blockpos/WrapperBlockPos.java +++ /dev/null @@ -1,27 +0,0 @@ -package top.fpsmaster.wrapper.blockpos; - -import net.minecraft.util.math.BlockPos; - -public class WrapperBlockPos { - BlockPos pos; - public WrapperBlockPos(BlockPos pos) { - this.pos = pos; - } - - public BlockPos getPos() { - return pos; - } - - public double getX() { - return pos.getX(); - } - - public double getY() { - return pos.getY(); - } - - public double getZ() { - return pos.getZ(); - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/entities/EntityTNTPrimedUtil.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/entities/EntityTNTPrimedUtil.java deleted file mode 100644 index 51100d2a..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/entities/EntityTNTPrimedUtil.java +++ /dev/null @@ -1,9 +0,0 @@ -package top.fpsmaster.wrapper.entities; - -import net.minecraft.entity.item.EntityTNTPrimed; - -public class EntityTNTPrimedUtil { - public static float getFuse(EntityTNTPrimed e) { - return e.getFuse(); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/mods/WrapperFreeLook.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/mods/WrapperFreeLook.java deleted file mode 100644 index c3894c83..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/mods/WrapperFreeLook.java +++ /dev/null @@ -1,67 +0,0 @@ -package top.fpsmaster.wrapper.mods; - -import org.lwjgl.opengl.Display; -import top.fpsmaster.features.impl.render.FreeLook; - -import static top.fpsmaster.features.impl.render.FreeLook.*; -import static top.fpsmaster.utils.Utility.*; - -public class WrapperFreeLook { - - - public static float getCameraYaw() { - if (perspectiveToggled) { - return cameraYaw; - } else { - assert mc.getRenderViewEntity() != null; - return mc.getRenderViewEntity().rotationYaw; - } - } - - public static float getCameraPitch() { - if (perspectiveToggled) { - return cameraPitch; - } else { - assert mc.getRenderViewEntity() != null; - return mc.getRenderViewEntity().rotationPitch; - } - } - - public static float getCameraPrevYaw() { - if (perspectiveToggled) { - return cameraYaw; - } else { - assert mc.getRenderViewEntity() != null; - return mc.getRenderViewEntity().prevRotationYaw; - } - } - - public static float getCameraPrevPitch() { - if (perspectiveToggled) { - return cameraPitch; - } else { - assert mc.getRenderViewEntity() != null; - return mc.getRenderViewEntity().prevRotationPitch; - } - } - - public static boolean overrideMouse() { - if (mc.inGameHasFocus && Display.isActive() && FreeLook.using && perspectiveToggled) { - mc.mouseHelper.mouseXYChange(); - float f1 = mc.gameSettings.mouseSensitivity * 0.6f + 0.2f; - float f2 = f1 * f1 * f1 * 8.0f; - float f3 = mc.mouseHelper.deltaX * f2; - float f4 = mc.mouseHelper.deltaY * f2; - cameraYaw += f3 * 0.15f; - cameraPitch += f4 * 0.15f; - if (cameraPitch > 90.0f) { - cameraPitch = 90.0f; - } - if (cameraPitch < -90.0f) { - cameraPitch = -90.0f; - } - return true; - } - return false; - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/mods/WrapperHitboxes.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/mods/WrapperHitboxes.java deleted file mode 100644 index d17e1231..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/mods/WrapperHitboxes.java +++ /dev/null @@ -1,41 +0,0 @@ -package top.fpsmaster.wrapper.mods; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderGlobal; -import net.minecraft.entity.Entity; -import top.fpsmaster.event.events.EventRender3D; -import top.fpsmaster.features.settings.impl.ColorSetting; -import top.fpsmaster.forge.api.IRenderManager; -import top.fpsmaster.api.ProviderManager; -import top.fpsmaster.interfaces.ProviderManager; -import top.fpsmaster.wrapper.TimerProvider; -import top.fpsmaster.wrapper.WorldClientProvider; -import top.fpsmaster.wrapper.util.WrapperAxisAlignedBB; - -import java.util.stream.Collectors; - -public class WrapperHitboxes { - public static void render(EventRender3D event, ColorSetting color) { - GlStateManager.depthMask(false); - GlStateManager.disableTexture2D(); - GlStateManager.disableLighting(); - GlStateManager.disableCull(); - GlStateManager.disableBlend(); - for (Entity entity : ProviderManager.worldClientProvider.getWorld().loadedEntityList.stream().filter(e -> e != ProviderManager.mcProvider.getPlayer() && !e.isInvisible()).collect(Collectors.toList())) { - double d_0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) ProviderManager.timerProvider.getRenderPartialTicks(); - double d_1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) ProviderManager.timerProvider.getRenderPartialTicks(); - double d_2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) ProviderManager.timerProvider.getRenderPartialTicks(); - double x = d_0 - ((IRenderManager) Minecraft.getMinecraft().getRenderManager()).renderPosX(); - double y = d_1 - ((IRenderManager) Minecraft.getMinecraft().getRenderManager()).renderPosY(); - double z = d_2 - ((IRenderManager) Minecraft.getMinecraft().getRenderManager()).renderPosZ(); - WrapperAxisAlignedBB boundingBox = new WrapperAxisAlignedBB(entity.getEntityBoundingBox()); - RenderGlobal.drawBoundingBox(boundingBox.minX() - entity.posX + x, boundingBox.minY() - entity.posY + y, boundingBox.minZ() - entity.posZ + z, boundingBox.maxX() - entity.posX + x, boundingBox.maxY() - entity.posY + y, boundingBox.maxZ() - entity.posZ + z, color.getColor().getRed()/255f, color.getColor().getGreen()/255f, color.getColor().getBlue()/255f, color.getColor().getAlpha()/255f); - } - GlStateManager.enableBlend(); - GlStateManager.enableCull(); - GlStateManager.enableLighting(); - GlStateManager.enableTexture2D(); - GlStateManager.depthMask(true); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/mods/WrapperPerformance.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/mods/WrapperPerformance.java deleted file mode 100644 index ebe79257..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/mods/WrapperPerformance.java +++ /dev/null @@ -1,159 +0,0 @@ -package top.fpsmaster.wrapper.mods; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.World; -import top.fpsmaster.features.impl.optimizes.CheckEntity; -import top.fpsmaster.api.ProviderManager; -import top.fpsmaster.api.ProviderManager; -import top.fpsmaster.wrapper.WorldClientProvider; - -public class WrapperPerformance { - - - public static boolean isVisible(CheckEntity entity) { - if (entity.getEntity() instanceof EntityPlayer) - return true; - long timePassedSinceLastCheck = System.currentTimeMillis() - entity.getLastTimeChecked(); - EntityPlayerSP player = ProviderManager.mcProvider.getPlayer(); - double cameraX = player.posX; // 获取玩家的 X 坐标 - double cameraY = player.posY + player.getEyeHeight(); // 获取玩家的 Y 坐标,并加上眼睛的高度 - double cameraZ = player.posZ; // 获取玩家的 Z 坐标 - if ((!entity.isLastCullingVisible() || timePassedSinceLastCheck >= 2000L)) { - double distance = Math.max(Math.abs(entity.getMinX() - cameraX), Math.max(Math.abs(entity.getMinY() - cameraY), Math.abs(entity.getMinZ() - cameraZ))); - distance = Math.max(0.0D, distance - 5.0D); - int interval = 1500; - long timeToCache = (long) ((double) interval * distance); - if (timePassedSinceLastCheck < timeToCache) { - return entity.isLastCullingVisible(); - } - - boolean visible = isVisible(ProviderManager.worldClientProvider.getWorld(), entity.getMinX(), entity.getMinY(), entity.getMinZ(), entity.getMaxX(), entity.getMaxY(), entity.getMaxZ(), cameraX, cameraY, cameraZ); - entity.setLastCullingVisible(visible); - return visible; - } else { - return true; - } - } - - public static boolean isVisible(World world, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, double cameraX, double cameraY, double cameraZ) { - if (Minecraft.getMinecraft().gameSettings.thirdPersonView != 0) { - return true; - } - double distanceRay1X = minX - cameraX; - double distanceRay1Y = minY - cameraY; - double distanceRay1Z = minZ - cameraZ; - double ray1X = cameraX; - double ray1Y = cameraY; - double ray1Z = cameraZ; - double distanceRay1 = Math.sqrt(distanceRay1X * distanceRay1X + distanceRay1Y * distanceRay1Y + distanceRay1Z * distanceRay1Z); - double step1X = distanceRay1X / distanceRay1; - double step1Y = distanceRay1Y / distanceRay1; - double step1Z = distanceRay1Z / distanceRay1; - boolean ray1XPositive = step1X > 0.0D; - boolean ray1YPositive = step1Y > 0.0D; - boolean ray1ZPositive = step1Z > 0.0D; - double distanceRay2X = maxX - cameraX; - double distanceRay2Y = maxY - cameraY; - double distanceRay2Z = maxZ - cameraZ; - double ray2X = cameraX; - double ray2Y = cameraY; - double ray2Z = cameraZ; - double distanceRay2 = Math.sqrt(distanceRay2X * distanceRay2X + distanceRay2Y * distanceRay2Y + distanceRay2Z * distanceRay2Z); - double step2X = distanceRay2X / distanceRay2; - double step2Y = distanceRay2Y / distanceRay2; - double step2Z = distanceRay2Z / distanceRay2; - boolean ray2XPositive = step2X > 0.0D; - boolean ray2YPositive = step2Y > 0.0D; - boolean ray2ZPositive = step2Z > 0.0D; - double distanceRay3X = minX - cameraX; - double distanceRay3Y = maxY - cameraY; - double distanceRay3Z = minZ - cameraZ; - double ray3X = cameraX; - double ray3Y = cameraY; - double ray3Z = cameraZ; - double distanceRay3 = Math.sqrt(distanceRay3X * distanceRay3X + distanceRay3Y * distanceRay3Y + distanceRay3Z * distanceRay3Z); - double step3X = distanceRay3X / distanceRay3; - double step3Y = distanceRay3Y / distanceRay3; - double step3Z = distanceRay3Z / distanceRay3; - boolean ray3XPositive = step3X > 0.0D; - boolean ray3YPositive = step3Y > 0.0D; - boolean ray3ZPositive = step3Z > 0.0D; - double distanceRay4X = maxX - cameraX; - double distanceRay4Y = minY - cameraY; - double distanceRay4Z = maxZ - cameraZ; - double ray4X = cameraX; - double ray4Y = cameraY; - double ray4Z = cameraZ; - double distanceRay4 = Math.sqrt(distanceRay4X * distanceRay4X + distanceRay4Y * distanceRay4Y + distanceRay4Z * distanceRay4Z); - double step4X = distanceRay4X / distanceRay4; - double step4Y = distanceRay4Y / distanceRay4; - double step4Z = distanceRay4Z / distanceRay4; - boolean ray4XPositive = step4X > 0.0D; - boolean ray4YPositive = step4Y > 0.0D; - boolean ray4ZPositive = step4Z > 0.0D; - double maxDistance = Math.max(Math.max(Math.abs(distanceRay1), Math.abs(distanceRay2)), Math.max(Math.abs(distanceRay3), Math.abs(distanceRay4))); - boolean ray1Hit = false; - boolean ray2Hit = false; - boolean ray3Hit = false; - boolean ray4Hit = false; - boolean ray1Free = false; - boolean ray2Free = false; - boolean ray3Free = false; - boolean ray4Free = false; - - for (int i = 0; (double) i < Math.ceil(maxDistance); ++i) { - IBlockState blockState = world.getBlockState(new BlockPos(MathHelper.floor(ray1X), MathHelper.floor(ray1Y), MathHelper.floor(ray1Z))); - if (blockState.isFullBlock() && blockState.isFullCube()) { - ray1Hit = ray1Free; - } else { - ray1Free = true; - } - - IBlockState blockState1 = world.getBlockState(new BlockPos(MathHelper.floor(ray2X), MathHelper.floor(ray2Y), MathHelper.floor(ray2Z))); - if (blockState1.isFullBlock() && blockState1.isFullCube()) { - ray2Hit = ray2Free; - } else { - ray2Free = true; - } - - IBlockState blockState2 = world.getBlockState(new BlockPos(MathHelper.floor(ray3X), MathHelper.floor(ray3Y), MathHelper.floor(ray3Z))); - if (blockState2.isFullBlock() && blockState2.isFullCube()) { - ray3Hit = ray3Free; - } else { - ray3Free = true; - } - - IBlockState blockState3 = world.getBlockState(new BlockPos(MathHelper.floor(ray4X), MathHelper.floor(ray4Y), MathHelper.floor(ray4Z))); - if (blockState3.isFullBlock() && blockState3.isFullCube()) { - ray4Hit = ray4Free; - } else { - ray4Free = true; - } - - if (ray1Hit && ray2Hit && ray3Hit && ray4Hit) { - return false; - } - - ray1X = ray1XPositive ? Math.min(ray1X + step1X, minX) : Math.max(ray1X + step1X, minX); - ray1Y = ray1YPositive ? Math.min(ray1Y + step1Y, minY) : Math.max(ray1Y + step1Y, minY); - ray1Z = ray1ZPositive ? Math.min(ray1Z + step1Z, minZ) : Math.max(ray1Z + step1Z, minZ); - ray2X = ray2XPositive ? Math.min(ray2X + step2X, maxX) : Math.max(ray2X + step2X, maxX); - ray2Y = ray2YPositive ? Math.min(ray2Y + step2Y, maxY) : Math.max(ray2Y + step2Y, maxY); - ray2Z = ray2ZPositive ? Math.min(ray2Z + step2Z, maxZ) : Math.max(ray2Z + step2Z, maxZ); - ray3X = ray3XPositive ? Math.min(ray3X + step3X, minX) : Math.max(ray3X + step3X, minX); - ray3Y = ray3YPositive ? Math.min(ray3Y + step3Y, maxY) : Math.max(ray3Y + step3Y, minY); - ray3Z = ray3ZPositive ? Math.min(ray3Z + step3Z, minZ) : Math.max(ray3Z + step3Z, minZ); - ray4X = ray4XPositive ? Math.min(ray4X + step4X, maxX) : Math.max(ray4X + step4X, maxX); - ray4Y = ray4YPositive ? Math.min(ray4Y + step4Y, minY) : Math.max(ray4Y + step4Y, minY); - ray4Z = ray4ZPositive ? Math.min(ray4Z + step4Z, maxZ) : Math.max(ray4Z + step4Z, maxZ); - } - - return true; - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/mods/WrapperScoreboard.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/mods/WrapperScoreboard.java deleted file mode 100644 index f3cdeb87..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/mods/WrapperScoreboard.java +++ /dev/null @@ -1,115 +0,0 @@ -package top.fpsmaster.wrapper.mods; - -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import net.minecraft.scoreboard.Score; -import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.scoreboard.ScorePlayerTeam; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.features.impl.InterfaceModule; -import top.fpsmaster.font.impl.UFontRenderer; -import top.fpsmaster.features.impl.interfaces.Scoreboard; -import top.fpsmaster.api.ProviderManager; -import top.fpsmaster.ui.custom.impl.ScoreboardComponent; -import top.fpsmaster.utils.render.Render2DUtils; -import top.fpsmaster.wrapper.TextFormattingProvider; - -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -public class WrapperScoreboard { - public static float[] render(ScoreboardComponent scoreboardComponent, InterfaceModule mod, float x, float y) { - top.fpsmaster.wrapper.scoreboard.WrapperScoreboard scoreboard = new top.fpsmaster.wrapper.scoreboard.WrapperScoreboard(ProviderManager.worldClientProvider.getWorld().getScoreboard()); - ScoreObjective scoreobjective = null; - ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(ProviderManager.mcProvider.getPlayer().getName()); - - assert FPSMaster.fontManager != null; - UFontRenderer s16 = FPSMaster.fontManager.s16; - - - if (scoreplayerteam != null) { - - int i1 = scoreboard.getPlayersTeamColorIndex(ProviderManager.mcProvider.getPlayer().getName()); - - if (i1 >= 0) { - scoreobjective = scoreboard.getObjectiveInDisplaySlot(3 + i1); - } - - } - ScoreObjective objective = scoreobjective != null ? scoreobjective : scoreboard.getObjectiveInDisplaySlot(1); - - if (objective != null) { - Collection collection = scoreboard.getSortedScores(objective); - - List list = collection.stream().filter(p_apply_1_ -> !p_apply_1_.getPlayerName().startsWith("#")).collect(Collectors.toList()); - - if (list.size() > 15) { - collection = Lists.newArrayList(Iterables.skip(list, collection.size() - 15)); - } else { - collection = list; - } - - int i; - if (mod.betterFont.getValue()) { - i = s16.getStringWidth(objective.getDisplayName()); - } else { - i = ProviderManager.mcProvider.getFontRenderer().getStringWidth(objective.getDisplayName()); - } - for (Score score : collection) { - ScorePlayerTeam scoreteam = scoreboard.getPlayersTeam(score.getPlayerName()); - String s = ScorePlayerTeam.formatPlayerName(scoreteam, score.getPlayerName()) + ": " + TextFormattingProvider.getRed() + score.getScorePoints(); - if (mod.betterFont.getValue()) { - i = Math.max(i, s16.getStringWidth(s)); - } else { - i = Math.max(i, ProviderManager.mcProvider.getFontRenderer().getStringWidth(s)); - } - } - i += 6; - - int height1 = 10; - float l1 = x; - int j = 0; - float h = collection.size() * height1 + 10; - scoreboardComponent.drawRect(l1, y, i, h, mod.backgroundColor.getColor()); - - for (Score score1 : collection) { - ++j; - ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score1.getPlayerName()); - String s1 = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score1.getPlayerName()); - float k = j * height1; - - // title - if (j == collection.size()) { - String s3 = objective.getDisplayName(); - if (mod.bg.getValue()) { - scoreboardComponent.drawRect(l1, y, i, height1 + 1, mod.backgroundColor.getColor()); - } - if (mod.betterFont.getValue()) { - scoreboardComponent.drawString(s16, s3, (int) (l1 + 2 + (float) i / 2 - s16.getStringWidth(s3) / 2f), y, -1); - } else { - ProviderManager.mcProvider.getFontRenderer().drawStringWithShadow(s3, (int) (l1 + 2 + (float) i / 2 - ProviderManager.mcProvider.getFontRenderer().getStringWidth(s3) / 2f), y, -1); - } - } - - if (mod.betterFont.getValue()) { - scoreboardComponent.drawString(s16, s1, ((int) l1) + 2, (int) (y + h - k), -1); - } else { - ProviderManager.mcProvider.getFontRenderer().drawStringWithShadow(s1, ((int) l1) + 2, (int) (y + h - k), -1); - } - - // 红字 - if (Scoreboard.score.getValue()) { - String s2 = TextFormattingProvider.getRed() + String.valueOf(score1.getScorePoints()); - if (mod.betterFont.getValue()) { - scoreboardComponent.drawString(s16, s2, l1 + i - 2 - s16.getStringWidth(s2), y + k, -1); - } else { - ProviderManager.mcProvider.getFontRenderer().drawStringWithShadow(s2, l1 + i - 2 - ProviderManager.mcProvider.getFontRenderer().getStringWidth(s2), y + k, -1); - } - } - } - return new float[]{i, h}; - } - return new float[]{100, 140}; - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/packets/SPacketChatProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/packets/SPacketChatProvider.java deleted file mode 100644 index 6e0da913..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/packets/SPacketChatProvider.java +++ /dev/null @@ -1,41 +0,0 @@ -package top.fpsmaster.wrapper.packets; - -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.SPacketChat; -import net.minecraft.util.text.Style; -import net.minecraft.util.text.TextComponentString; -import net.minecraft.util.text.event.ClickEvent; -import net.minecraft.util.text.event.HoverEvent; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.api.wrapper.packets.ChatPacketWrap; -import top.fpsmaster.wrapper.TextFormattingProvider; - - -public class SPacketChatProvider implements ChatPacketWrap { - public boolean isPacket(@NotNull Object p) { - return p instanceof SPacketChat; - } - - @NotNull - public String getUnformattedText(@NotNull Object p){ - return ((SPacketChat) p).getChatComponent().getUnformattedText(); - } - - public int getType(Object p){ - return ((SPacketChat) p).getType().ordinal(); - } - - public void appendTranslation(Object p){ - String unformattedText = getUnformattedText(p); - if (!unformattedText.endsWith(" [T]") && unformattedText.length() > 5) { - ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "#TRANSLATE" + unformattedText); - HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(FPSMaster.i18n.get("translate.hover"))); - Style style = new Style().setClickEvent(clickEvent).setHoverEvent(hoverEvent); - TextComponentString iTextComponents = new TextComponentString(TextFormattingProvider.getGray().toString() + " [T]"); - iTextComponents.setStyle(style); - ((SPacketChat) p).getChatComponent().appendSibling(iTextComponents); - } - } -} - diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/packets/SPacketPlayerListProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/packets/SPacketPlayerListProvider.java deleted file mode 100644 index 9dc9ad25..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/packets/SPacketPlayerListProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -package top.fpsmaster.wrapper.packets; - -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.SPacketPlayerListItem; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.wrapper.packets.PlayerListItemAddWrap; -import top.fpsmaster.api.wrapper.packets.PlayerListItemWrap; - -import java.util.List; -import java.util.stream.Collectors; - -public class SPacketPlayerListProvider implements PlayerListItemWrap { - public boolean isPacket(Object p) { - return p instanceof SPacketPlayerListItem; - } - - public boolean isActionJoin(Object p) { - return isPacket(p) && ((SPacketPlayerListItem) p).getAction() == SPacketPlayerListItem.Action.ADD_PLAYER; - } - - public boolean isActionLeave(Object p) { - return isPacket(p) && ((SPacketPlayerListItem) p).getAction() == SPacketPlayerListItem.Action.REMOVE_PLAYER; - } - - public java.util.List getEntries(Object p) { - List entries = ((SPacketPlayerListItem) p).getEntries(); - return entries.stream().map(WrapperAddPlayerData::new).collect(Collectors.toList()); - } -} - diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/packets/SPacketTimeUpdateProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/packets/SPacketTimeUpdateProvider.java deleted file mode 100644 index c317ef24..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/packets/SPacketTimeUpdateProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package top.fpsmaster.wrapper.packets; - -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.SPacketTimeUpdate; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.wrapper.packets.TimeUpdatePacketWrap; - -public class SPacketTimeUpdateProvider implements TimeUpdatePacketWrap { - public boolean isPacket(@NotNull Object packet) { - return packet instanceof SPacketTimeUpdate; - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/packets/WrapperAddPlayerData.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/packets/WrapperAddPlayerData.java deleted file mode 100644 index 90589304..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/packets/WrapperAddPlayerData.java +++ /dev/null @@ -1,17 +0,0 @@ -package top.fpsmaster.wrapper.packets; - - -import net.minecraft.network.play.server.SPacketPlayerListItem; -import top.fpsmaster.api.wrapper.packets.PlayerListItemAddWrap; - -public class WrapperAddPlayerData implements PlayerListItemAddWrap { - public SPacketPlayerListItem.AddPlayerData entity; - - public WrapperAddPlayerData(SPacketPlayerListItem.AddPlayerData entity) { - this.entity = entity; - } - - public String getName() { - return entity.getProfile().getName(); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/renderEngine/bufferbuilder/WrapperBufferBuilder.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/renderEngine/bufferbuilder/WrapperBufferBuilder.java deleted file mode 100644 index 2abe6e76..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/renderEngine/bufferbuilder/WrapperBufferBuilder.java +++ /dev/null @@ -1,34 +0,0 @@ -package top.fpsmaster.wrapper.renderEngine.bufferbuilder; - -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.vertex.VertexFormat; - -public class WrapperBufferBuilder { - private final BufferBuilder buffer; - private final Tessellator tessellator; - - public WrapperBufferBuilder(Tessellator tessellator) { - this.tessellator = tessellator; - this.buffer = tessellator.getBuffer(); - } - - public void begin(int i, VertexFormat positionTex) { - buffer.begin(i, positionTex); - } - - public BufferBuilder pos(float x, float y, double z) { - buffer.pos(x, y, z); - return buffer; - } - - public BufferBuilder pos(double x, double y, double z) { - buffer.pos(x, y, z); - return buffer; - } - - public void color(int r, int g, int b, int a) { - buffer.color(r, g, b, a); - } - -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/renderEngine/global/WrapperRenderGlobal.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/renderEngine/global/WrapperRenderGlobal.java deleted file mode 100644 index 105f77d0..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/renderEngine/global/WrapperRenderGlobal.java +++ /dev/null @@ -1,4 +0,0 @@ -package top.fpsmaster.wrapper.renderEngine.global; - -public class WrapperRenderGlobal { -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/scoreboard/WrapperScoreboard.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/scoreboard/WrapperScoreboard.java deleted file mode 100644 index e0a3e79a..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/scoreboard/WrapperScoreboard.java +++ /dev/null @@ -1,38 +0,0 @@ -package top.fpsmaster.wrapper.scoreboard; - -import net.minecraft.scoreboard.Score; -import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; -import net.minecraft.util.text.TextFormatting; - -import java.util.Collection; -import java.util.Objects; - -public class WrapperScoreboard { - private final Scoreboard scoreboard; - - public WrapperScoreboard(Scoreboard scoreboard) { - this.scoreboard = scoreboard; - } - - public ScorePlayerTeam getPlayersTeam(String name) { - return scoreboard.getPlayersTeam(name); - } - - public TextFormatting getPlayersTeamColor(String name) { - return Objects.requireNonNull(scoreboard.getPlayersTeam(name)).getColor(); - } - - public int getPlayersTeamColorIndex(String name) { - return Objects.requireNonNull(scoreboard.getPlayersTeam(name)).getColor().getColorIndex(); - } - - public ScoreObjective getObjectiveInDisplaySlot(int i) { - return scoreboard.getObjectiveInDisplaySlot(i); - } - - public Collection getSortedScores(ScoreObjective objective) { - return scoreboard.getSortedScores(objective); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/sound/SoundProvider.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/sound/SoundProvider.java deleted file mode 100644 index e9ca497a..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/sound/SoundProvider.java +++ /dev/null @@ -1,17 +0,0 @@ -package top.fpsmaster.wrapper.sound; - -import net.minecraft.init.SoundEvents; -import top.fpsmaster.interfaces.ProviderManager; -import top.fpsmaster.api.wrapper.SoundWrap; - -public class SoundProvider implements SoundWrap { - public void playLightning(double posX, double posY, double posZ, float i, float v, boolean b) { - ProviderManager.mcProvider.getWorld().playSound(posX, posY, posZ, SoundEvents.ENTITY_LIGHTNING_IMPACT, net.minecraft.util.SoundCategory.BLOCKS, i, v, b); - } - public void playExplosion(double posX, double posY, double posZ, float i, float v, boolean b) { - ProviderManager.mcProvider.getWorld().playSound(posX, posY, posZ, SoundEvents.ENTITY_GENERIC_EXPLODE, net.minecraft.util.SoundCategory.BLOCKS, i, v, b); - } - public void playRedStoneBreak(double posX, double posY, double posZ, float i, float v, boolean b) { - ProviderManager.mcProvider.getWorld().playSound(posX, posY, posZ, SoundEvents.BLOCK_STONE_BREAK, net.minecraft.util.SoundCategory.BLOCKS, i, v, b); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/util/WrapperAxisAlignedBB.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/util/WrapperAxisAlignedBB.java deleted file mode 100644 index e003e119..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/util/WrapperAxisAlignedBB.java +++ /dev/null @@ -1,99 +0,0 @@ -package top.fpsmaster.wrapper.util; - - -import net.minecraft.util.math.AxisAlignedBB; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.math.Vec3d; -import org.jetbrains.annotations.NotNull; - -public class WrapperAxisAlignedBB { - AxisAlignedBB axisAlignedBB; - - public WrapperAxisAlignedBB(AxisAlignedBB axisAlignedBB) { - this.axisAlignedBB = axisAlignedBB; - } - - public WrapperAxisAlignedBB(double x, double y, double z, double x1, double y1, double z1) { - this.axisAlignedBB = new AxisAlignedBB(x, y, z, x1, y1, z1); - } - - public AxisAlignedBB getAxisAlignedBB() { - return axisAlignedBB; - } - - public void setAxisAlignedBB(AxisAlignedBB axisAlignedBB) { - this.axisAlignedBB = axisAlignedBB; - } - - public double minX() { - return axisAlignedBB.minX; - } - - public double minY() { - return axisAlignedBB.minY; - } - - public double minZ() { - return axisAlignedBB.minZ; - } - - public double maxX() { - return axisAlignedBB.maxX; - } - - public double maxY() { - return axisAlignedBB.maxY; - } - - public double maxZ() { - return axisAlignedBB.maxZ; - } - - public double getMinX() { - return axisAlignedBB.minX; - } - - public double getMinY() { - return axisAlignedBB.minY; - } - - public double getMinZ() { - return axisAlignedBB.minZ; - } - - public double getMaxX() { - return axisAlignedBB.maxX; - } - - public double getMaxY() { - return axisAlignedBB.maxY; - } - - public double getMaxZ() { - return axisAlignedBB.maxZ; - } - - public WrapperAxisAlignedBB expand(double x){ - axisAlignedBB = axisAlignedBB.expand(x, x, x); - return this; - } - - public WrapperAxisAlignedBB expand(double x, double y, double z){ - axisAlignedBB = axisAlignedBB.expand(x, y, z); - return this; - } - - public RayTraceResult calculateIntercept(Vec3d vecA, Vec3d vecB){ - return axisAlignedBB.calculateIntercept(vecA, vecB); - } - - @NotNull - public WrapperAxisAlignedBB addCoord(double x, double y, double z) { - axisAlignedBB = axisAlignedBB.expand(x, y, z); - return this; - } - - public boolean isVecInside(@NotNull Vec3d vec3d) { - return axisAlignedBB.contains(vec3d); - } -} diff --git a/v1.12.2/src/main/java/top/fpsmaster/wrapper/util/WrapperVec3.java b/v1.12.2/src/main/java/top/fpsmaster/wrapper/util/WrapperVec3.java deleted file mode 100644 index 68f07c9b..00000000 --- a/v1.12.2/src/main/java/top/fpsmaster/wrapper/util/WrapperVec3.java +++ /dev/null @@ -1,33 +0,0 @@ -package top.fpsmaster.wrapper.util; - -import net.minecraft.util.math.Vec3d; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class WrapperVec3 { - Vec3d vec3d; - - public WrapperVec3(Vec3d vec3d) { - this.vec3d = vec3d; - } - - public double x(){ - return vec3d.x; - } - - public double y(){ - return vec3d.y; - } - - public double z(){ - return vec3d.z; - } - - public double distanceTo(Object vec3d3) { - return this.vec3d.distanceTo((Vec3d) vec3d3); - } - - public Vec3d addVector(double x, double y, double z) { - return this.vec3d.add(x, y, z); - } -} diff --git a/v1.12.2/src/main/resources/git.properties b/v1.12.2/src/main/resources/git.properties deleted file mode 100644 index 445e7f2f..00000000 --- a/v1.12.2/src/main/resources/git.properties +++ /dev/null @@ -1,4 +0,0 @@ -git.branch=feat/musicvisualization -git.commit.id=5c1cb094df00731a83411a388dab9373e96b5b6c -git.commit.id.abbrev=5c1cb09 -git.commit.time=2024-10-06T10\:19\:12+0800 diff --git a/v1.12.2/src/main/resources/mcmod.info b/v1.12.2/src/main/resources/mcmod.info deleted file mode 100644 index d217798d..00000000 --- a/v1.12.2/src/main/resources/mcmod.info +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "modid": "${modid}", - "name": "FPSMaster Mod", - "description": "FPSMaster PVP Client.", - "version": "${version}", - "mcversion": "1.12.2", - "url": "https://fpsmaster.top", - "updateUrl": "", - "authorList": [ - "SuperSkidder" - ], - "credits": "", - "logoFile": "", - "screenshots": [], - "dependencies": [] - } -] diff --git a/v1.12.2/src/main/resources/mixins.fpsmaster.json b/v1.12.2/src/main/resources/mixins.fpsmaster.json deleted file mode 100644 index 3060f8f1..00000000 --- a/v1.12.2/src/main/resources/mixins.fpsmaster.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "package": "top.fpsmaster.forge.mixin", - "refmap": "mixins.${modid}.refmap.json", - "minVersion": "0.7", - "compatibilityLevel": "JAVA_8", - "mixins": [ - "MixinEntityLivingBase", - "MixinEntityPlayer", - "MixinItemSword", - "MixinNetworkManager", - "MixinSplashScreen" - ], - "client": [ - "MixinAbstractClientPlayer", - "MixinChatLine", - "MixinEntityPlayerSP", - "MixinEntityRenderer", - "MixinFontRender", - "MixinGuiContainer", - "MixinGuiIngame", - "MixinGuiIngameForge", - "MixinGuiNewChat", - "MixinGuiPlayerOverlay", - "MixinGuiScreen", - "MixinItemRenderer", - "MixinKeybinding", - "MixinLayerArmorBase", - "MixinMainMenu", - "MixinMinecraft", - "MixinMultiPlayer", - "MixinNetHandlerLoginClient", - "MixinNetworkPlayerInfo", - "MixinParticleManager", - "MixinRender", - "MixinRenderEntityItem", - "MixinRenderLivingBase", - "MixinRenderManager", - "MixinRenderTNTPrimed", - "MixinShaderGroup" - ] -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/api/interfaces/IClientPlayerEntityImpl.java b/v1.8.9/src/main/java/top/fpsmaster/api/interfaces/IClientPlayerEntityImpl.java deleted file mode 100644 index 3eab0b3a..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/api/interfaces/IClientPlayerEntityImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -package top.fpsmaster.api.interfaces; - -import net.minecraft.client.entity.EntityPlayerSP; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.interfaces.client.IClientPlayerEntity; - -import java.util.UUID; - -public class IClientPlayerEntityImpl implements IClientPlayerEntity { - private final EntityPlayerSP playerSP; - - public IClientPlayerEntityImpl(EntityPlayerSP playerSP) { - this.playerSP = playerSP; - } - - @Override - public @NotNull String getName() { - return playerSP.getName(); - } - - @Override - public @NotNull UUID getUniqueId() { - return playerSP.getUniqueID(); - } - - @Override - public boolean isSprinting() { - return playerSP.isSprinting(); - } - - @Override - public void setSprinting(boolean sprinting) { - playerSP.setSprinting(sprinting); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/api/interfaces/IMinecraftImpl.java b/v1.8.9/src/main/java/top/fpsmaster/api/interfaces/IMinecraftImpl.java deleted file mode 100644 index 44fa1d38..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/api/interfaces/IMinecraftImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package top.fpsmaster.api.interfaces; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import org.jetbrains.annotations.Nullable; -import top.fpsmaster.api.interfaces.client.IMinecraft; -import top.fpsmaster.api.interfaces.client.IClientPlayerEntity; -import top.fpsmaster.api.interfaces.client.settings.IGameSettings; -import top.fpsmaster.api.interfaces.client.settings.IKeyBinding; -import top.fpsmaster.api.interfaces.settings.IGameSettingsImpl; -import top.fpsmaster.api.interfaces.settings.IKeyBindingImpl; - -public class IMinecraftImpl implements IMinecraft { - private final Minecraft mc; - private IClientPlayerEntityImpl player; - private EntityPlayerSP mcPlayer; - - public IMinecraftImpl(Minecraft mc) { - this.mc = mc; - } - - @Override - public @Nullable IClientPlayerEntity getClientPlayer() { - if (player == null || mcPlayer != mc.thePlayer) { - if (mc.thePlayer == null) { - return null; // Better keep the nullability. - } - player = new IClientPlayerEntityImpl(mc.thePlayer); - mcPlayer = mc.thePlayer; - } - return player; - } - - @Override - public IKeyBinding getKeyBinding() { - return new IKeyBindingImpl(); - } - - @Override - public IGameSettings getGameSettings() { - return new IGameSettingsImpl(mc.gameSettings); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/api/interfaces/settings/IGameSettingsImpl.java b/v1.8.9/src/main/java/top/fpsmaster/api/interfaces/settings/IGameSettingsImpl.java deleted file mode 100644 index 8044f15d..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/api/interfaces/settings/IGameSettingsImpl.java +++ /dev/null @@ -1,16 +0,0 @@ -package top.fpsmaster.api.interfaces.settings; - -import lombok.RequiredArgsConstructor; -import net.minecraft.client.settings.GameSettings; -import top.fpsmaster.api.interfaces.client.settings.IGameSettings; -import top.fpsmaster.api.interfaces.client.settings.IKeyBinding; - -@RequiredArgsConstructor -public class IGameSettingsImpl implements IGameSettings { - private final GameSettings gameSettings; - - @Override - public IKeyBinding getKeyBindSprint() { - return new IKeyBindingImpl(gameSettings.keyBindSprint); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/api/interfaces/settings/IKeyBindingImpl.java b/v1.8.9/src/main/java/top/fpsmaster/api/interfaces/settings/IKeyBindingImpl.java deleted file mode 100644 index 24101b8b..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/api/interfaces/settings/IKeyBindingImpl.java +++ /dev/null @@ -1,23 +0,0 @@ -package top.fpsmaster.api.interfaces.settings; - -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import net.minecraft.client.settings.KeyBinding; -import org.jetbrains.annotations.Nullable; -import top.fpsmaster.api.interfaces.client.settings.IKeyBinding; - -@AllArgsConstructor -@NoArgsConstructor -public class IKeyBindingImpl implements IKeyBinding { - private @Nullable KeyBinding keyBinding; - - @Override - public void setKeyBindState(int keyCode, boolean state) { - KeyBinding.setKeyBindState(keyCode, state); - } - - @Override - public int getKeyCode() { - return keyBinding == null ? 0 : keyBinding.getKeyCode(); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/api/provider/IMinecraftProviderImpl.java b/v1.8.9/src/main/java/top/fpsmaster/api/provider/IMinecraftProviderImpl.java deleted file mode 100644 index f1a8b057..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/api/provider/IMinecraftProviderImpl.java +++ /dev/null @@ -1,20 +0,0 @@ -package top.fpsmaster.api.provider; - -import net.minecraft.client.Minecraft; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.interfaces.client.IMinecraft; -import top.fpsmaster.api.interfaces.IMinecraftImpl; - -public class IMinecraftProviderImpl implements IMinecraftProvider { - private IMinecraftImpl mcImpl; - private Minecraft mc; - - @Override - public @NotNull IMinecraft getMinecraft() { - if (mcImpl == null || mc != Minecraft.getMinecraft()) { - mc = Minecraft.getMinecraft(); - mcImpl = new IMinecraftImpl(mc); - } - return mcImpl; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/forge/Mod.java b/v1.8.9/src/main/java/top/fpsmaster/forge/Mod.java index 907ba0aa..1de2365f 100644 --- a/v1.8.9/src/main/java/top/fpsmaster/forge/Mod.java +++ b/v1.8.9/src/main/java/top/fpsmaster/forge/Mod.java @@ -2,22 +2,11 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import top.fpsmaster.FPSMaster; -import top.fpsmaster.api.MinecraftAPI; -import top.fpsmaster.api.provider.IMinecraftProviderImpl; -import top.fpsmaster.api.provider.ProviderRegistry; -import top.fpsmaster.impl.APIProviderImpl; -import top.fpsmaster.wrapper.MinecraftProvider; @net.minecraftforge.fml.common.Mod(modid = "fpsmaster", useMetadata = true) public class Mod { @net.minecraftforge.fml.common.Mod.EventHandler public void init(FMLInitializationEvent event) { - // Initialize new MinecraftAPI - MinecraftAPI.initialize(new APIProviderImpl()); - - // register old providers (for backward compatibility) - ProviderRegistry.setMinecraftProvider(new IMinecraftProviderImpl()); - FPSMaster.INSTANCE.initialize(); } } diff --git a/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiChat.java b/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiChat.java index 78fae781..e17529a9 100644 --- a/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiChat.java +++ b/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiChat.java @@ -1,64 +1,16 @@ package top.fpsmaster.forge.mixin; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiChat; import net.minecraft.client.gui.GuiScreen; -import org.java_websocket.enums.ReadyState; -import org.lwjgl.input.Mouse; import org.spongepowered.asm.mixin.Mixin; -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.Redirect; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.utils.Utility; -import top.fpsmaster.utils.render.Render2DUtils; - -import java.awt.*; @Mixin(GuiChat.class) public class MixinGuiChat extends GuiScreen { - @Unique - private static boolean irc = false; - - - @Inject(method = "drawScreen", at = @At("HEAD")) - public void drawScreen(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) { - if (FPSMaster.INSTANCE.wsClient != null && FPSMaster.INSTANCE.wsClient.getReadyState() == ReadyState.OPEN) { - int width1 = mc.fontRendererObj.getStringWidth(FPSMaster.i18n.get("chat.mc")); - int width2 = mc.fontRendererObj.getStringWidth(FPSMaster.i18n.get("chat.irc")); - - - Gui.drawRect(2, this.height - 28, 2 + width1 + 4, this.height - 14, irc ? new Color(0, 0, 0, 180).getRGB() : new Color(80, 80, 80, 180).getRGB()); - mc.fontRendererObj.drawStringWithShadow(FPSMaster.i18n.get("chat.mc"), 4, this.height - 26, irc ? new Color(200, 200, 200).getRGB() : -1); - - Gui.drawRect(2 + width1 + 4, this.height - 28, 2 + width1 + 6 + width2 + 2, this.height - 14, irc ? new Color(80, 80, 80, 180).getRGB() : new Color(0, 0, 0, 180).getRGB()); - mc.fontRendererObj.drawStringWithShadow(FPSMaster.i18n.get("chat.irc"), 4 + width1 + 4, this.height - 26, irc ? -1 : new Color(200, 200, 200).getRGB()); - - if (Mouse.isButtonDown(0)) { - if (Render2DUtils.isHovered(2, this.height - 28, width1 + 4, 12, mouseX, mouseY)) { - irc = false; - } else if (Render2DUtils.isHovered(2 + width1 + 4, this.height - 28, width2 + 2, 12, mouseX, mouseY)) { - irc = true; - } - } - } - } - - @Redirect(method = "keyTyped", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiChat;sendChatMessage(Ljava/lang/String;)V")) public void sendChatMessage(GuiChat instance, String message) { - message = message.trim(); - if (irc && FPSMaster.INSTANCE.wsClient != null && FPSMaster.INSTANCE.wsClient.getReadyState() == ReadyState.OPEN) { - if (message.toLowerCase().startsWith("/")) { - Utility.sendClientMessage("\247cIRC不允许命令输入!"); - } else { - FPSMaster.INSTANCE.wsClient.sendMessage(message); - } - } else { - instance.sendChatMessage(message); - } + instance.sendChatMessage(message.trim()); } } diff --git a/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiNewChat.java b/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiNewChat.java index 029bb6d5..d6ad636b 100644 --- a/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiNewChat.java +++ b/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiNewChat.java @@ -11,9 +11,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Redirect; import top.fpsmaster.FPSMaster; -import top.fpsmaster.forge.api.IChatLine; import top.fpsmaster.features.impl.interfaces.BetterChat; -import top.fpsmaster.api.wrapper.GuiNewChatWrap; import top.fpsmaster.utils.math.animation.AnimationUtils; import top.fpsmaster.utils.render.Render2DUtils; @@ -24,7 +22,7 @@ import static top.fpsmaster.utils.Utility.mc; @Mixin(GuiNewChat.class) -public abstract class MixinGuiNewChat implements GuiNewChatWrap { +public abstract class MixinGuiNewChat { @Unique private boolean v1_8_9$isChatOpenAnimationNeed = true; @@ -146,10 +144,6 @@ public void drawChat(int updateCounter) { ChatLine chatLine = drawnChatLines.get(m + this.scrollPos); if (chatLine != null) { if (getChatOpen() && v1_8_9$isChatOpenAnimationNeed) { - for (int i1 = 0; i1 + this.scrollPos < drawnChatLines.size() && i1 < i.get(); ++i1) { - ChatLine chatline = drawnChatLines.get(i1 + this.scrollPos); - ((IChatLine) chatline).setAnimation(100); - } v1_8_9$isChatOpenAnimationNeed = false; } if (!getChatOpen()) { @@ -158,12 +152,7 @@ public void drawChat(int updateCounter) { n = updateCounter - chatLine.getUpdatedCounter(); if (n < 200 || bl) { - if (n < 150 || getChatOpen()) { - ((IChatLine) chatLine).setAnimation((float) AnimationUtils.base(((IChatLine) chatLine).getAnimation(), 255, 0.1f)); - } else { - ((IChatLine) chatLine).setAnimation((float) AnimationUtils.base(((IChatLine) chatLine).getAnimation(), 0, 0.1f)); - } - int alpha = (int) (((IChatLine) chatLine).getAnimation() * f); + int alpha = (int) (255f * f); if (alpha > 3) { int q = -m * 9; @@ -264,12 +253,10 @@ public List spilt(IChatComponent chatComponent, int i, FontRende } } - @Override public List getChatLines() { return chatLines; } - @Override public List getDrawnChatLines() { return drawnChatLines; } diff --git a/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiPlayerOverlay.java b/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiPlayerOverlay.java index ab0d6da2..5dd0fbd9 100644 --- a/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiPlayerOverlay.java +++ b/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiPlayerOverlay.java @@ -21,10 +21,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Shadow; -import top.fpsmaster.FPSMaster; import top.fpsmaster.features.impl.interfaces.TabOverlay; -import top.fpsmaster.modules.account.AccountManager; -import top.fpsmaster.modules.client.ClientUser; import top.fpsmaster.utils.render.Render2DUtils; import javax.annotation.Nullable; @@ -164,14 +161,7 @@ public void renderPlayerlist(int width, Scoreboard scoreboardIn, ScoreObjective v += 9; } - ClientUser clientUser = FPSMaster.clientUsersManager.getClientUser(networkPlayerInfo2.getGameProfile().getName(), networkPlayerInfo2.getGameProfile().getId().toString()); - boolean isSelf = networkPlayerInfo2.getGameProfile().getName().equals(mc.thePlayer.getName()) && networkPlayerInfo2.getGameProfile().getId().equals(mc.thePlayer.getUniqueID()); - int clientOffset = 0; - if (clientUser != null || isSelf) { - Render2DUtils.drawImage(new ResourceLocation("client/textures/mate.png"), v, w, 8, 8, -1, true); - clientOffset = 10; - } if (networkPlayerInfo2.getGameType() == WorldSettings.GameType.SPECTATOR) { string2 = EnumChatFormatting.ITALIC + string2; diff --git a/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiScreen.java b/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiScreen.java index cf459282..abf2a167 100644 --- a/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiScreen.java +++ b/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinGuiScreen.java @@ -14,7 +14,6 @@ import top.fpsmaster.event.EventDispatcher; import top.fpsmaster.event.events.EventSendChatMessage; import top.fpsmaster.features.impl.interfaces.BetterScreen; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.utils.math.animation.AnimationUtils; import top.fpsmaster.utils.render.Render2DUtils; @@ -64,7 +63,7 @@ public void handleKeyboardInput() throws IOException { */ @Overwrite public void drawWorldBackground(int tint) { - if (Wrappers.minecraft().getWorld() != null) { + if (mc.theWorld != null) { if (BetterScreen.using) { if (BetterScreen.useBG.getValue()) { if (BetterScreen.backgroundAnimation.getValue()) { diff --git a/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinKeybinding.java b/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinKeybinding.java index a3d9d2cd..8001d294 100644 --- a/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinKeybinding.java +++ b/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinKeybinding.java @@ -8,7 +8,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import top.fpsmaster.api.provider.ProviderRegistry; import top.fpsmaster.features.impl.utility.Sprint; import top.fpsmaster.forge.api.IKeyBinding; @@ -28,7 +27,7 @@ public void setPressed(boolean pressed) { @Inject(method = "isKeyDown", at = @At("HEAD"), cancellable = true) public void keyDown(CallbackInfoReturnable cir) { - if (Sprint.using && keyCode == ProviderRegistry.getMinecraftProvider().getMinecraft().getGameSettings().getKeyBindSprint().getKeyCode()) + if (Sprint.using && keyCode == net.minecraft.client.Minecraft.getMinecraft().gameSettings.keyBindSprint.getKeyCode()) cir.setReturnValue(Sprint.sprint); } } diff --git a/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinMinecraft.java b/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinMinecraft.java index 034a763d..296aa7c6 100644 --- a/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinMinecraft.java +++ b/v1.8.9/src/main/java/top/fpsmaster/forge/mixin/MixinMinecraft.java @@ -29,7 +29,6 @@ import top.fpsmaster.event.events.EventMouseClick; import top.fpsmaster.event.events.EventTick; import top.fpsmaster.features.impl.optimizes.Performance; -import top.fpsmaster.api.Wrappers; import top.fpsmaster.utils.render.Render2DUtils; import javax.annotation.Nullable; @@ -59,6 +58,9 @@ public abstract class MixinMinecraft implements IMinecraft { @Shadow public EntityPlayerSP thePlayer; + @Shadow + public net.minecraft.client.multiplayer.WorldClient theWorld; + @Shadow public GuiIngame ingameGUI; @Shadow @@ -202,7 +204,7 @@ public void chatVis(CallbackInfo ci) { */ @Overwrite public int getLimitFramerate() { - if (Wrappers.minecraft().getCurrentScreen() != null && Wrappers.minecraft().getWorld() == null) + if (this.currentScreen != null && this.theWorld == null) return 60; return (Display.isActive()) ? this.gameSettings.limitFramerate : Performance.using ? Performance.fpsLimit.getValue().intValue() : this.gameSettings.limitFramerate; } diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/APIProviderImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/APIProviderImpl.java deleted file mode 100644 index 3e9382db..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/APIProviderImpl.java +++ /dev/null @@ -1,89 +0,0 @@ -package top.fpsmaster.impl; - -import top.fpsmaster.api.APIProvider; -import top.fpsmaster.api.domain.client.IClientAPI; -import top.fpsmaster.api.domain.entity.IEntityAPI; -import top.fpsmaster.api.domain.gui.IGuiAPI; -import top.fpsmaster.api.domain.network.INetworkAPI; -import top.fpsmaster.api.domain.render.IRenderAPI; -import top.fpsmaster.api.domain.sound.ISoundAPI; -import top.fpsmaster.api.domain.world.IWorldAPI; -import top.fpsmaster.impl.client.ClientAPIImpl; -import top.fpsmaster.impl.entity.EntityAPIImpl; -import top.fpsmaster.impl.gui.GuiAPIImpl; -import top.fpsmaster.impl.network.NetworkAPIImpl; -import top.fpsmaster.impl.render.RenderAPIImpl; -import top.fpsmaster.impl.sound.SoundAPIImpl; -import top.fpsmaster.impl.world.WorldAPIImpl; - -/** - * API Provider 实现 (v1.8.9) - * 提供所有域的 API 实例(懒加载 + 缓存) - */ -public class APIProviderImpl implements APIProvider { - - // 懒加载缓存 - private IClientAPI clientAPI; - private IWorldAPI worldAPI; - private IRenderAPI renderAPI; - private INetworkAPI networkAPI; - private IGuiAPI guiAPI; - private ISoundAPI soundAPI; - private IEntityAPI entityAPI; - - @Override - public IClientAPI getClientAPI() { - if (clientAPI == null) { - clientAPI = new ClientAPIImpl(); - } - return clientAPI; - } - - @Override - public IWorldAPI getWorldAPI() { - if (worldAPI == null) { - worldAPI = new WorldAPIImpl(); - } - return worldAPI; - } - - @Override - public IRenderAPI getRenderAPI() { - if (renderAPI == null) { - renderAPI = new RenderAPIImpl(); - } - return renderAPI; - } - - @Override - public INetworkAPI getNetworkAPI() { - if (networkAPI == null) { - networkAPI = new NetworkAPIImpl(); - } - return networkAPI; - } - - @Override - public IGuiAPI getGuiAPI() { - if (guiAPI == null) { - guiAPI = new GuiAPIImpl(); - } - return guiAPI; - } - - @Override - public ISoundAPI getSoundAPI() { - if (soundAPI == null) { - soundAPI = new SoundAPIImpl(); - } - return soundAPI; - } - - @Override - public IEntityAPI getEntityAPI() { - if (entityAPI == null) { - entityAPI = new EntityAPIImpl(); - } - return entityAPI; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/client/ClientAPIImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/client/ClientAPIImpl.java deleted file mode 100644 index 47fde5fb..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/client/ClientAPIImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -package top.fpsmaster.impl.client; - -import net.minecraft.client.Minecraft; -import org.jetbrains.annotations.Nullable; -import top.fpsmaster.api.domain.client.*; - -import java.io.File; - -/** - * 客户端 API 实现 (v1.8.9) - */ -public class ClientAPIImpl implements IClientAPI { - - private MinecraftImpl minecraftWrapper; - - @Override - public IMinecraft getMinecraft() { - if (minecraftWrapper == null) { - minecraftWrapper = new MinecraftImpl(); - } - return minecraftWrapper; - } - - @Override - @Nullable - public IClientPlayer getPlayer() { - net.minecraft.client.entity.EntityPlayerSP mcPlayer = Minecraft.getMinecraft().thePlayer; - if (mcPlayer == null) return null; - return new ClientPlayerImpl(mcPlayer); - } - - @Override - public IGameSettings getSettings() { - return new GameSettingsImpl(Minecraft.getMinecraft().gameSettings); - } - - @Override - public void removeClickDelay() { - // Reset left click counter to remove hit delay - ((top.fpsmaster.forge.api.IMinecraft) Minecraft.getMinecraft()).arch$setLeftClickCounter(0); - } - - @Override - public File getGameDirectory() { - return Minecraft.getMinecraft().mcDataDir; - } - - @Override - @Nullable - public Object getCurrentScreen() { - return Minecraft.getMinecraft().currentScreen; - } - - @Override - public String getServerAddress() { - if (Minecraft.getMinecraft().isSingleplayer()) { - return "localhost"; - } - return Minecraft.getMinecraft().getNetHandler().getNetworkManager().getRemoteAddress().toString(); - } - - @Override - public boolean isSingleplayer() { - return Minecraft.getMinecraft().isSingleplayer(); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/client/ClientPlayerImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/client/ClientPlayerImpl.java deleted file mode 100644 index 3c628ffc..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/client/ClientPlayerImpl.java +++ /dev/null @@ -1,139 +0,0 @@ -package top.fpsmaster.impl.client; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.item.ItemStack; -import org.jetbrains.annotations.Nullable; -import top.fpsmaster.api.domain.client.IClientPlayer; -import top.fpsmaster.api.domain.client.IItemStack; -import top.fpsmaster.api.model.Vec3; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -/** - * 客户端玩家实现 (v1.8.9) - * 将 Minecraft 的 EntityPlayerSP 封装为自定义接口 - */ -public class ClientPlayerImpl implements IClientPlayer { - - private final EntityPlayerSP player; - - public ClientPlayerImpl(EntityPlayerSP player) { - this.player = player; - } - - @Override - public String getName() { - return player.getName(); - } - - @Override - public UUID getUniqueId() { - return player.getUniqueID(); - } - - @Override - public String getUUID() { - return player.getUniqueID().toString(); - } - - @Override - public Vec3 getPosition() { - return new Vec3(player.posX, player.posY, player.posZ); - } - - @Override - public float getYaw() { - return player.rotationYaw; - } - - @Override - public float getPitch() { - return player.rotationPitch; - } - - @Override - public float getHealth() { - return player.getHealth(); - } - - @Override - public float getMaxHealth() { - return player.getMaxHealth(); - } - - @Override - public int getFoodLevel() { - return player.getFoodStats().getFoodLevel(); - } - - @Override - public boolean isOnGround() { - return player.onGround; - } - - @Override - public boolean isSneaking() { - return player.isSneaking(); - } - - @Override - public boolean isSprinting() { - return player.isSprinting(); - } - - @Override - @Nullable - public IItemStack getHeldItem() { - ItemStack mcStack = player.getHeldItem(); - if (mcStack == null) return null; - return new ItemStackImpl(mcStack); - } - - @Override - public List getArmorItems() { - List armorList = new ArrayList<>(); - ItemStack[] mcArmor = player.inventory.armorInventory; - - for (ItemStack stack : mcArmor) { - armorList.add(stack == null ? null : new ItemStackImpl(stack)); - } - return armorList; - } - - @Override - public int getPing() { - NetworkPlayerInfo info = Minecraft.getMinecraft() - .getNetHandler() - .getPlayerInfo(player.getUniqueID()); - return info != null ? info.getResponseTime() : 0; - } - - @Override - public void sendChatMessage(String message) { - player.sendChatMessage(message); - } - - @Override - public Vec3 getMotion() { - return new Vec3(player.motionX, player.motionY, player.motionZ); - } - - @Override - public float getFallDistance() { - return player.fallDistance; - } - - @Override - public int getEntityId() { - return player.getEntityId(); - } - - @Override - public Object getRawPlayer() { - return player; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/client/GameSettingsImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/client/GameSettingsImpl.java deleted file mode 100644 index be9def70..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/client/GameSettingsImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -package top.fpsmaster.impl.client; - -import net.minecraft.client.settings.GameSettings; -import net.minecraft.client.settings.KeyBinding; -import top.fpsmaster.api.domain.client.IGameSettings; -import top.fpsmaster.forge.api.IKeyBinding; - -/** - * 游戏设置实现 (v1.8.9) - */ -public class GameSettingsImpl implements IGameSettings { - - private final GameSettings settings; - - public GameSettingsImpl(GameSettings settings) { - this.settings = settings; - } - - @Override - public void setKeyPressed(String keyName, boolean pressed) { - // 通过按键名称查找对应的 KeyBinding - for (KeyBinding key : settings.keyBindings) { - if (key.getKeyDescription().equals(keyName)) { - ((IKeyBinding) key).setPressed(pressed); - return; - } - } - } - - @Override - public int getRenderDistance() { - return settings.renderDistanceChunks; - } - - @Override - public void setRenderDistance(int chunks) { - settings.renderDistanceChunks = chunks; - } - - @Override - public float getMouseSensitivity() { - return settings.mouseSensitivity; - } - - @Override - public void setMouseSensitivity(float sensitivity) { - settings.mouseSensitivity = sensitivity; - } - - @Override - public boolean isShowDebugInfo() { - return settings.showDebugInfo; - } - - @Override - public int getGuiScale() { - return settings.guiScale; - } - - @Override - public float getFov() { - return settings.fovSetting; - } - - @Override - public boolean isVsyncEnabled() { - return settings.enableVsync; - } - - @Override - public int getFramerateLimit() { - return settings.limitFramerate; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/client/ItemStackImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/client/ItemStackImpl.java deleted file mode 100644 index 86ae3048..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/client/ItemStackImpl.java +++ /dev/null @@ -1,95 +0,0 @@ -package top.fpsmaster.impl.client; - -import net.minecraft.enchantment.Enchantment; -import net.minecraft.enchantment.EnchantmentHelper; -import net.minecraft.item.ItemStack; -import org.jetbrains.annotations.Nullable; -import top.fpsmaster.api.domain.client.IItemStack; - -import java.util.HashMap; -import java.util.Map; - -/** - * 物品堆实现 (v1.8.9) - * 将 Minecraft 的 ItemStack 封装为简化的接口 - */ -public class ItemStackImpl implements IItemStack { - - private final ItemStack stack; - - public ItemStackImpl(ItemStack stack) { - this.stack = stack; - } - - @Override - public String getItemId() { - if (stack.getItem().getRegistryName() != null) { - return stack.getItem().getRegistryName().toString(); - } - return "minecraft:air"; - } - - @Override - public String getDisplayName() { - return stack.getDisplayName(); - } - - @Override - public int getCount() { - return stack.stackSize; - } - - @Override - @Nullable - public int[] getDurability() { - if (!stack.getItem().isDamageable()) return null; - int current = stack.getMaxDamage() - stack.getItemDamage(); - int max = stack.getMaxDamage(); - return new int[]{current, max}; - } - - @Override - public boolean isEnchanted() { - return stack.isItemEnchanted(); - } - - @Override - public Map getEnchantments() { - Map enchants = new HashMap<>(); - - @SuppressWarnings("unchecked") - Map mcEnchants = EnchantmentHelper.getEnchantments(stack); - for (Map.Entry entry : mcEnchants.entrySet()) { - Enchantment ench = Enchantment.getEnchantmentById(entry.getKey()); - if (ench != null && ench.getName() != null) { - enchants.put(ench.getName(), entry.getValue()); - } - } - return enchants; - } - - @Override - public Map getNbtData() { - Map data = new HashMap<>(); - // 简化实现,可以根据需要扩展 - if (stack.hasTagCompound()) { - // 这里可以解析 NBT,但只暴露基础类型 - } - return data; - } - - @Override - public boolean isEmpty() { - return stack == null || stack.stackSize <= 0; - } - - @Override - public boolean isStackable() { - return stack.isStackable(); - } - - @Override - public int getMaxStackSize() { - return stack.getMaxStackSize(); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/client/MinecraftImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/client/MinecraftImpl.java deleted file mode 100644 index d5d9ef6d..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/client/MinecraftImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -package top.fpsmaster.impl.client; - -import net.minecraft.client.Minecraft; -import top.fpsmaster.api.domain.client.IMinecraft; - -/** - * Minecraft 实例实现 (v1.8.9) - */ -public class MinecraftImpl implements IMinecraft { - - private final Minecraft mc; - - public MinecraftImpl() { - this.mc = Minecraft.getMinecraft(); - } - - @Override - public boolean isSingleplayer() { - return mc.isSingleplayer(); - } - - @Override - public int getFramerateLimit() { - return mc.gameSettings.limitFramerate; - } - - @Override - public float getPartialTicks() { - return ((top.fpsmaster.forge.api.IMinecraft) mc).arch$getTimer().renderPartialTicks; - } - - @Override - public void removeLeftClickDelay() { - ((top.fpsmaster.forge.api.IMinecraft) mc).arch$setLeftClickCounter(0); - } - - @Override - public void printChatMessage(String message) { - mc.ingameGUI.getChatGUI().printChatMessage(new net.minecraft.util.ChatComponentText(message)); - } - - @Override - public Object getFontRenderer() { - return mc.fontRendererObj; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/entity/EntityAPIImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/entity/EntityAPIImpl.java deleted file mode 100644 index a5915528..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/entity/EntityAPIImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -package top.fpsmaster.impl.entity; - -import net.minecraft.client.Minecraft; -import net.minecraft.entity.Entity; -import top.fpsmaster.api.domain.entity.IEntity; -import top.fpsmaster.api.domain.entity.IEntityAPI; -import top.fpsmaster.api.model.Vec3; - -import java.util.ArrayList; -import java.util.List; - -public class EntityAPIImpl implements IEntityAPI { - - @Override - public List getAllEntities() { - List entities = new ArrayList<>(); - - if (Minecraft.getMinecraft().theWorld != null) { - for (Object obj : Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (obj instanceof Entity) { - entities.add(new EntityImpl((Entity) obj)); - } - } - } - - return entities; - } - - @Override - public IEntity getEntityById(int entityId) { - if (Minecraft.getMinecraft().theWorld != null) { - Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(entityId); - if (entity != null) { - return new EntityImpl(entity); - } - } - return null; - } - - @Override - public List getNearbyEntities(double radius) { - List entities = new ArrayList<>(); - - if (Minecraft.getMinecraft().thePlayer == null || Minecraft.getMinecraft().theWorld == null) { - return entities; - } - - Entity player = Minecraft.getMinecraft().thePlayer; - Vec3 playerPos = new Vec3(player.posX, player.posY, player.posZ); - - for (Object obj : Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (obj instanceof Entity) { - Entity entity = (Entity) obj; - double distance = player.getDistanceToEntity(entity); - if (distance <= radius) { - entities.add(new EntityImpl(entity)); - } - } - } - - return entities; - } - - @Override - public List getNearbyEntities(Vec3 pos, double radius) { - List entities = new ArrayList<>(); - - if (Minecraft.getMinecraft().theWorld == null) { - return entities; - } - - for (Object obj : Minecraft.getMinecraft().theWorld.loadedEntityList) { - if (obj instanceof Entity) { - Entity entity = (Entity) obj; - double dx = entity.posX - pos.x; - double dy = entity.posY - pos.y; - double dz = entity.posZ - pos.z; - double distance = Math.sqrt(dx * dx + dy * dy + dz * dz); - - if (distance <= radius) { - entities.add(new EntityImpl(entity)); - } - } - } - - return entities; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/entity/EntityImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/entity/EntityImpl.java deleted file mode 100644 index d405e915..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/entity/EntityImpl.java +++ /dev/null @@ -1,114 +0,0 @@ -package top.fpsmaster.impl.entity; - -import net.minecraft.entity.Entity; -import top.fpsmaster.api.domain.entity.IEntity; -import top.fpsmaster.api.model.Vec3; - -public class EntityImpl implements IEntity { - - private final Entity entity; - - public EntityImpl(Entity entity) { - this.entity = entity; - } - - @Override - public int getEntityId() { - return entity.getEntityId(); - } - - @Override - public String getUUID() { - return entity.getUniqueID().toString(); - } - - @Override - public Vec3 getPosition() { - return new Vec3(entity.posX, entity.posY, entity.posZ); - } - - @Override - public String getName() { - return entity.getName(); - } - - @Override - public String getCustomName() { - return entity.getCustomNameTag(); - } - - @Override - public boolean hasCustomName() { - return entity.hasCustomName(); - } - - @Override - public float getYaw() { - return entity.rotationYaw; - } - - @Override - public float getPitch() { - return entity.rotationPitch; - } - - @Override - public Vec3 getMotion() { - return new Vec3(entity.motionX, entity.motionY, entity.motionZ); - } - - @Override - public boolean isOnGround() { - return entity.onGround; - } - - @Override - public boolean isInWater() { - return entity.isInWater(); - } - - @Override - public boolean isInLava() { - return entity.isInLava(); - } - - @Override - public boolean isBurning() { - return entity.isBurning(); - } - - @Override - public boolean isSneaking() { - return entity.isSneaking(); - } - - @Override - public boolean isSprinting() { - return entity.isSprinting(); - } - - @Override - public boolean isInvisible() { - return entity.isInvisible(); - } - - @Override - public double getDistanceTo(Vec3 pos) { - double dx = entity.posX - pos.x; - double dy = entity.posY - pos.y; - double dz = entity.posZ - pos.z; - return Math.sqrt(dx * dx + dy * dy + dz * dz); - } - - @Override - public float getEyeHeight() { - return entity.getEyeHeight(); - } - - /** - * 获取原始 Minecraft 实体对象(仅供内部使用) - */ - public Entity getMinecraftEntity() { - return entity; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/gui/GuiAPIImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/gui/GuiAPIImpl.java deleted file mode 100644 index 4ea38fe2..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/gui/GuiAPIImpl.java +++ /dev/null @@ -1,12 +0,0 @@ -package top.fpsmaster.impl.gui; - -import top.fpsmaster.api.domain.gui.IGuiAPI; -import top.fpsmaster.api.domain.gui.IGuiIngame; - -public class GuiAPIImpl implements IGuiAPI { - - @Override - public IGuiIngame getGuiIngame() { - return new GuiIngameImpl(); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/gui/GuiIngameImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/gui/GuiIngameImpl.java deleted file mode 100644 index 51e08fe6..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/gui/GuiIngameImpl.java +++ /dev/null @@ -1,14 +0,0 @@ -package top.fpsmaster.impl.gui; - -import net.minecraft.client.Minecraft; -import net.minecraft.util.ChatComponentText; -import top.fpsmaster.api.domain.gui.IGuiIngame; - -public class GuiIngameImpl implements IGuiIngame { - - @Override - public void printChatMessage(String message) { - Minecraft.getMinecraft().ingameGUI.getChatGUI() - .printChatMessage(new ChatComponentText(message)); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/network/ChatPacketHandlerImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/network/ChatPacketHandlerImpl.java deleted file mode 100644 index 6421ae4b..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/network/ChatPacketHandlerImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package top.fpsmaster.impl.network; - -import net.minecraft.network.play.server.S02PacketChat; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.domain.network.IChatPacketHandler; - -public class ChatPacketHandlerImpl implements IChatPacketHandler { - - @Override - public boolean isChatPacket(@NotNull Object packet) { - return packet instanceof S02PacketChat; - } - - @Override - @NotNull - public String getUnformattedText(@NotNull Object packet) { - if (packet instanceof S02PacketChat) { - return ((S02PacketChat) packet).getChatComponent().getUnformattedText(); - } - return ""; - } - - @Override - public int getChatType(@NotNull Object packet) { - if (packet instanceof S02PacketChat) { - return ((S02PacketChat) packet).getType(); - } - return 0; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/network/NetworkAPIImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/network/NetworkAPIImpl.java deleted file mode 100644 index b0b894f5..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/network/NetworkAPIImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -package top.fpsmaster.impl.network; - -import top.fpsmaster.api.domain.network.IChatPacketHandler; -import top.fpsmaster.api.domain.network.INetworkAPI; -import top.fpsmaster.api.domain.network.IPlayerListPacketHandler; -import top.fpsmaster.api.domain.network.ITimeUpdatePacketHandler; - -public class NetworkAPIImpl implements INetworkAPI { - - @Override - public IChatPacketHandler getChatPacketHandler() { - return new ChatPacketHandlerImpl(); - } - - @Override - public IPlayerListPacketHandler getPlayerListPacketHandler() { - return new PlayerListPacketHandlerImpl(); - } - - @Override - public ITimeUpdatePacketHandler getTimeUpdatePacketHandler() { - return new TimeUpdatePacketHandlerImpl(); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/network/PlayerListPacketHandlerImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/network/PlayerListPacketHandlerImpl.java deleted file mode 100644 index 80d24d08..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/network/PlayerListPacketHandlerImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package top.fpsmaster.impl.network; - -import net.minecraft.network.play.server.S38PacketPlayerListItem; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.domain.network.IPlayerListPacketHandler; -import top.fpsmaster.forge.api.IS38PacketPlayerListItem; - -import java.util.ArrayList; -import java.util.List; - -public class PlayerListPacketHandlerImpl implements IPlayerListPacketHandler { - - @Override - public boolean isPlayerListPacket(@NotNull Object packet) { - return packet instanceof S38PacketPlayerListItem; - } - - @Override - public boolean isActionAdd(@NotNull Object packet) { - if (packet instanceof S38PacketPlayerListItem) { - S38PacketPlayerListItem p = (S38PacketPlayerListItem) packet; - return p.getAction() == S38PacketPlayerListItem.Action.ADD_PLAYER; - } - return false; - } - - @Override - public boolean isActionRemove(@NotNull Object packet) { - if (packet instanceof S38PacketPlayerListItem) { - S38PacketPlayerListItem p = (S38PacketPlayerListItem) packet; - return p.getAction() == S38PacketPlayerListItem.Action.REMOVE_PLAYER; - } - return false; - } - - @Override - public List getPlayerNames(@NotNull Object packet) { - List names = new ArrayList<>(); - if (packet instanceof S38PacketPlayerListItem) { - IS38PacketPlayerListItem p = (IS38PacketPlayerListItem) packet; - for (S38PacketPlayerListItem.AddPlayerData data : p.getPlayers()) { - if (data.getProfile() != null && data.getProfile().getName() != null) { - names.add(data.getProfile().getName()); - } - } - } - return names; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/network/TimeUpdatePacketHandlerImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/network/TimeUpdatePacketHandlerImpl.java deleted file mode 100644 index d5710490..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/network/TimeUpdatePacketHandlerImpl.java +++ /dev/null @@ -1,21 +0,0 @@ -package top.fpsmaster.impl.network; - -import net.minecraft.network.play.server.S03PacketTimeUpdate; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.domain.network.ITimeUpdatePacketHandler; - -public class TimeUpdatePacketHandlerImpl implements ITimeUpdatePacketHandler { - - @Override - public boolean isTimeUpdatePacket(@NotNull Object packet) { - return packet instanceof S03PacketTimeUpdate; - } - - @Override - public long getWorldTime(@NotNull Object packet) { - if (packet instanceof S03PacketTimeUpdate) { - return ((S03PacketTimeUpdate) packet).getWorldTime(); - } - return 0; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/render/ParticleManagerImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/render/ParticleManagerImpl.java deleted file mode 100644 index b089201a..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/render/ParticleManagerImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -package top.fpsmaster.impl.render; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.particle.EffectRenderer; -import net.minecraft.init.Blocks; -import net.minecraft.util.EnumParticleTypes; -import top.fpsmaster.api.domain.render.IParticleManager; -import top.fpsmaster.api.model.BlockPos; - -public class ParticleManagerImpl implements IParticleManager { - - private final EffectRenderer effectRenderer; - - public ParticleManagerImpl() { - this.effectRenderer = Minecraft.getMinecraft().effectRenderer; - } - - @Override - public void addRedstoneBreakParticle(BlockPos pos) { - net.minecraft.util.BlockPos mcPos = new net.minecraft.util.BlockPos(pos.getX(), pos.getY(), pos.getZ()); - IBlockState state = Blocks.redstone_block.getDefaultState(); - effectRenderer.addBlockDestroyEffects(mcPos, state); - } - - @Override - public void addBlockBreakParticle(BlockPos pos, String blockId) { - net.minecraft.util.BlockPos mcPos = new net.minecraft.util.BlockPos(pos.getX(), pos.getY(), pos.getZ()); - - // 尝试从 blockId 获取方块 - Block block = Block.getBlockFromName(blockId); - if (block == null) { - block = Blocks.stone; - } - - IBlockState state = block.getDefaultState(); - effectRenderer.addBlockDestroyEffects(mcPos, state); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/render/RenderAPIImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/render/RenderAPIImpl.java deleted file mode 100644 index f5cb4881..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/render/RenderAPIImpl.java +++ /dev/null @@ -1,24 +0,0 @@ -package top.fpsmaster.impl.render; - -import net.minecraft.client.Minecraft; -import top.fpsmaster.api.domain.render.IParticleManager; -import top.fpsmaster.api.domain.render.IRenderAPI; -import top.fpsmaster.api.domain.render.IRenderManager; - -public class RenderAPIImpl implements IRenderAPI { - - @Override - public IRenderManager getRenderManager() { - return new RenderManagerImpl(); - } - - @Override - public float getPartialTicks() { - return ((top.fpsmaster.forge.api.IMinecraft) Minecraft.getMinecraft()).arch$getTimer().renderPartialTicks; - } - - @Override - public IParticleManager getParticleManager() { - return new ParticleManagerImpl(); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/render/RenderManagerImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/render/RenderManagerImpl.java deleted file mode 100644 index b5c18fbb..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/render/RenderManagerImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -package top.fpsmaster.impl.render; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.entity.RenderManager; -import top.fpsmaster.api.domain.render.IRenderManager; - -public class RenderManagerImpl implements IRenderManager { - - private final IRenderManager rm; - - public RenderManagerImpl() { - this.rm = (IRenderManager) Minecraft.getMinecraft().getRenderManager(); - } - - @Override - public double getRenderPosX() { - return rm.getRenderPosX(); - } - - @Override - public double getRenderPosY() { - return rm.getRenderPosY(); - } - - @Override - public double getRenderPosZ() { - return rm.getRenderPosZ(); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/sound/SoundAPIImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/sound/SoundAPIImpl.java deleted file mode 100644 index 7919b21d..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/sound/SoundAPIImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -package top.fpsmaster.impl.sound; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.PositionedSoundRecord; -import net.minecraft.util.ResourceLocation; -import top.fpsmaster.api.domain.sound.ISoundAPI; - -public class SoundAPIImpl implements ISoundAPI { - - @Override - public void playLightningSound(double x, double y, double z, float volume, float pitch) { - Minecraft.getMinecraft().getSoundHandler().playSound( - new PositionedSoundRecord(new ResourceLocation("ambient.weather.thunder"), - volume, pitch, (float) x, (float) y, (float) z) - ); - } - - @Override - public void playExplosionSound(double x, double y, double z, float volume, float pitch) { - Minecraft.getMinecraft().getSoundHandler().playSound( - new PositionedSoundRecord(new ResourceLocation("random.explode"), - volume, pitch, (float) x, (float) y, (float) z) - ); - } - - @Override - public void playRedstoneBreakSound(double x, double y, double z, float volume, float pitch) { - Minecraft.getMinecraft().getSoundHandler().playSound( - new PositionedSoundRecord(new ResourceLocation("dig.stone"), - volume, pitch, (float) x, (float) y, (float) z) - ); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/world/WorldAPIImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/world/WorldAPIImpl.java deleted file mode 100644 index 7be2ab54..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/world/WorldAPIImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package top.fpsmaster.impl.world; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; -import org.jetbrains.annotations.Nullable; -import top.fpsmaster.api.domain.world.IWorld; -import top.fpsmaster.api.domain.world.IWorldAPI; - -public class WorldAPIImpl implements IWorldAPI { - - @Override - @Nullable - public IWorld getWorld() { - WorldClient mcWorld = Minecraft.getMinecraft().theWorld; - if (mcWorld == null) return null; - return new WorldImpl(mcWorld); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/impl/world/WorldImpl.java b/v1.8.9/src/main/java/top/fpsmaster/impl/world/WorldImpl.java deleted file mode 100644 index b945ce55..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/impl/world/WorldImpl.java +++ /dev/null @@ -1,89 +0,0 @@ -package top.fpsmaster.impl.world; - -import net.minecraft.block.Block; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.util.BlockPos; -import top.fpsmaster.api.domain.world.IWorld; -import top.fpsmaster.api.model.WeatherType; - -public class WorldImpl implements IWorld { - - private final WorldClient world; - - public WorldImpl(WorldClient world) { - this.world = world; - } - - @Override - public String getWorldName() { - return world.getWorldInfo().getWorldName(); - } - - @Override - public long getWorldTime() { - return world.getWorldTime(); - } - - @Override - public void setWorldTime(long time) { - world.setWorldTime(time); - } - - @Override - public String getBlockId(top.fpsmaster.api.model.BlockPos pos) { - BlockPos mcPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ()); - Block block = world.getBlockState(mcPos).getBlock(); - return Block.blockRegistry.getNameForObject(block).toString(); - } - - @Override - public boolean isAirBlock(top.fpsmaster.api.model.BlockPos pos) { - BlockPos mcPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ()); - return world.isAirBlock(mcPos); - } - - @Override - public top.fpsmaster.api.model.BlockPos getSpawnPoint() { - BlockPos spawn = world.getSpawnPoint(); - return new top.fpsmaster.api.model.BlockPos(spawn.getX(), spawn.getY(), spawn.getZ()); - } - - @Override - public WeatherType getWeatherType() { - if (world.isThundering()) { - return WeatherType.THUNDER; - } else if (world.isRaining()) { - return WeatherType.RAIN; - } - return WeatherType.CLEAR; - } - - @Override - public float getRainStrength() { - return world.getRainStrength(1.0f); - } - - - @Override - public int getLightLevel(top.fpsmaster.api.model.BlockPos pos) { - net.minecraft.util.BlockPos mcPos = new net.minecraft.util.BlockPos(pos.getX(), pos.getY(), pos.getZ()); - return world.getLight(mcPos); - } - - @Override - public int getSkyLightLevel(top.fpsmaster.api.model.BlockPos pos) { - net.minecraft.util.BlockPos mcPos = new net.minecraft.util.BlockPos(pos.getX(), pos.getY(), pos.getZ()); - return world.getLightFromNeighborsFor(net.minecraft.world.EnumSkyBlock.SKY, mcPos); - } - - @Override - public int getBlockLightLevel(top.fpsmaster.api.model.BlockPos pos) { - net.minecraft.util.BlockPos mcPos = new net.minecraft.util.BlockPos(pos.getX(), pos.getY(), pos.getZ()); - return world.getLightFromNeighborsFor(net.minecraft.world.EnumSkyBlock.BLOCK, mcPos); - } - - @Override - public Object getRawWorld() { - return world; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/ChatFormattingProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/ChatFormattingProvider.java deleted file mode 100644 index 0cdce7a0..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/ChatFormattingProvider.java +++ /dev/null @@ -1,104 +0,0 @@ -package top.fpsmaster.wrapper; - - -import java.util.*; -import java.util.regex.Pattern; - -public enum ChatFormattingProvider { - BLACK('0'), - DARK_BLUE('1'), - DARK_GREEN('2'), - DARK_AQUA('3'), - DARK_RED('4'), - DARK_PURPLE('5'), - GOLD('6'), - GRAY('7'), - DARK_GRAY('8'), - BLUE('9'), - GREEN('a'), - AQUA('b'), - RED('c'), - LIGHT_PURPLE('d'), - YELLOW('e'), - WHITE('f'), - OBFUSCATED('k', true), - BOLD('l', true), - STRIKETHROUGH('m', true), - UNDERLINE('n', true), - ITALIC('o', true), - RESET('r'); - - public static final char PREFIX_CODE = '§'; - private static final Map FORMATTING_BY_CHAR = new HashMap<>(); - private static final Map FORMATTING_BY_NAME = new HashMap<>(); - private static final Pattern STRIP_FORMATTING_PATTERN = Pattern.compile("(?i)" + '§' + "[0-9A-FK-OR]"); - private final char code; - private final boolean isFormat; - private final String toString; - - ChatFormattingProvider(char code) { - this(code, false); - } - - ChatFormattingProvider(char code, boolean isFormat) { - this.code = code; - this.isFormat = isFormat; - this.toString = "§" + code; - } - - public char getChar() { - return this.code; - } - - public boolean isFormat() { - return this.isFormat; - } - - public boolean isColor() { - return !this.isFormat && this != RESET; - } - - public String getName() { - return this.name().toLowerCase(); - } - - public String toString() { - return this.toString; - } - - public static String stripFormatting(String input) { - return input == null ? null : STRIP_FORMATTING_PATTERN.matcher(input).replaceAll(""); - } - - public static ChatFormattingProvider getByChar(char code) { - return FORMATTING_BY_CHAR.get(code); - } - - public static ChatFormattingProvider getByName(String name) { - return name == null ? null : FORMATTING_BY_NAME.get(name.toLowerCase()); - } - - public static Collection getNames(boolean getColors, boolean getFormats) { - List result = new ArrayList<>(); - ChatFormattingProvider[] arr$ = values(); - int len$ = arr$.length; - - for (ChatFormattingProvider format : arr$) { - if ((!format.isColor() || getColors) && (!format.isFormat() || getFormats)) { - result.add(format.getName()); - } - } - - return result; - } - - static { - ChatFormattingProvider[] arr$ = values(); - - for (ChatFormattingProvider format : arr$) { - FORMATTING_BY_CHAR.put(format.getChar(), format); - FORMATTING_BY_NAME.put(format.getName(), format); - } - - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/Constants.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/Constants.java deleted file mode 100644 index d98dcab8..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/Constants.java +++ /dev/null @@ -1,21 +0,0 @@ -package top.fpsmaster.wrapper; - -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.provider.client.IConstantsProvider; - -public class Constants implements IConstantsProvider { - public static final String VERSION = "1.8.9"; - public static final String EDITION = "Forge"; - - @NotNull - @Override - public String getVersion() { - return VERSION; - } - - @NotNull - @Override - public String getEdition() { - return EDITION; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/EffectRendererProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/EffectRendererProvider.java deleted file mode 100644 index 4c5b7d21..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/EffectRendererProvider.java +++ /dev/null @@ -1,16 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.wrapper.EffectRendererWrap; -import top.fpsmaster.wrapper.blockpos.WrapperBlockPos; - -import static top.fpsmaster.utils.Utility.mc; - -public class EffectRendererProvider implements EffectRendererWrap { - @Override - public void addRedStoneBreak(@NotNull WrapperBlockPos pos) { - mc.effectRenderer.addBlockDestroyEffects(pos.getPos(), Blocks.redstone_block.getBlockState().getBaseState()); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/GameSettingsProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/GameSettingsProvider.java deleted file mode 100644 index 9a06f60f..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/GameSettingsProvider.java +++ /dev/null @@ -1,11 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.client.settings.KeyBinding; -import top.fpsmaster.forge.api.IKeyBinding; -import top.fpsmaster.api.wrapper.GameSettingsWrap; - -public class GameSettingsProvider implements GameSettingsWrap { - public void setKeyPress(KeyBinding key, boolean value){ - ((IKeyBinding) key).setPressed(value); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/GuiIngameProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/GuiIngameProvider.java deleted file mode 100644 index 6106285a..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/GuiIngameProvider.java +++ /dev/null @@ -1,167 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.Entity; -import net.minecraft.entity.SharedMonsterAttributes; -import net.minecraft.entity.ai.attributes.IAttributeInstance; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.potion.Potion; -import net.minecraft.util.MathHelper; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.wrapper.GuiIngameWrap; - -import java.util.Random; - -import static net.minecraft.client.gui.Gui.icons; -import static top.fpsmaster.utils.Utility.mc; - -public class GuiIngameProvider implements GuiIngameWrap { - protected static final Random rand = new Random(); - protected static int playerHealth = 0; - protected static int lastPlayerHealth = 0; - protected static long lastSystemTime = 0L; - protected static long healthUpdateCounter = 0L; - - public void drawHealth(@NotNull Entity entity) { - if (!(entity instanceof EntityPlayer)) - return; - mc.getTextureManager().bindTexture(icons); - GlStateManager.enableBlend(); - GlStateManager.enableTexture2D(); - EntityPlayer entityPlayer = (EntityPlayer) entity; - int i = MathHelper.ceiling_float_int(entityPlayer.getHealth()); - boolean bl = healthUpdateCounter > (long) mc.ingameGUI.getUpdateCounter() && (healthUpdateCounter - (long) mc.ingameGUI.getUpdateCounter()) / 3L % 2L == 1L; - if (i < playerHealth && entityPlayer.hurtResistantTime > 0) { - lastSystemTime = Minecraft.getSystemTime(); - healthUpdateCounter = mc.ingameGUI.getUpdateCounter() + 20; - } else if (i > playerHealth && entityPlayer.hurtResistantTime > 0) { - lastSystemTime = Minecraft.getSystemTime(); - healthUpdateCounter = mc.ingameGUI.getUpdateCounter() + 10; - } - - if (Minecraft.getSystemTime() - lastSystemTime > 1000L) { - playerHealth = i; - lastPlayerHealth = i; - lastSystemTime = Minecraft.getSystemTime(); - } - - playerHealth = i; - int j = lastPlayerHealth; - rand.setSeed(mc.ingameGUI.getUpdateCounter() * 312871L); - IAttributeInstance iAttributeInstance = entityPlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth); - int m = -45; - int o = -10; - float f = (float) iAttributeInstance.getAttributeValue(); - float g = entityPlayer.getAbsorptionAmount(); - int p = MathHelper.ceiling_float_int((f + g) / 2.0F / 10.0F); - int q = Math.max(10 - (p - 2), 3); - int r = o - (p - 1) * q - 10; - float h = g; - int s = entityPlayer.getTotalArmorValue(); - int t = -1; - if (entityPlayer.isPotionActive(Potion.regeneration)) { - t = mc.ingameGUI.getUpdateCounter() % MathHelper.ceiling_float_int(f + 5.0F); - } - - int u; - int v; - for (u = 0; u < 10; ++u) { - if (s > 0) { - v = m + u * 8; - if (u * 2 + 1 < s) { - drawTexturedModalRect(v, r, 34, 9, 9, 9); - } - - if (u * 2 + 1 == s) { - drawTexturedModalRect(v, r, 25, 9, 9, 9); - } - - if (u * 2 + 1 > s) { - drawTexturedModalRect(v, r, 16, 9, 9, 9); - } - } - } - - int w; - int x; - int y; - int z; - int aa; - for (u = MathHelper.ceiling_float_int((f + g) / 2.0F) - 1; u >= 0; --u) { - v = 16; - if (entityPlayer.isPotionActive(Potion.poison)) { - v += 36; - } else if (entityPlayer.isPotionActive(Potion.wither)) { - v += 72; - } - - w = 0; - if (bl) { - w = 1; - } - - x = MathHelper.ceiling_float_int((float) (u + 1) / 10.0F) - 1; - y = m + u % 10 * 8; - z = o - x * q; - if (i <= 4) { - z += rand.nextInt(2); - } - - if (u == t) { - z -= 2; - } - - aa = 0; - if (entityPlayer.worldObj.getWorldInfo().isHardcoreModeEnabled()) { - aa = 5; - } - - drawTexturedModalRect(y, z, 16 + w * 9, 9 * aa, 9, 9); - if (bl) { - if (u * 2 + 1 < j) { - drawTexturedModalRect(y, z, v + 54, 9 * aa, 9, 9); - } - - if (u * 2 + 1 == j) { - drawTexturedModalRect(y, z, v + 63, 9 * aa, 9, 9); - } - } - - if (h > 0.0F) { - if (h == g && g % 2.0F == 1.0F) { - drawTexturedModalRect(y, z, v + 153, 9 * aa, 9, 9); - } else { - drawTexturedModalRect(y, z, v + 144, 9 * aa, 9, 9); - } - - h -= 2.0F; - } else { - if (u * 2 + 1 < i) { - drawTexturedModalRect(y, z, v + 36, 9 * aa, 9, 9); - } - - if (u * 2 + 1 == i) { - drawTexturedModalRect(y, z, v + 45, 9 * aa, 9, 9); - } - } - } - GlStateManager.disableTexture2D(); - } - - public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height) { - float f = 0.00390625F; - float g = 0.00390625F; - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldRenderer = tessellator.getWorldRenderer(); - worldRenderer.begin(7, DefaultVertexFormats.POSITION_TEX); - worldRenderer.pos(x, y + height, 0.0).tex((float) (textureX) * f, (float) (textureY + height) * g).endVertex(); - worldRenderer.pos(x + width, y + height, 0.0).tex((float) (textureX + width) * f, (float) (textureY + height) * g).endVertex(); - worldRenderer.pos(x + width, y, 0.0).tex((float) (textureX + width) * f, (float) (textureY) * g).endVertex(); - worldRenderer.pos(x, y, 0.0).tex((float) (textureX) * f, (float) (textureY) * g).endVertex(); - tessellator.draw(); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/GuiMainMenuProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/GuiMainMenuProvider.java deleted file mode 100644 index ac4e59cb..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/GuiMainMenuProvider.java +++ /dev/null @@ -1,183 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.GuiSelectWorld; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.texture.DynamicTexture; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; -import org.jetbrains.annotations.NotNull; -import org.lwjgl.opengl.GL11; -import org.lwjgl.util.glu.Project; -import top.fpsmaster.api.wrapper.MainMenuWrap; -import static top.fpsmaster.utils.Utility.mc; - -public class GuiMainMenuProvider implements MainMenuWrap { - private static final ResourceLocation[] TITLE_PANORAMA_PATHS = new ResourceLocation[]{new ResourceLocation("client/background/panorama_0.png"), new ResourceLocation("client/background/panorama_1.png"), new ResourceLocation("client/background/panorama_2.png"), new ResourceLocation("client/background/panorama_3.png"), new ResourceLocation("client/background/panorama_4.png"), new ResourceLocation("client/background/panorama_5.png")}; - private float panoramaTimer; - private ResourceLocation backgroundTexture; - - /** - * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the - * window resizes, the buttonList is cleared beforehand. - */ - public void initGui() { - DynamicTexture viewportTexture = new DynamicTexture(256, 256); - this.backgroundTexture = mc.getTextureManager().getDynamicTextureLocation("background", viewportTexture); - } - - - /** - * Draws the main menu panorama - */ - public void drawPanorama() { - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer bufferbuilder = tessellator.getWorldRenderer(); - GlStateManager.matrixMode(5889); - GlStateManager.pushMatrix(); - GlStateManager.loadIdentity(); - Project.gluPerspective(120.0F, 1.0F, 0.05F, 10.0F); - GlStateManager.matrixMode(5888); - GlStateManager.pushMatrix(); - GlStateManager.loadIdentity(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F); - GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GlStateManager.disableCull(); - GlStateManager.depthMask(false); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); - int j = 64; - - for (int k = 0; k < j; ++k) { - GlStateManager.pushMatrix(); - float f = ((float) (k % 8) / 8.0F - 0.5F) / 64.0F; - float f1 = ((float) (k / 8) / 8.0F - 0.5F) / 64.0F; - GlStateManager.translate(f, f1, 0.0F); - GlStateManager.rotate(MathHelper.sin(this.panoramaTimer / 400.0F) * 25.0F + 20.0F, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(-this.panoramaTimer * 0.1F, 0.0F, 1.0F, 0.0F); - - for (int l = 0; l < 6; ++l) { - GlStateManager.pushMatrix(); - - if (l == 1) { - GlStateManager.rotate(90.0F, 0.0F, 1.0F, 0.0F); - } - - if (l == 2) { - GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F); - } - - if (l == 3) { - GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F); - } - - if (l == 4) { - GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); - } - - if (l == 5) { - GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F); - } - - mc.getTextureManager().bindTexture(TITLE_PANORAMA_PATHS[l]); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - int i1 = 255 / (k + 1); - bufferbuilder.pos(-1.0D, -1.0D, 1.0D).tex(0.0D, 0.0D).color(255, 255, 255, i1).endVertex(); - bufferbuilder.pos(1.0D, -1.0D, 1.0D).tex(1.0D, 0.0D).color(255, 255, 255, i1).endVertex(); - bufferbuilder.pos(1.0D, 1.0D, 1.0D).tex(1.0D, 1.0D).color(255, 255, 255, i1).endVertex(); - bufferbuilder.pos(-1.0D, 1.0D, 1.0D).tex(0.0D, 1.0D).color(255, 255, 255, i1).endVertex(); - tessellator.draw(); - GlStateManager.popMatrix(); - } - - GlStateManager.popMatrix(); - GlStateManager.colorMask(true, true, true, false); - } - - bufferbuilder.setTranslation(0.0D, 0.0D, 0.0D); - GlStateManager.colorMask(true, true, true, true); - GlStateManager.matrixMode(5889); - GlStateManager.popMatrix(); - GlStateManager.matrixMode(5888); - GlStateManager.popMatrix(); - GlStateManager.depthMask(true); - GlStateManager.enableCull(); - GlStateManager.enableDepth(); - } - - /** - * Rotate and blurs the skybox view in the main menu - */ - public void rotateAndBlurSkybox(int width, int height, float zLevel) { - mc.getTextureManager().bindTexture(this.backgroundTexture); - GL11.glTexParameteri(3553, 10241, 9729); - GL11.glTexParameteri(3553, 10240, 9729); - GL11.glCopyTexSubImage2D(3553, 0, 0, 0, 0, 0, 256, 256); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); - GlStateManager.colorMask(true, true, true, false); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer bufferbuilder = tessellator.getWorldRenderer(); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - GlStateManager.disableAlpha(); - int j = 3; - - for (int k = 0; k < j; ++k) { - float f = 1.0F / (float) (k + 1); - float f1 = (float) (k - 1) / 256.0F; - bufferbuilder.pos(width, height, zLevel).tex(0.0F + f1, 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); - bufferbuilder.pos(width, 0.0D, zLevel).tex(1.0F + f1, 1.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); - bufferbuilder.pos(0.0D, 0.0D, zLevel).tex(1.0F + f1, 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); - bufferbuilder.pos(0.0D, height, zLevel).tex(0.0F + f1, 0.0D).color(1.0F, 1.0F, 1.0F, f).endVertex(); - } - - tessellator.draw(); - GlStateManager.enableAlpha(); - GlStateManager.colorMask(true, true, true, true); - } - - /** - * Renders the skybox in the main menu - */ - public void renderSkybox(int width, int height, float zLevel) { - mc.getFramebuffer().unbindFramebuffer(); - GlStateManager.viewport(0, 0, 256, 256); - this.drawPanorama(); - this.rotateAndBlurSkybox(width, height, zLevel); - int i = 3; - - for (int j = 0; j < i; ++j) { - this.rotateAndBlurSkybox(width, height, zLevel); - this.rotateAndBlurSkybox(width, height, zLevel); - } - - mc.getFramebuffer().bindFramebuffer(true); - GlStateManager.viewport(0, 0, mc.displayWidth, mc.displayHeight); - float f2 = 120.0F / (float) (Math.max(width, height)); - float f = (float) height * f2 / 256.0F; - float f1 = (float) width * f2 / 256.0F; - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer bufferbuilder = tessellator.getWorldRenderer(); - bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR); - bufferbuilder.pos(0.0D, height, zLevel).tex(0.5F - f, 0.5F + f1).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); - bufferbuilder.pos(width, height, zLevel).tex(0.5F - f, 0.5F - f1).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); - bufferbuilder.pos(width, 0.0D, zLevel).tex(0.5F + f, 0.5F - f1).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); - bufferbuilder.pos(0.0D, 0.0D, zLevel).tex(0.5F + f, 0.5F + f1).color(1.0F, 1.0F, 1.0F, 1.0F).endVertex(); - tessellator.draw(); - } - - public void renderSkybox(int mouseX, int mouseY, float partialTicks, int width, int height, float zLevel) { - this.panoramaTimer += partialTicks; - this.renderSkybox(width, height, zLevel); - } - - @Override - public void showSinglePlayer(@NotNull GuiScreen screen) { - mc.displayGuiScreen(new GuiSelectWorld(screen)); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/MinecraftProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/MinecraftProvider.java deleted file mode 100644 index de17ff3a..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/MinecraftProvider.java +++ /dev/null @@ -1,87 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.audio.SoundHandler; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.network.NetworkPlayerInfo; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IChatComponent; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Session; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import top.fpsmaster.forge.api.IMinecraft; -import top.fpsmaster.api.wrapper.MinecraftWrap; - -import java.io.File; -import java.util.Collection; - -public class MinecraftProvider implements MinecraftWrap { - public File getGameDir() { - return Minecraft.getMinecraft().mcDataDir; - } - - public FontRenderer getFontRenderer() { - return Minecraft.getMinecraft().fontRendererObj; - } - - public EntityPlayerSP getPlayer() { - return Minecraft.getMinecraft().thePlayer; - } - - public boolean isHoveringOverBlock() { - return Minecraft.getMinecraft().objectMouseOver != null && Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK; - } - - public ItemStack getPlayerHeldItem() { - return Minecraft.getMinecraft().thePlayer.getHeldItem(); - } - - public WorldClient getWorld() { - return Minecraft.getMinecraft().theWorld; - } - - public ItemStack[] getArmorInventory() { - return getPlayer().inventory.armorInventory; - } - - public void setSession(Session mojang) { - ((IMinecraft) Minecraft.getMinecraft()).arch$setSession(mojang); - } - - public Integer getRespondTime() { - if (Minecraft.getMinecraft().isSingleplayer()) - return 0; - return Minecraft.getMinecraft().getNetHandler().getPlayerInfo(Minecraft.getMinecraft().thePlayer.getUniqueID()).getResponseTime(); - } - public void drawString(String text, float x, float y, int color) { - Minecraft.getMinecraft().fontRendererObj.drawString(text, (int) x, (int) y, color); - } - @NotNull - public String getServerAddress() { - if (Minecraft.getMinecraft().isSingleplayer()) - return "localhost"; - return Minecraft.getMinecraft().getNetHandler().getNetworkManager().getRemoteAddress().toString(); - } - public void removeClickDelay() { - ((IMinecraft) Minecraft.getMinecraft()).arch$setLeftClickCounter(0); - } - - @Override - public void printChatMessage(Object message) { - Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage((IChatComponent) message); - } - - @Override - public Collection getPlayerInfoMap() { - return Minecraft.getMinecraft().getNetHandler().getPlayerInfoMap(); - } - - @Nullable - @Override - public Object getCurrentScreen() { - return Minecraft.getMinecraft().currentScreen; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/RenderManagerProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/RenderManagerProvider.java deleted file mode 100644 index a2681f07..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/RenderManagerProvider.java +++ /dev/null @@ -1,19 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.client.Minecraft; -import top.fpsmaster.forge.api.IRenderManager; -import top.fpsmaster.api.wrapper.RenderManagerWrap; - -public class RenderManagerProvider implements RenderManagerWrap { - public double renderPosX(){ - return ((IRenderManager) Minecraft.getMinecraft().getRenderManager()).renderPosX(); - } - - public double renderPosY(){ - return ((IRenderManager) Minecraft.getMinecraft().getRenderManager()).renderPosY(); - } - - public double renderPosZ(){ - return ((IRenderManager) Minecraft.getMinecraft().getRenderManager()).renderPosZ(); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/SkinProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/SkinProvider.java deleted file mode 100644 index 575b16d4..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/SkinProvider.java +++ /dev/null @@ -1,68 +0,0 @@ -package top.fpsmaster.wrapper; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonObject; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.minecraft.MinecraftProfileTexture; -import net.minecraft.client.Minecraft; -import net.minecraft.client.network.NetworkPlayerInfo; -import top.fpsmaster.forge.api.INetworkPlayerInfo; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.api.wrapper.SkinWrap; -import top.fpsmaster.modules.logger.ClientLogger; -import top.fpsmaster.utils.os.HttpRequest; - -import java.io.IOException; -import java.util.Objects; -import java.util.UUID; - -public class SkinProvider implements SkinWrap { - public void updateSkin(String name, String uuid, String skin) { - if (Wrappers.minecraft().getPlayer() != null && !skin.isEmpty()) { - Minecraft mc = Minecraft.getMinecraft(); - NetworkPlayerInfo info = new NetworkPlayerInfo(new GameProfile(UUID.fromString(uuid), name)); - - for (NetworkPlayerInfo player : mc.getNetHandler().getPlayerInfoMap()) { - if (player.getGameProfile().getName().equals(name) && player.getGameProfile().getId().toString().equals(uuid)) { - info = player; - } - } - - HttpRequest.HttpResponseResult httpResponseResult; - try { - httpResponseResult = HttpRequest.get("https://api.mojang.com/users/profiles/minecraft/" + skin); - } catch (IOException e) { - throw new RuntimeException(e); - } - if (!httpResponseResult.isSuccess()) { - ClientLogger.error("Failed to get skin " + skin + " for player " + name + " " + httpResponseResult.getStatusCode() + " " + httpResponseResult.getBody()); - return; - } - - String json = httpResponseResult.getBody(); - Gson gson = new GsonBuilder().create(); - JsonObject jsonObject = gson.fromJson(json, JsonObject.class); - if (jsonObject != null && jsonObject.has("id")) { - String raw = jsonObject.getAsJsonPrimitive("id").getAsString(); - GameProfile gameProfile = new GameProfile(toUUID(raw), jsonObject.getAsJsonPrimitive("name").getAsString()); - gameProfile = mc.getSessionService().fillProfileProperties(gameProfile, false); - NetworkPlayerInfo finalInfo = info; - mc.getSkinManager().loadProfileTextures(gameProfile, (typeIn, location, profileTexture) -> { - if (Objects.requireNonNull(typeIn) == MinecraftProfileTexture.Type.SKIN) { - ((INetworkPlayerInfo) finalInfo).setSkin(location); - ((INetworkPlayerInfo) finalInfo).setType(profileTexture.getMetadata("model")); - if (finalInfo.getSkinType() == null) { - ((INetworkPlayerInfo) finalInfo).setType("default"); - } - } - }, false); - } - } - } - - private static UUID toUUID(String uuid) { - return UUID.fromString(uuid.substring(0, 8) + "-" + uuid.substring(8, 12) + "-" + uuid.substring(12, 16) + "-" + - uuid.substring(16, 20) + "-" + uuid.substring(20, 32)); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/TextFormattingProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/TextFormattingProvider.java deleted file mode 100644 index 457accac..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/TextFormattingProvider.java +++ /dev/null @@ -1,84 +0,0 @@ -package top.fpsmaster.wrapper; - -public class TextFormattingProvider { - public static ChatFormattingProvider getRed() { - return ChatFormattingProvider.RED; - } - - public static ChatFormattingProvider getGreen() { - return ChatFormattingProvider.GREEN; - } - - public static ChatFormattingProvider getBlue() { - return ChatFormattingProvider.BLUE; - } - - public static ChatFormattingProvider getYellow() { - return ChatFormattingProvider.YELLOW; - } - - public static ChatFormattingProvider getWhite() { - return ChatFormattingProvider.WHITE; - } - - public static ChatFormattingProvider getBlack() { - return ChatFormattingProvider.BLACK; - } - - public static ChatFormattingProvider getGray() { - return ChatFormattingProvider.GRAY; - } - - public static ChatFormattingProvider getDarkGray() { - return ChatFormattingProvider.DARK_GRAY; - } - - public static ChatFormattingProvider getLightPurple() { - return ChatFormattingProvider.LIGHT_PURPLE; - } - - public static ChatFormattingProvider getDarkPurple() { - return ChatFormattingProvider.DARK_PURPLE; - } - - public static ChatFormattingProvider getDarkBlue() { - return ChatFormattingProvider.DARK_BLUE; - } - - public static ChatFormattingProvider getDarkGreen() { - return ChatFormattingProvider.DARK_GREEN; - } - - public static ChatFormattingProvider getDarkAqua() { - return ChatFormattingProvider.DARK_AQUA; - } - - public static ChatFormattingProvider getDarkRed() { - return ChatFormattingProvider.DARK_RED; - } - - public static ChatFormattingProvider getBold() { - return ChatFormattingProvider.BOLD; - } - - public static ChatFormattingProvider getItalic() { - return ChatFormattingProvider.ITALIC; - } - - public static ChatFormattingProvider getUnderline() { - return ChatFormattingProvider.UNDERLINE; - } - - public static ChatFormattingProvider getStrikethrough() { - return ChatFormattingProvider.STRIKETHROUGH; - } - - public static ChatFormattingProvider getObfuscated() { - return ChatFormattingProvider.OBFUSCATED; - } - - public static ChatFormattingProvider getReset() { - return ChatFormattingProvider.RESET; - } - -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/TimerProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/TimerProvider.java deleted file mode 100644 index 9bb9db94..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/TimerProvider.java +++ /dev/null @@ -1,11 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.client.Minecraft; -import top.fpsmaster.forge.api.IMinecraft; -import top.fpsmaster.api.wrapper.TimerWrap; - -public class TimerProvider implements TimerWrap { - public float getRenderPartialTicks(){ - return ((IMinecraft) Minecraft.getMinecraft()).arch$getTimer().renderPartialTicks; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/UtilityProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/UtilityProvider.java deleted file mode 100644 index 4975bcc4..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/UtilityProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; -import net.minecraft.util.ResourceLocation; -import top.fpsmaster.api.provider.game.IUtilityProvider; - -public class UtilityProvider implements IUtilityProvider { - public String getResourcePath(ResourceLocation resourceLocation){ - return resourceLocation.getResourcePath(); - } - - public double getDistanceToEntity(Entity e1, Entity e2){ - return e1.getDistanceToEntity(e2); - } - - public boolean isItemEnhancementEmpty(ItemStack i){ - if (i.getEnchantmentTagList() == null) - return true; - return i.getEnchantmentTagList().hasNoTags(); - } - - public int getPotionIconIndex(PotionEffect effect){ - Potion potion = Potion.potionTypes[effect.getPotionID()]; - - int i = potion.getStatusIconIndex(); - return i; - } - - public IChatComponent makeChatComponent(String msg) { - return new ChatComponentText(msg); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/WorldClientProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/WorldClientProvider.java deleted file mode 100644 index ebbbf952..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/WorldClientProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import top.fpsmaster.api.wrapper.WorldWrap; -import top.fpsmaster.wrapper.blockpos.WrapperBlockPos; -import top.fpsmaster.wrapper.util.WrapperAxisAlignedBB; - -public class WorldClientProvider implements WorldWrap { - - public IBlockState getBlockState(WrapperBlockPos pos) { - return Minecraft.getMinecraft().theWorld.getBlockState(pos.getPos()); - } - - public Block getBlock(WrapperBlockPos pos) { - return Minecraft.getMinecraft().theWorld.getBlockState(pos.getPos()).getBlock(); - } - - public WrapperAxisAlignedBB getBlockBoundingBox(WrapperBlockPos pos, IBlockState state) { - return new WrapperAxisAlignedBB(new AxisAlignedBB(getBlock(pos).getBlockBoundsMinX(), getBlock(pos).getBlockBoundsMinY(), getBlock(pos).getBlockBoundsMinZ(), getBlock(pos).getBlockBoundsMaxX(), getBlock(pos).getBlockBoundsMaxY(), getBlock(pos).getBlockBoundsMaxZ())); - } - - - public void addWeatherEffect(EntityLightningBolt entityLightningBolt) { - Minecraft.getMinecraft().theWorld.addWeatherEffect(entityLightningBolt); - } - - public WorldClient getWorld() { - return Minecraft.getMinecraft().theWorld; - } - - public void setWorldTime(long l) { - Minecraft.getMinecraft().theWorld.setWorldTime(l); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/WrapperEntityLightningBolt.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/WrapperEntityLightningBolt.java deleted file mode 100644 index 051be565..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/WrapperEntityLightningBolt.java +++ /dev/null @@ -1,10 +0,0 @@ -package top.fpsmaster.wrapper; - -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.world.World; - -public class WrapperEntityLightningBolt extends EntityLightningBolt { - public WrapperEntityLightningBolt(World worldIn, double x, double y, double z, boolean effectOnlyIn) { - super(worldIn, x, y, z); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/blockpos/WrapperBlockPos.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/blockpos/WrapperBlockPos.java deleted file mode 100644 index 28e660cd..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/blockpos/WrapperBlockPos.java +++ /dev/null @@ -1,28 +0,0 @@ -package top.fpsmaster.wrapper.blockpos; - - -import net.minecraft.util.BlockPos; - -public class WrapperBlockPos { - BlockPos pos; - public WrapperBlockPos(BlockPos pos) { - this.pos = pos; - } - - public BlockPos getPos() { - return pos; - } - - public double getX() { - return pos.getX(); - } - - public double getY() { - return pos.getY(); - } - - public double getZ() { - return pos.getZ(); - } - -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/entities/EntityTNTPrimedUtil.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/entities/EntityTNTPrimedUtil.java deleted file mode 100644 index b057882c..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/entities/EntityTNTPrimedUtil.java +++ /dev/null @@ -1,9 +0,0 @@ -package top.fpsmaster.wrapper.entities; - -import net.minecraft.entity.item.EntityTNTPrimed; - -public class EntityTNTPrimedUtil { - public static float getFuse(EntityTNTPrimed e) { - return e.fuse; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/mods/WrapperFreeLook.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/mods/WrapperFreeLook.java deleted file mode 100644 index bbec6695..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/mods/WrapperFreeLook.java +++ /dev/null @@ -1,47 +0,0 @@ -package top.fpsmaster.wrapper.mods; - -import org.lwjgl.opengl.Display; -import static top.fpsmaster.utils.Utility.mc; - -import static top.fpsmaster.features.impl.render.FreeLook.*; - -public class WrapperFreeLook { - - public static float getCameraYaw() { - return perspectiveToggled ? cameraYaw : mc.getRenderViewEntity().rotationYaw; - } - - public static float getCameraPitch() { - return perspectiveToggled ? cameraPitch : mc.getRenderViewEntity().rotationPitch; - } - - public static float getCameraPrevYaw() { - return perspectiveToggled ? cameraYaw : mc.getRenderViewEntity().prevRotationYaw; - } - - public static float getCameraPrevPitch() { - return perspectiveToggled ? cameraPitch : mc.getRenderViewEntity().prevRotationPitch; - } - - public static boolean overrideMouse() { - if (mc.inGameHasFocus && Display.isActive()) { - if (!perspectiveToggled) { - return true; - } - mc.mouseHelper.mouseXYChange(); - float f1 = mc.gameSettings.mouseSensitivity * 0.6f + 0.2f; - float f2 = f1 * f1 * f1 * 8.0f; - float f3 = mc.mouseHelper.deltaX * f2; - float f4 = mc.mouseHelper.deltaY * f2; - cameraYaw += f3 * 0.15f; - cameraPitch += f4 * 0.15f; - if (cameraPitch > 90.0f) { - cameraPitch = 90.0f; - } - if (cameraPitch < -90.0f) { - cameraPitch = -90.0f; - } - } - return false; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/mods/WrapperHitboxes.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/mods/WrapperHitboxes.java deleted file mode 100644 index 040b59ae..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/mods/WrapperHitboxes.java +++ /dev/null @@ -1,53 +0,0 @@ -package top.fpsmaster.wrapper.mods; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderGlobal; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.Vec3; -import org.lwjgl.opengl.GL11; -import top.fpsmaster.event.events.EventRender3D; -import top.fpsmaster.features.settings.impl.ColorSetting; -import top.fpsmaster.forge.api.IRenderManager; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.wrapper.RenderManagerProvider; -import top.fpsmaster.wrapper.TimerProvider; -import top.fpsmaster.wrapper.util.WrapperAxisAlignedBB; - -import java.util.stream.Collectors; - -public class WrapperHitboxes { - public static void render(EventRender3D event, ColorSetting color) { -// GL11.glPushAttrib(GL11.GL_ALPHA | GL11.GL_BLEND | GL11.GL_TEXTURE_2D | GL11.GL_LIGHTING | GL11.GL_DEPTH_TEST | GL11.GL_CULL_FACE); - GlStateManager.pushAttrib(); - GlStateManager.depthMask(false); - GlStateManager.disableTexture2D(); -// GlStateManager.disableLighting(); - GlStateManager.disableCull(); - GlStateManager.disableAlpha(); - for (Entity entity : Minecraft.getMinecraft().theWorld.loadedEntityList.stream().filter(e -> e != Minecraft.getMinecraft().thePlayer && !e.isInvisible()).collect(Collectors.toList())) { - AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox(); - double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * Wrappers.timer().getRenderPartialTicks(); - double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * Wrappers.timer().getRenderPartialTicks(); - double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * Wrappers.timer().getRenderPartialTicks(); - double x = d0 - ((IRenderManager) Minecraft.getMinecraft().getRenderManager()).renderPosX(); - double y = d1 - ((IRenderManager) Minecraft.getMinecraft().getRenderManager()).renderPosY(); - double z = d2 - ((IRenderManager) Minecraft.getMinecraft().getRenderManager()).renderPosZ(); - AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.minX - entity.posX + x, axisalignedbb.minY - entity.posY + y, axisalignedbb.minZ - entity.posZ + z, axisalignedbb.maxX - entity.posX + x, axisalignedbb.maxY - entity.posY + y, axisalignedbb.maxZ - entity.posZ + z); - RenderGlobal.drawOutlinedBoundingBox(axisalignedbb1, color.getColor().getRed(), color.getColor().getGreen(), color.getColor().getBlue(), color.getColor().getAlpha()); - } - GlStateManager.enableTexture2D(); -// GlStateManager.enableLighting(); - GlStateManager.enableCull(); - GlStateManager.disableBlend(); - GlStateManager.depthMask(true); - GlStateManager.popAttrib(); - - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/mods/WrapperPerformance.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/mods/WrapperPerformance.java deleted file mode 100644 index 3b8cc916..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/mods/WrapperPerformance.java +++ /dev/null @@ -1,156 +0,0 @@ -package top.fpsmaster.wrapper.mods; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import top.fpsmaster.features.impl.optimizes.CheckEntity; - -public class WrapperPerformance { - - - public static boolean isVisible(CheckEntity entity) { - if (entity.getEntity() instanceof EntityPlayer) - return true; - long timePassedSinceLastCheck = System.currentTimeMillis() - entity.getLastTimeChecked(); - EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; - double cameraX = player.posX; // 获取玩家的 X 坐标 - double cameraY = player.posY + player.getEyeHeight(); // 获取玩家的 Y 坐标,并加上眼睛的高度 - double cameraZ = player.posZ; // 获取玩家的 Z 坐标 - if ((!entity.isLastCullingVisible() || timePassedSinceLastCheck >= 3000L)) { - double distance = Math.max(Math.abs(entity.getMinX() - cameraX), Math.max(Math.abs(entity.getMinY() - cameraY), Math.abs(entity.getMinZ() - cameraZ))); - distance = Math.max(0.0D, distance - 5.0D); - int interval = 1500; - long timeToCache = (long) ((double) interval * distance); - if (timePassedSinceLastCheck < timeToCache) { - return entity.isLastCullingVisible(); - } - - boolean visible = isVisible(Minecraft.getMinecraft().theWorld, entity.getMinX(), entity.getMinY(), entity.getMinZ(), entity.getMaxX(), entity.getMaxY(), entity.getMaxZ(), cameraX, cameraY, cameraZ); - entity.setLastCullingVisible(visible); - return visible; - } else { - return true; - } - } - - public static boolean isVisible(World world, double minX, double minY, double minZ, double maxX, double maxY, double maxZ, double cameraX, double cameraY, double cameraZ) { - if (Minecraft.getMinecraft().gameSettings.hideGUI) { - return true; - } - double distanceRay1X = minX - cameraX; - double distanceRay1Y = minY - cameraY; - double distanceRay1Z = minZ - cameraZ; - double ray1X = cameraX; - double ray1Y = cameraY; - double ray1Z = cameraZ; - double distanceRay1 = Math.sqrt(distanceRay1X * distanceRay1X + distanceRay1Y * distanceRay1Y + distanceRay1Z * distanceRay1Z); - double step1X = distanceRay1X / distanceRay1; - double step1Y = distanceRay1Y / distanceRay1; - double step1Z = distanceRay1Z / distanceRay1; - boolean ray1XPositive = step1X > 0.0D; - boolean ray1YPositive = step1Y > 0.0D; - boolean ray1ZPositive = step1Z > 0.0D; - double distanceRay2X = maxX - cameraX; - double distanceRay2Y = maxY - cameraY; - double distanceRay2Z = maxZ - cameraZ; - double ray2X = cameraX; - double ray2Y = cameraY; - double ray2Z = cameraZ; - double distanceRay2 = Math.sqrt(distanceRay2X * distanceRay2X + distanceRay2Y * distanceRay2Y + distanceRay2Z * distanceRay2Z); - double step2X = distanceRay2X / distanceRay2; - double step2Y = distanceRay2Y / distanceRay2; - double step2Z = distanceRay2Z / distanceRay2; - boolean ray2XPositive = step2X > 0.0D; - boolean ray2YPositive = step2Y > 0.0D; - boolean ray2ZPositive = step2Z > 0.0D; - double distanceRay3X = minX - cameraX; - double distanceRay3Y = maxY - cameraY; - double distanceRay3Z = minZ - cameraZ; - double ray3X = cameraX; - double ray3Y = cameraY; - double ray3Z = cameraZ; - double distanceRay3 = Math.sqrt(distanceRay3X * distanceRay3X + distanceRay3Y * distanceRay3Y + distanceRay3Z * distanceRay3Z); - double step3X = distanceRay3X / distanceRay3; - double step3Y = distanceRay3Y / distanceRay3; - double step3Z = distanceRay3Z / distanceRay3; - boolean ray3XPositive = step3X > 0.0D; - boolean ray3YPositive = step3Y > 0.0D; - boolean ray3ZPositive = step3Z > 0.0D; - double distanceRay4X = maxX - cameraX; - double distanceRay4Y = minY - cameraY; - double distanceRay4Z = maxZ - cameraZ; - double ray4X = cameraX; - double ray4Y = cameraY; - double ray4Z = cameraZ; - double distanceRay4 = Math.sqrt(distanceRay4X * distanceRay4X + distanceRay4Y * distanceRay4Y + distanceRay4Z * distanceRay4Z); - double step4X = distanceRay4X / distanceRay4; - double step4Y = distanceRay4Y / distanceRay4; - double step4Z = distanceRay4Z / distanceRay4; - boolean ray4XPositive = step4X > 0.0D; - boolean ray4YPositive = step4Y > 0.0D; - boolean ray4ZPositive = step4Z > 0.0D; - double maxDistance = Math.max(Math.max(Math.abs(distanceRay1), Math.abs(distanceRay2)), Math.max(Math.abs(distanceRay3), Math.abs(distanceRay4))); - boolean ray1Hit = false; - boolean ray2Hit = false; - boolean ray3Hit = false; - boolean ray4Hit = false; - boolean ray1Free = false; - boolean ray2Free = false; - boolean ray3Free = false; - boolean ray4Free = false; - - for (int i = 0; (double) i < Math.ceil(maxDistance); ++i) { - IBlockState blockState = world.getBlockState(new BlockPos(MathHelper.floor_double(ray1X), MathHelper.floor_double(ray1Y), MathHelper.floor_double(ray1Z))); - if (blockState.getBlock().isFullBlock() && !blockState.getBlock().isOpaqueCube()) { - ray1Hit = ray1Free; - } else { - ray1Free = true; - } - - IBlockState blockState1 = world.getBlockState(new BlockPos(MathHelper.floor_double(ray2X), MathHelper.floor_double(ray2Y), MathHelper.floor_double(ray2Z))); - if (blockState1.getBlock().isFullBlock() && blockState1.getBlock().isOpaqueCube()) { - ray2Hit = ray2Free; - } else { - ray2Free = true; - } - - IBlockState blockState2 = world.getBlockState(new BlockPos(MathHelper.floor_double(ray3X), MathHelper.floor_double(ray3Y), MathHelper.floor_double(ray3Z))); - if (blockState2.getBlock().isFullBlock() && blockState2.getBlock().isOpaqueCube()) { - ray3Hit = ray3Free; - } else { - ray3Free = true; - } - - IBlockState blockState3 = world.getBlockState(new BlockPos(MathHelper.floor_double(ray4X), MathHelper.floor_double(ray4Y), MathHelper.floor_double(ray4Z))); - if (blockState3.getBlock().isFullBlock() && blockState3.getBlock().isOpaqueCube()) { - ray4Hit = ray4Free; - } else { - ray4Free = true; - } - - if (ray1Hit && ray2Hit && ray3Hit && ray4Hit) { - return false; - } - - ray1X = ray1XPositive ? Math.min(ray1X + step1X, minX) : Math.max(ray1X + step1X, minX); - ray1Y = ray1YPositive ? Math.min(ray1Y + step1Y, minY) : Math.max(ray1Y + step1Y, minY); - ray1Z = ray1ZPositive ? Math.min(ray1Z + step1Z, minZ) : Math.max(ray1Z + step1Z, minZ); - ray2X = ray2XPositive ? Math.min(ray2X + step2X, maxX) : Math.max(ray2X + step2X, maxX); - ray2Y = ray2YPositive ? Math.min(ray2Y + step2Y, maxY) : Math.max(ray2Y + step2Y, maxY); - ray2Z = ray2ZPositive ? Math.min(ray2Z + step2Z, maxZ) : Math.max(ray2Z + step2Z, maxZ); - ray3X = ray3XPositive ? Math.min(ray3X + step3X, minX) : Math.max(ray3X + step3X, minX); - ray3Y = ray3YPositive ? Math.min(ray3Y + step3Y, maxY) : Math.max(ray3Y + step3Y, minY); - ray3Z = ray3ZPositive ? Math.min(ray3Z + step3Z, minZ) : Math.max(ray3Z + step3Z, minZ); - ray4X = ray4XPositive ? Math.min(ray4X + step4X, maxX) : Math.max(ray4X + step4X, maxX); - ray4Y = ray4YPositive ? Math.min(ray4Y + step4Y, minY) : Math.max(ray4Y + step4Y, minY); - ray4Z = ray4ZPositive ? Math.min(ray4Z + step4Z, maxZ) : Math.max(ray4Z + step4Z, maxZ); - } - - return true; - } - -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/mods/WrapperScoreboard.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/mods/WrapperScoreboard.java deleted file mode 100644 index 7d3e8779..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/mods/WrapperScoreboard.java +++ /dev/null @@ -1,104 +0,0 @@ -package top.fpsmaster.wrapper.mods; - -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import net.minecraft.scoreboard.Score; -import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.scoreboard.ScorePlayerTeam; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.font.impl.UFontRenderer; -import top.fpsmaster.features.impl.InterfaceModule; -import top.fpsmaster.features.impl.interfaces.Scoreboard; -import top.fpsmaster.ui.custom.impl.ScoreboardComponent; -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.wrapper.TextFormattingProvider; - -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -public class WrapperScoreboard { - public static float[] render(ScoreboardComponent scoreboardComponent, InterfaceModule mod, float x, float y) { - top.fpsmaster.wrapper.scoreboard.WrapperScoreboard scoreboard = new top.fpsmaster.wrapper.scoreboard.WrapperScoreboard(Wrappers.world().getWorld().getScoreboard()); - ScoreObjective scoreobjective = null; - ScorePlayerTeam scoreplayerteam = scoreboard.getPlayersTeam(Wrappers.minecraft().getPlayer().getName()); - - if (scoreplayerteam != null) { - int i1 = scoreboard.getPlayersTeamColorIndex(Wrappers.minecraft().getPlayer().getName()); - - if (i1 >= 0) { - scoreobjective = scoreboard.getObjectiveInDisplaySlot(3 + i1); - } - } - - ScoreObjective objective = scoreobjective != null ? scoreobjective : scoreboard.getObjectiveInDisplaySlot(1); - - if (objective != null) { - Collection collection = scoreboard.getSortedScores(objective); - - List list = collection.stream().filter(score -> !score.getPlayerName().startsWith("#")).collect(Collectors.toList()); - - if (list.size() > 15) { - collection = Lists.newArrayList(Iterables.skip(list, collection.size() - 15)); - } else { - collection = list; - } - - int i = (int) scoreboardComponent.getStringWidth(16, objective.getDisplayName()); - - - for (Score score : collection) { - ScorePlayerTeam scoreteam = scoreboard.getPlayersTeam(score.getPlayerName()); - String s = filterHypixelIllegalCharacters(ScorePlayerTeam.formatPlayerName(scoreteam, score.getPlayerName()) + ": " + TextFormattingProvider.getRed() + score.getScorePoints()); - i = (int) Math.max(i, scoreboardComponent.getStringWidth(16, s)); - } - i += 6; - - int height1 = (int) scoreboardComponent.getStringHeight(16) + 2; - int j = 0; - float h = collection.size() * height1 + 10; - scoreboardComponent.drawRect(x, y, i, h, mod.backgroundColor.getColor()); - - for (Score score1 : collection) { - ++j; - ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score1.getPlayerName()); - String s1 = filterHypixelIllegalCharacters(ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score1.getPlayerName())); - float k = j * height1; - - // title - if (j == collection.size()) { - String s3 = objective.getDisplayName(); - scoreboardComponent.drawRect(x, y, i, height1 + 1, mod.backgroundColor.getColor()); - scoreboardComponent.drawString(16, s3, (int) (x + 2 + ((float) i / 2 - scoreboardComponent.getStringWidth(16, s3) / 2f) * scoreboardComponent.scale), y, -1); - } - scoreboardComponent.drawString(16, s1, ((int) x) + 2, (int) (y + (h - k) * scoreboardComponent.scale), -1); - // 红字 - if (Scoreboard.score.getValue()) { - String s2 = TextFormattingProvider.getRed() + String.valueOf(score1.getScorePoints()); - scoreboardComponent.drawString(16, s2, x + (i - 2 - scoreboardComponent.getStringWidth(16, s2)) * scoreboardComponent.scale, y + k * scoreboardComponent.scale, -1); - } - } - return new float[]{i, h}; - } - return new float[]{100, 120}; - } - - - public static String filterHypixelIllegalCharacters(String text) { - boolean dangerous = false; - StringBuilder stringBuilder = new StringBuilder(); - for (char c : text.toCharArray()) { - if (c == '\ud83c' || c == '\ud83d') { - dangerous = true; - continue; - } - if (dangerous) { - dangerous = false; - continue; - } - if (c == '⚽') continue; - stringBuilder.append(c); - } - return stringBuilder.toString(); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/packets/SPacketChatProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/packets/SPacketChatProvider.java deleted file mode 100644 index c5137583..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/packets/SPacketChatProvider.java +++ /dev/null @@ -1,50 +0,0 @@ -package top.fpsmaster.wrapper.packets; - -import net.minecraft.event.ClickEvent; -import net.minecraft.event.HoverEvent; -import net.minecraft.network.play.server.S02PacketChat; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.ChatStyle; -import net.minecraft.util.IChatComponent; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.FPSMaster; -import top.fpsmaster.api.wrapper.packets.ChatPacketWrap; -import top.fpsmaster.wrapper.TextFormattingProvider; - - -public class SPacketChatProvider implements ChatPacketWrap { - public boolean isPacket(@NotNull Object p) { - return p instanceof S02PacketChat; - } - - @NotNull - @Override - public String getUnformattedText(@NotNull Object p) { - return getChatComponent(p).getUnformattedText(); - } - - @NotNull - @Override - public IChatComponent getChatComponent(@NotNull Object p) { - return ((S02PacketChat) p).getChatComponent(); - } - - @Override - public int getType(@NotNull Object p) { - return ((S02PacketChat) p).getType(); - } - - @Override - public void appendTranslation(@NotNull Object p) { - String unformattedText = getUnformattedText(p); - if (!unformattedText.endsWith(" [T]") && unformattedText.length() > 5) { - ClickEvent clickEvent = new ClickEvent(ClickEvent.Action.RUN_COMMAND, "#TRANSLATE" + unformattedText); - HoverEvent hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(FPSMaster.i18n.get("translate.hover"))); - ChatStyle style = new ChatStyle().setChatClickEvent(clickEvent).setChatHoverEvent(hoverEvent); - ChatComponentText iTextComponents = new ChatComponentText(TextFormattingProvider.getGray().toString() + " [T]"); - iTextComponents.setChatStyle(style); - ((S02PacketChat) p).getChatComponent().appendSibling(iTextComponents); - } - } -} - diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/packets/SPacketPlayerListProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/packets/SPacketPlayerListProvider.java deleted file mode 100644 index 29b87ac2..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/packets/SPacketPlayerListProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -package top.fpsmaster.wrapper.packets; - -import net.minecraft.network.play.server.S38PacketPlayerListItem; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.wrapper.packets.PlayerListItemAddWrap; -import top.fpsmaster.api.wrapper.packets.PlayerListItemWrap; - -import java.util.List; -import java.util.stream.Collectors; - -public class SPacketPlayerListProvider implements PlayerListItemWrap { - public boolean isPacket(@NotNull Object p) { - return p instanceof S38PacketPlayerListItem; - } - - public boolean isActionJoin(@NotNull Object p) { - return isPacket(p) && ((S38PacketPlayerListItem) p).getAction() == S38PacketPlayerListItem.Action.ADD_PLAYER; - } - - public boolean isActionLeave(@NotNull Object p) { - return isPacket(p) && ((S38PacketPlayerListItem) p).getAction() == S38PacketPlayerListItem.Action.REMOVE_PLAYER; - } - - public List getEntries(@NotNull Object p) { - List entries = ((S38PacketPlayerListItem) p).getEntries(); - return entries.stream().map(WrapperAddPlayerData::new).collect(Collectors.toList()); - } - -} - diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/packets/SPacketTimeUpdateProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/packets/SPacketTimeUpdateProvider.java deleted file mode 100644 index 927017da..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/packets/SPacketTimeUpdateProvider.java +++ /dev/null @@ -1,10 +0,0 @@ -package top.fpsmaster.wrapper.packets; - -import net.minecraft.network.play.server.S03PacketTimeUpdate; -import top.fpsmaster.api.wrapper.packets.TimeUpdatePacketWrap; - -public class SPacketTimeUpdateProvider implements TimeUpdatePacketWrap { - public boolean isPacket(Object packet) { - return packet instanceof S03PacketTimeUpdate; - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/packets/WrapperAddPlayerData.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/packets/WrapperAddPlayerData.java deleted file mode 100644 index 991857cf..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/packets/WrapperAddPlayerData.java +++ /dev/null @@ -1,18 +0,0 @@ -package top.fpsmaster.wrapper.packets; - -import net.minecraft.network.play.server.S38PacketPlayerListItem; -import org.jetbrains.annotations.NotNull; -import top.fpsmaster.api.wrapper.packets.PlayerListItemAddWrap; - -public class WrapperAddPlayerData implements PlayerListItemAddWrap { - public S38PacketPlayerListItem.AddPlayerData entity; - - public WrapperAddPlayerData(S38PacketPlayerListItem.AddPlayerData entity) { - this.entity = entity; - } - - @NotNull - public String getName() { - return entity.getProfile().getName(); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/renderEngine/bufferbuilder/WrapperBufferBuilder.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/renderEngine/bufferbuilder/WrapperBufferBuilder.java deleted file mode 100644 index 7d60923a..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/renderEngine/bufferbuilder/WrapperBufferBuilder.java +++ /dev/null @@ -1,34 +0,0 @@ -package top.fpsmaster.wrapper.renderEngine.bufferbuilder; - -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.vertex.VertexFormat; - -public class WrapperBufferBuilder { - private final WorldRenderer buffer; - private final Tessellator tessellator; - - public WrapperBufferBuilder(Tessellator tessellator) { - this.tessellator = tessellator; - this.buffer = tessellator.getWorldRenderer(); - } - - public void begin(int i, VertexFormat positionTex) { - buffer.begin(i, positionTex); - } - - public WorldRenderer pos(float x, float y, double z) { - buffer.pos(x, y, z); - return buffer; - } - - public WorldRenderer pos(double x, double y, double z) { - buffer.pos(x, y, z); - return buffer; - } - - public void color(int r, int g, int b, int a) { - buffer.color(r, g, b, a); - } - -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/renderEngine/global/WrapperRenderGlobal.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/renderEngine/global/WrapperRenderGlobal.java deleted file mode 100644 index 105f77d0..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/renderEngine/global/WrapperRenderGlobal.java +++ /dev/null @@ -1,4 +0,0 @@ -package top.fpsmaster.wrapper.renderEngine.global; - -public class WrapperRenderGlobal { -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/scoreboard/WrapperScoreboard.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/scoreboard/WrapperScoreboard.java deleted file mode 100644 index 7f768680..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/scoreboard/WrapperScoreboard.java +++ /dev/null @@ -1,38 +0,0 @@ -package top.fpsmaster.wrapper.scoreboard; - -import net.minecraft.scoreboard.Score; -import net.minecraft.scoreboard.ScoreObjective; -import net.minecraft.scoreboard.ScorePlayerTeam; -import net.minecraft.scoreboard.Scoreboard; -import net.minecraft.util.EnumChatFormatting; - -import java.util.Collection; -import java.util.Objects; - -public class WrapperScoreboard { - private final Scoreboard scoreboard; - - public WrapperScoreboard(Scoreboard scoreboard) { - this.scoreboard = scoreboard; - } - - public ScorePlayerTeam getPlayersTeam(String name) { - return scoreboard.getPlayersTeam(name); - } - - public EnumChatFormatting getPlayersTeamColor(String name) { - return Objects.requireNonNull(scoreboard.getPlayersTeam(name)).getChatFormat(); - } - - public int getPlayersTeamColorIndex(String name) { - return Objects.requireNonNull(scoreboard.getPlayersTeam(name)).getChatFormat().getColorIndex(); - } - - public ScoreObjective getObjectiveInDisplaySlot(int i) { - return scoreboard.getObjectiveInDisplaySlot(i); - } - - public Collection getSortedScores(ScoreObjective objective) { - return scoreboard.getSortedScores(objective); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/sound/SoundProvider.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/sound/SoundProvider.java deleted file mode 100644 index 1419cb10..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/sound/SoundProvider.java +++ /dev/null @@ -1,18 +0,0 @@ -package top.fpsmaster.wrapper.sound; - -import top.fpsmaster.api.Wrappers; -import top.fpsmaster.api.wrapper.SoundWrap; - -public class SoundProvider implements SoundWrap { - public void playLightning(double posX, double posY, double posZ, float i, float v, boolean b) { - Wrappers.minecraft().getWorld().playSound(posX, posY, posZ, "lightning", i, v, b); - } - - public void playExplosion(double posX, double posY, double posZ, float i, float v, boolean b) { - Wrappers.minecraft().getWorld().playSound(posX, posY, posZ, "explosion", i, v, b); - } - - public void playRedStoneBreak(double posX, double posY, double posZ, float i, float v, boolean b) { - Wrappers.minecraft().getWorld().playSound(posX, posY, posZ, "dig.stone", i, v, b); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/util/WrapperAxisAlignedBB.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/util/WrapperAxisAlignedBB.java deleted file mode 100644 index 2e18263a..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/util/WrapperAxisAlignedBB.java +++ /dev/null @@ -1,97 +0,0 @@ -package top.fpsmaster.wrapper.util; - -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; -import org.jetbrains.annotations.NotNull; - -public class WrapperAxisAlignedBB { - AxisAlignedBB axisAlignedBB; - - public WrapperAxisAlignedBB(AxisAlignedBB axisAlignedBB) { - this.axisAlignedBB = axisAlignedBB; - } - - public WrapperAxisAlignedBB(double x, double y, double z, double x1, double y1, double z1) { - this.axisAlignedBB = new AxisAlignedBB(x, y, z, x1, y1, z1); - } - - public AxisAlignedBB getAxisAlignedBB() { - return axisAlignedBB; - } - - public void setAxisAlignedBB(AxisAlignedBB axisAlignedBB) { - this.axisAlignedBB = axisAlignedBB; - } - - public double minX() { - return axisAlignedBB.minX; - } - - public double minY() { - return axisAlignedBB.minY; - } - - public double minZ() { - return axisAlignedBB.minZ; - } - - public double maxX() { - return axisAlignedBB.maxX; - } - - public double maxY() { - return axisAlignedBB.maxY; - } - - public double maxZ() { - return axisAlignedBB.maxZ; - } - - public double getMinX() { - return axisAlignedBB.minX; - } - - public double getMinY() { - return axisAlignedBB.minY; - } - - public double getMinZ() { - return axisAlignedBB.minZ; - } - - public double getMaxX() { - return axisAlignedBB.maxX; - } - - public double getMaxY() { - return axisAlignedBB.maxY; - } - - public double getMaxZ() { - return axisAlignedBB.maxZ; - } - - public AxisAlignedBB expand(double e){ - axisAlignedBB = axisAlignedBB.expand(e, e, e); - return axisAlignedBB; - } - - public WrapperAxisAlignedBB expand(double x, double y, double z){ - axisAlignedBB = axisAlignedBB.expand(x, y, z); - return this; - } - public MovingObjectPosition calculateIntercept(Vec3 vecA, Vec3 vecB){ - return axisAlignedBB.calculateIntercept(vecA, vecB); - } - - @NotNull - public WrapperAxisAlignedBB addCoord(double x, double y, double z) { - axisAlignedBB = axisAlignedBB.addCoord(x, y, z); - return this; - } - - public boolean isVecInside(@NotNull Vec3 vec3d) { - return axisAlignedBB.isVecInside(vec3d); - } -} diff --git a/v1.8.9/src/main/java/top/fpsmaster/wrapper/util/WrapperVec3.java b/v1.8.9/src/main/java/top/fpsmaster/wrapper/util/WrapperVec3.java deleted file mode 100644 index c9cae8fc..00000000 --- a/v1.8.9/src/main/java/top/fpsmaster/wrapper/util/WrapperVec3.java +++ /dev/null @@ -1,35 +0,0 @@ -package top.fpsmaster.wrapper.util; - - -import net.minecraft.util.Vec3; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class WrapperVec3 { - Vec3 vec3d; - - public WrapperVec3(Vec3 vec3d) { - this.vec3d = vec3d; - } - - public double x(){ - return vec3d.xCoord; - } - - public double y(){ - return vec3d.yCoord; - } - - public double z(){ - return vec3d.zCoord; - } - - public double distanceTo(Object vec3d3) { - return this.vec3d.distanceTo((Vec3) vec3d3); - } - - @NotNull - public Vec3 addVector(double x, double y, double z) { - return this.vec3d.addVector(x, y, z); - } -}