Skip to content

Commit

Permalink
chore: Merge with remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Jun 15, 2024
2 parents c9de282 + 0b18876 commit b354223
Show file tree
Hide file tree
Showing 52 changed files with 2,171 additions and 936 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "hypixel-api"]
path = hypixel-api
url = https://github.com/Skytils/hypixel-api

[submodule "ws-shared"]
path = ws-shared
url = https://github.com/Skytils/ws-shared
17 changes: 14 additions & 3 deletions mod/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ repositories {
mavenCentral()
maven("https://repo.sk1er.club/repository/maven-public/")
maven("https://repo.sk1er.club/repository/maven-releases/")
maven("https://repo.hypixel.net/repository/Hypixel/")
maven("https://jitpack.io") {
mavenContent {
includeGroupAndSubgroups("com.github")
Expand Down Expand Up @@ -77,13 +78,14 @@ loom {

programArgs("--mixin", "mixins.skytils.json")
programArgs("--mixin", "mixins.skytils-events.json")
programArgs("--mixin", "mixins.skytils-init.json")
}
}
remove(getByName("server"))
}
if (project.platform.isForge) {
forge {
mixinConfig("mixins.skytils.json", "mixins.skytils-events.json")
mixinConfig("mixins.skytils.json", "mixins.skytils-events.json", "mixins.skytils-init.json")
}
}
mixin {
Expand Down Expand Up @@ -127,7 +129,7 @@ dependencies {
}

shadowMe(platform(kotlin("bom")))
shadowMe(platform(ktor("bom", "2.3.9", addSuffix = false)))
shadowMe(platform(ktor("bom", "2.3.11", addSuffix = false)))

shadowMe(ktor("serialization-kotlinx-json"))

Expand Down Expand Up @@ -159,6 +161,14 @@ dependencies {

shadowMe("gg.skytils:events")
shadowMe("gg.skytils.hypixel.types:types")
shadowMe("gg.skytils.skytilsws.shared:ws-shared")

shadowMe("org.bouncycastle:bcpg-jdk18on:1.78.1") {
exclude(module = "bcprov-jdk18on")
}
compileOnly("org.bouncycastle:bcprov-jdk18on:1.78.1")
shadowMe("net.hypixel:mod-api:0.4.0")


shadowMe(annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.5")!!)
annotationProcessor("org.spongepowered:mixin:0.8.5:processor")
Expand Down Expand Up @@ -201,7 +211,7 @@ tasks {
"FMLCorePlugin" to "gg.skytils.skytilsmod.tweaker.SkytilsLoadingPlugin",
"FMLCorePluginContainsFMLMod" to true,
"ForceLoadAsMod" to true,
"MixinConfigs" to "mixins.skytils.json,mixins.skytils-events.json",
"MixinConfigs" to "mixins.skytils.json,mixins.skytils-events.json,mixins.skytils-init.json",
"ModSide" to "CLIENT",
"ModType" to "FML",
"TweakClass" to "gg.skytils.skytilsmod.tweaker.SkytilsTweaker",
Expand Down Expand Up @@ -234,6 +244,7 @@ tasks {
relocate("kotlinx.serialization", "gg.skytils.ktx-serialization")
relocate("kotlinx.coroutines", "gg.skytils.ktx-coroutines")
relocate("gg.essential.vigilance", "gg.skytils.vigilance")
relocate("net.hypixel", "gg.skytils.hypixel-net")

exclude(
"**/LICENSE_MixinExtras",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import net.minecraft.command.CommandHandler;
import net.minecraft.command.ICommand;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.gen.Accessor;

import java.util.Map;
Expand All @@ -31,12 +32,14 @@ public interface AccessorCommandHandler {
@Accessor
Set<ICommand> getCommandSet();

@Mutable
@Accessor
void setCommandSet(Set<ICommand> set);

@Accessor
Map<String, ICommand> getCommandMap();

@Mutable
@Accessor
void setCommandMap(Map<String, ICommand> map);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Skytils - Hypixel Skyblock Quality of Life Mod
* Copyright (C) 2020-2024 Skytils
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package gg.skytils.skytilsmod.mixins.transformers.accessors;

import net.hypixel.modapi.HypixelModAPI;
import net.hypixel.modapi.packet.HypixelPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;

import java.util.function.Predicate;

@Mixin(HypixelModAPI.class)
public interface AccessorHypixelModAPI {
@Accessor
Predicate<HypixelPacket> getPacketSender();

@Invoker
void invokeSendRegisterPacket(boolean alwaysSendIfNotEmpty);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Skytils - Hypixel Skyblock Quality of Life Mod
* Copyright (C) 2020-2024 Skytils
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package gg.skytils.skytilsmod.mixins.transformers.accessors;

import net.hypixel.modapi.packet.HypixelPacket;
import net.hypixel.modapi.packet.PacketRegistry;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

import java.util.Map;

@Mixin(PacketRegistry.class)
public interface AccessorHypixelPacketRegistry {
@Accessor
Map<Class<? extends HypixelPacket>, String> getClassToIdentifier();
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ItemRenderer.class)
public class MixinItemRenderer {
public abstract class MixinItemRenderer {
@Shadow
private ItemStack itemToRender;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public abstract class MixinLayerCape implements LayerRenderer<AbstractClientPlay

@Inject(method = "doRenderLayer(Lnet/minecraft/client/entity/AbstractClientPlayer;FFFFFFF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;pushMatrix()V", shift = At.Shift.AFTER))
private void scaleChild(AbstractClientPlayer entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale, CallbackInfo ci) {
if (this.playerRenderer.getMainModel().isChild) {
if (this.playerRenderer.getMainModel().isChild || entity.isChild()) {
GlStateManager.scale(0.5, 0.5, 0.5);
GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@

package gg.skytils.skytilsmod.mixins.transformers.renderer;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import gg.skytils.skytilsmod.mixins.hooks.renderer.LayerCustomHeadHookKt;
import net.minecraft.client.renderer.entity.layers.LayerCustomHead;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -30,6 +33,11 @@
@Mixin(LayerCustomHead.class)
public abstract class MixinLayerCustomHead implements LayerRenderer<EntityLivingBase> {

@WrapOperation(method = "doRenderLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/EntityLivingBase;isSneaking()Z"))
private boolean disableSneakOffset(EntityLivingBase instance, Operation<Boolean> original) {
return (!(instance instanceof EntityPlayer) || !instance.isChild()) && original.call(instance);
}

@Inject(method = "doRenderLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;color(FFFF)V", shift = At.Shift.AFTER), cancellable = true)
private void renderCustomHeadLayer(EntityLivingBase entity, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale, CallbackInfo ci) {
LayerCustomHeadHookKt.renderCustomHeadLayer(entity, p_177141_2_, p_177141_3_, partialTicks, p_177141_5_, p_177141_6_, p_177141_7_, scale, ci);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Skytils - Hypixel Skyblock Quality of Life Mod
* Copyright (C) 2020-2024 Skytils
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package gg.skytils.skytilsmod.mixins.transformers.renderer;

import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
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;

@Mixin(ModelBiped.class)
public abstract class MixinModelBiped extends ModelBase {
@Shadow public ModelRenderer bipedHeadwear;

@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;popMatrix()V", ordinal = 0))
private void renderChildHeadPost(Entity entityIn, float f, float g, float h, float i, float j, float scale, CallbackInfo ci) {
if (this.isChild && entityIn instanceof EntityPlayer) {
this.bipedHeadwear.render(scale);
}
}

@WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelRenderer;render(F)V", ordinal = 6))
private boolean renderChildHeadwear(ModelRenderer instance, float j, @Local(argsOnly = true) Entity entityIn) {
return !this.isChild || !(entityIn instanceof EntityPlayer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(RenderManager.class)
public class MixinRenderManager {
public abstract class MixinRenderManager {
@Inject(method = "shouldRender", at = @At("HEAD"), cancellable = true)
private void shouldRender(Entity entityIn, ICamera camera, double camX, double camY, double camZ, CallbackInfoReturnable<Boolean> cir) {
RenderManagerHookKt.shouldRender(entityIn, camera, camX, camY, camZ, cir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.security.Security;

import static gg.skytils.skytilsmod.tweaker.TweakerUtil.addToClasspath;

Expand All @@ -36,6 +37,7 @@ public class DependencyLoader {

public static void loadDependencies() {
loadBrotli();
if (Security.getProvider("BC") == null) loadBCProv();
}

public static File loadDependency(String path) throws Throwable {
Expand All @@ -49,13 +51,23 @@ public static File loadDependency(String path) throws Throwable {
}
}

System.out.println("Brotli size: " + Files.size(downloadPath));
System.out.printf("Dependency size for %s: %s%n", path.substring(path.lastIndexOf('/') + 1), Files.size(downloadPath));

addToClasspath(downloadLocation.toURI().toURL());

return downloadLocation;
}

public static void loadBCProv() {
try {
loadDependency("org/bouncycastle/bcprov-jdk18on/1.78.1/bcprov-jdk18on-1.78.1.jar");
System.out.println("Bouncy Castle provider loaded");
} catch (Throwable t) {
System.out.println("Failed to load Bouncy Castle providers");
t.printStackTrace();
}
}

public static void loadBrotli() {
if (System.getProperty("skytils.noNativeBrotli") != null) {
System.out.println("Native Brotli disabled by system property");
Expand Down
Loading

0 comments on commit b354223

Please sign in to comment.