Skip to content

Commit

Permalink
Finish porting to Legacy Fabric (aside from ASM)
Browse files Browse the repository at this point in the history
  • Loading branch information
Deftu committed Dec 28, 2024
1 parent 79333d2 commit e3c6d46
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ preprocess {

toolkitLoomHelper {
// Adds OneConfig to our project
useOneConfig("1.1.0-alpha.34", "1.0.0-alpha.46", mcData, "commands", "config-impl", "events", "hud", "internal", "ui")
useOneConfig("1.1.0-alpha.34", "1.0.0-alpha.47", mcData, "commands", "config-impl", "events", "hud", "internal", "ui")
useDevAuth()

// Removes the server configs from IntelliJ IDEA, leaving only client runs.
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/org/polyfrost/hytils/HytilsReborn.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
//#else
//$$ import net.fabricmc.api.ClientModInitializer;
//$$ import net.fabricmc.loader.api.FabricLoader;
//$$ import net.fabricmc.loader.api.entrypoint.EntrypointContainer;
//#endif

import org.polyfrost.oneconfig.api.event.v1.EventManager;
Expand Down Expand Up @@ -111,6 +113,17 @@ public class HytilsReborn
private RankType rank;

private void initialize() {
//#if FABRIC
//$$ INSTANCE = FabricLoader.getInstance()
//$$ .getEntrypointContainers("client", ClientModInitializer.class)
//$$ .stream()
//$$ .map(EntrypointContainer::getEntrypoint)
//$$ .filter(HytilsReborn.class::isInstance)
//$$ .map(HytilsReborn.class::cast)
//$$ .findFirst()
//$$ .orElseThrow(() -> new IllegalStateException("Could not find HytilsReborn entrypoint"));
//#endif

config = new HytilsConfig();

CommandManager.registerCommand(new HousingVisitCommand());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void postApply(

private String mapMethodNameFromNode(AbstractInsnNode node) {
MethodInsnNode methodInsnNode = (MethodInsnNode) node;
return FMLDeobfuscatingRemapper.INSTANCE.mapMethodName(methodInsnNode.owner, methodInsnNode.name, methodInsnNode.desc);
return DeobfuscationRemapper.INSTANCE.mapMethodName(methodInsnNode.owner, methodInsnNode.name, methodInsnNode.desc);
}

private InsnList modifyName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,19 @@
import org.polyfrost.hytils.config.HytilsConfig;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiMultiplayer;
import net.minecraft.client.multiplayer.ServerData;
import org.polyfrost.oneconfig.api.event.v1.EventManager;
import org.polyfrost.oneconfig.api.event.v1.events.TickEvent;
import org.polyfrost.oneconfig.api.event.v1.invoke.impl.Subscribe;
import org.polyfrost.oneconfig.api.platform.v1.Platform;
import org.polyfrost.oneconfig.api.platform.v1.PlayerPlatform;

public class AutoStart {

@Subscribe
public void tick(TickEvent event) {
if (Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu && HytilsReborn.INSTANCE.isLoadedCall()) {
if (HytilsConfig.autoStart) {
FMLClientHandler.instance().connectToServer(
new GuiMultiplayer(Minecraft.getMinecraft().currentScreen),
new ServerData("hypixel", "hypixel.net", false)
); // TODO
Platform.player().joinServer(new PlayerPlatform.Server("hypixel", "hypixel.net"));
}

HytilsReborn.INSTANCE.setLoadedCall(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.polyfrost.hytils.mixin;

import net.hypixel.data.type.GameType;
import net.minecraft.init.Items;
import org.polyfrost.hytils.config.HytilsConfig;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderEntityItem;
Expand All @@ -38,7 +39,14 @@ public class RenderEntityItemMixin_UHCOverlay {
Item item = entity.getEntityItem().getItem();
GameType gameType = HypixelUtils.getLocation().getGameType().orElse(null);
if (HypixelUtils.isHypixel() && (gameType == GameType.UHC || gameType == GameType.SPEED_UHC) && HytilsConfig.uhcOverlay) {
if (item.getRegistryName().equals("minecraft:apple") || item.getRegistryName().equals("minecraft:golden_apple") || item.getRegistryName().equals("minecraft:skull") || item.getRegistryName().equals("minecraft:gold_ingot") || item.getRegistryName().equals("minecraft:gold_nugget")) {
int itemId = Item.getIdFromItem(item);
if (
itemId == 260 ||
itemId == 322 ||
itemId == 397 ||
itemId == 266 ||
itemId == 371
) {
GlStateManager.scale(HytilsConfig.uhcOverlayMultiplier, HytilsConfig.uhcOverlayMultiplier, HytilsConfig.uhcOverlayMultiplier);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]
},
"mixins": [
"mixins.${mod_id}.json"
"mixins.hytils.json"
],
"depends": {
"fabricloader": ">=0.15.11",
Expand Down

0 comments on commit e3c6d46

Please sign in to comment.