Remove some hypixel warnings
This commit is contained in:
47
src/main/java/moe/nea/notenoughupdates/init/MixinPlugin.java
Normal file
47
src/main/java/moe/nea/notenoughupdates/init/MixinPlugin.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package moe.nea.notenoughupdates.init;
|
||||
|
||||
import moe.nea.notenoughupdates.NotEnoughUpdates;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class MixinPlugin implements IMixinConfigPlugin {
|
||||
@Override
|
||||
public void onLoad(String mixinPackage) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRefMapperConfig() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
return Boolean.getBoolean("notenoughupdates.debug") ||
|
||||
!mixinClassName.startsWith("moe.nea.notenoughupdates.mixins.devenv");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptTargets(Set<String> myTargets, Set<String> otherTargets) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getMixins() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package moe.nea.notenoughupdates.mixins.devenv;
|
||||
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.slf4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Mixin(ClientPlayNetworkHandler.class)
|
||||
public class DisableCommonPacketWarnings {
|
||||
|
||||
@Redirect(method = "onCustomPayload", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V"))
|
||||
public void onCustomPacket(Logger instance, String s, Object o) {
|
||||
if (!Objects.equals(o, Identifier.of("badlion", "mods"))) {
|
||||
instance.warn(s, o);
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "onEntityPassengersSet", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;)V"))
|
||||
public void onUnknownPassenger(Logger instance, String s) {
|
||||
// Ignore passenger data for unknown entities, since HyPixel just sends a lot of those.
|
||||
}
|
||||
|
||||
@Redirect(method = "onTeam", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;[Ljava/lang/Object;)V"))
|
||||
public void onOnTeam(Logger instance, String s, Object[] objects) {
|
||||
// Ignore data for unknown teams, since HyPixel just sends a lot of invalid team data.
|
||||
}
|
||||
|
||||
@Redirect(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V"))
|
||||
public void onOnPlayerList(Logger instance, String s, Object o) {
|
||||
// Ignore invalid player info, since HyPixel just sends a lot of invalid player info
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package moe.nea.notenoughupdates.mixins.devenv;
|
||||
|
||||
import net.minecraft.entity.projectile.FishingBobberEntity;
|
||||
import org.slf4j.Logger;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(FishingBobberEntity.class)
|
||||
public class DisableInvalidFishingHook {
|
||||
@Redirect(method = "onSpawnPacket", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V"))
|
||||
public void onOnSpawnPacket(Logger instance, String s, Object o, Object o1) {
|
||||
// Don't warn for broken fishing hooks, since HyPixel sends a bunch of those
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,19 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "moe.nea.notenoughupdates.mixins",
|
||||
"compatibilityLevel": "JAVA_16",
|
||||
"client": [
|
||||
"MixinDownloadingTerrainScreen",
|
||||
"MixinMessageHandler",
|
||||
"MixinMinecraft",
|
||||
"MixinWorldRenderer"
|
||||
],
|
||||
"mixins": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
"required": true,
|
||||
"plugin": "moe.nea.notenoughupdates.init.MixinPlugin",
|
||||
"package": "moe.nea.notenoughupdates.mixins",
|
||||
"compatibilityLevel": "JAVA_16",
|
||||
"client": [
|
||||
"MixinDownloadingTerrainScreen",
|
||||
"MixinMessageHandler",
|
||||
"MixinMinecraft",
|
||||
"MixinWorldRenderer",
|
||||
"devenv.DisableCommonPacketWarnings"
|
||||
],
|
||||
"mixins": [
|
||||
"devenv.DisableInvalidFishingHook"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user