chore: make release

This commit is contained in:
Allink 2023-08-13 00:49:48 +01:00
parent 59552b8aea
commit cc190aa34e
No known key found for this signature in database
10 changed files with 55 additions and 14 deletions

View file

@ -4,7 +4,7 @@ plugins {
}
group = "com.github.allinkdev"
version = "1.3.0-SNAPSHOT"
version = project.property("api_version")!!
description = "Minecraft-independent Java 8+ API exposing silhouettes of DeviousMod classes"
java.sourceCompatibility = JavaVersion.VERSION_1_8

View file

@ -2,7 +2,8 @@
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true
# Mod Properties
mod_version=3.1.0-SNAPSHOT
mod_version=3.1.0
api_version=1.3.0
maven_group=me.allinkdev
archives_base_name=DeviousMod
minecraft_version=1.20.1

View file

@ -2,6 +2,7 @@ package me.allinkdev.deviousmod;
import com.github.allinkdev.deviousmod.api.DeviousModSilhouette;
import com.github.allinkdev.deviousmod.api.event.impl.imgui.ImGuiHolderOverrideEvent;
import com.github.allinkdev.deviousmod.api.experiments.Experimentality;
import com.github.allinkdev.deviousmod.api.gui.ImGuiHolder;
import com.github.allinkdev.deviousmod.api.load.DeviousModEntrypoint;
import com.github.allinkdev.deviousmod.api.managers.CommandManager;
@ -32,7 +33,10 @@ import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.fabricmc.loader.api.Version;
import net.fabricmc.loader.api.entrypoint.EntrypointContainer;
import net.fabricmc.loader.api.metadata.ModMetadata;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.lenni0451.lambdaevents.LambdaManager;
@ -41,13 +45,18 @@ import net.minecraft.client.option.KeyBinding;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.management.ManagementFactory;
import java.util.List;
public final class DeviousMod implements ClientModInitializer, DeviousModSilhouette<FabricClientCommandSource, KeyBinding, LambdaManager> {
public static final Logger LOGGER = LoggerFactory.getLogger("Devious Mod");
public static final MinecraftClient CLIENT = MinecraftClient.getInstance();
public static final boolean IS_EXPERIMENTAL = ManagementFactory.getRuntimeMXBean().getInputArguments().stream().anyMatch(s -> s.startsWith("-agentlib:jdwp")) || Boolean.getBoolean("com.github.allinkdev.deviousmod.experimental");
public static final FabricLoader FABRIC_LOADER = FabricLoader.getInstance();
public static final ModContainer MOD_CONTAINER = FABRIC_LOADER.getModContainer("deviousmod").orElseThrow(() -> new IllegalStateException("DeviousMod not present"));
public static final ModMetadata METADATA = MOD_CONTAINER.getMetadata();
public static final Version VERSION = METADATA.getVersion();
public static final String VERSION_STRING = VERSION.getFriendlyString();
public static final boolean IS_SNAPSHOT = VERSION_STRING.endsWith("-SNAPSHOT");
public static final boolean IS_EXPERIMENTAL = FABRIC_LOADER.isDevelopmentEnvironment() || Boolean.getBoolean("com.github.allinkdev.deviousmod.experimental");
private static DeviousMod INSTANCE;
private EventManager<LambdaManager> eventManager;
@ -61,6 +70,12 @@ public final class DeviousMod implements ClientModInitializer, DeviousModSilhoue
private ImGuiHolderProxy imGuiHolder;
private Clock clock;
public static boolean isPermittedExperimentality(final Experimentality experimentality) {
if (experimentality == Experimentality.NONE) return true;
if (experimentality == Experimentality.HIDE && IS_EXPERIMENTAL) return true;
return experimentality == Experimentality.WARN && (IS_EXPERIMENTAL || IS_SNAPSHOT);
}
public static DeviousMod getInstance() {
return INSTANCE;
}
@ -140,7 +155,7 @@ public final class DeviousMod implements ClientModInitializer, DeviousModSilhoue
QueryManager.init(this);
ClientCommandRegistrationCallback.EVENT.register(commandManager::register);
ClientCommandRegistrationCallback.EVENT.register(this.commandManager::register);
ClientTickEvents.START_CLIENT_TICK.register(ClientTickStartEvent::onStartTick);
ClientTickEvents.END_CLIENT_TICK.register(ClientTickEndEvent::onTickEnd);

View file

@ -1,12 +1,12 @@
package me.allinkdev.deviousmod.command;
import com.github.allinkdev.deviousmod.api.Command;
import com.github.allinkdev.deviousmod.api.experiments.Experimentality;
import com.github.allinkdev.deviousmod.api.managers.CommandManager;
import com.github.allinkdev.reflector.Reflector;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import me.allinkdev.deviousmod.DeviousMod;
import com.github.allinkdev.deviousmod.api.experiments.Experimentality;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.command.CommandRegistryAccess;
@ -21,7 +21,7 @@ public final class DCommandManager implements CommandManager<FabricClientCommand
.map(Reflector::createNew)
.map(r -> r.create(deviousMod))
.map(Optional::orElseThrow)
.filter(c -> c.getExperimentality() == Experimentality.NONE || (c.getExperimentality() == Experimentality.HIDE && DeviousMod.IS_EXPERIMENTAL))
.filter(c -> DeviousMod.isPermittedExperimentality(c.getExperimentality()))
.toList();
commands.addAll(newCommands);

View file

@ -66,7 +66,7 @@ public final class ClickGuiLayer extends AbstractImGuiLayer {
final DModuleManager moduleManager = this.deviousMod.getModuleManager();
final Set<Module> modules = moduleManager.getModules();
modules.stream().filter(m -> ((m.getExperimentality() == Experimentality.NONE) || m.getExperimentality() == Experimentality.WARN) || (m.getExperimentality() == Experimentality.HIDE && DeviousMod.IS_EXPERIMENTAL)).forEach(this::registerModule);
modules.stream().filter(m -> DeviousMod.isPermittedExperimentality(m.getExperimentality())).forEach(this::registerModule);
EventUtil.registerListener(this);
}

View file

@ -0,0 +1,27 @@
package me.allinkdev.deviousmod.mixin.patches.auth;
import com.mojang.authlib.yggdrasil.TextureUrlChecker;
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.Redirect;
import java.util.List;
@Mixin(value = TextureUrlChecker.class, remap = false)
public abstract class PromiscuousTextureUrlBlocker {
@Shadow
@Final
private static List<String> ALLOWED_DOMAINS;
@Redirect(method = "isAllowedTextureDomain", at = @At(value = "INVOKE", target = "Lcom/mojang/authlib/yggdrasil/TextureUrlChecker;isDomainOnList(Ljava/lang/String;Ljava/util/List;)Z"))
private static boolean deviousmod$isAllowedTextureDomain$isDomainOnList(final String entry, final List<String> domain) {
return domain.equals(ALLOWED_DOMAINS) ? entry.startsWith("textures.minecraft.net") : isDomainOnList(entry, domain);
}
@Shadow
private static boolean isDomainOnList(final String domain, final List<String> list) {
return false;
}
}

View file

@ -1,6 +1,5 @@
package me.allinkdev.deviousmod.module;
import com.github.allinkdev.deviousmod.api.experiments.Experimentality;
import com.github.allinkdev.deviousmod.api.managers.EventManager;
import com.github.allinkdev.deviousmod.api.managers.ModuleManager;
import com.github.allinkdev.deviousmod.api.module.Module;
@ -35,7 +34,7 @@ public final class DModuleManager implements ModuleManager {
.map(Reflector::createNew)
.map(r -> r.create(this))
.map(Optional::orElseThrow), event.createModules(this).stream())
.filter(m -> m.getExperimentality() != Experimentality.HIDE || (m.getExperimentality() == Experimentality.HIDE && DeviousMod.IS_EXPERIMENTAL))
.filter(m -> DeviousMod.isPermittedExperimentality(m.getExperimentality()))
.toList();
this.modules.addAll(newModules);

View file

@ -10,7 +10,7 @@ import net.minecraft.SharedConstants;
public final class LogosModule extends DModule implements ImGuiLayer {
private static final String GAME_VERSION = SharedConstants.getGameVersion().getName();
private static final String TEXT = "DeviousMod " + GAME_VERSION;
private static final String TEXT = "DeviousMod " + (DeviousMod.IS_SNAPSHOT ? "Development" : "Release") + " v" + DeviousMod.VERSION_STRING + " for " + GAME_VERSION + (DeviousMod.IS_EXPERIMENTAL ? " (experimental settings enabled)" : "");
public LogosModule(final DModuleManager moduleManager) {
super(moduleManager);

View file

@ -1,7 +1,6 @@
package me.allinkdev.deviousmod.module.impl;
import com.github.allinkdev.deviousmod.api.event.Cancellable;
import com.github.allinkdev.deviousmod.api.experiments.Experimental;
import com.github.allinkdev.deviousmod.api.module.settings.ModuleSettings;
import me.allinkdev.deviousmod.event.render.block.PreBeaconBeamRenderEvent;
import me.allinkdev.deviousmod.event.render.block.PreBlockEntityRenderEvent;
@ -22,7 +21,6 @@ import net.lenni0451.lambdaevents.EventHandler;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.entity.ItemEntity;
@Experimental(value = "Recently added. Use with caution.", hide = false)
public final class NoRenderModule extends DModule {
public NoRenderModule(final DModuleManager moduleManager) {
super(moduleManager);

View file

@ -19,8 +19,8 @@
"client.network.CommandCompletionStealer",
"client.network.CommandDispatcherListener",
"client.network.CommandInterceptor",
"client.network.packet.PacketSendAndReceive",
"client.network.TimeListener",
"client.network.packet.PacketSendAndReceive",
"client.particle.ParticleRenderListener",
"client.render.block.BeaconRenderListener",
"client.render.glyph.DrawerMixin",
@ -55,6 +55,7 @@
"client.network.packet.RawPacketReceive",
"client.network.packet.RawPacketSend",
"client.render.world.SodiumWorldRenderListener",
"patches.auth.PromiscuousTextureUrlBlocker",
"patches.block.DecoratedPotCrashFix",
"patches.entity.AreaEffectCloudParticleLimiter",
"patches.item.MapIconCountLimiter",