diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-07-21 04:04:48 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-20 20:04:48 +0100 |
commit | f06946c01b2c8f210b398a16610c260eca093a8b (patch) | |
tree | 22bda7a5e9b0a1e7370ff2b1e74fc7c9e4035379 /versions/src/main/java/cc/polyfrost/oneconfig/internal | |
parent | ff2ead62333e90b61e05c8cb6a91f692fcf30805 (diff) | |
download | OneConfig-f06946c01b2c8f210b398a16610c260eca093a8b.tar.gz OneConfig-f06946c01b2c8f210b398a16610c260eca093a8b.tar.bz2 OneConfig-f06946c01b2c8f210b398a16610c260eca093a8b.zip |
HUD Improvements, 1.16 port, fix NanoVG with ARM (#52)
* egg 1
* separate Hud from background stuff
* 1984
This reverts commit 9ae517d57bbd495d30d35cb1cbfe81a03556e6bd.
* hitboxes woo!!!!!
* Revert "hitboxes woo!!!!!"
This reverts commit 405d32d17df3c83f2e79eddf0de853f7279767a6.
* padding
* allow position to go slightly off the screen
* stop using ints for ABSOLUTELY EVERYTHING, DIAMOND ...
fix vigilance compat not setting color
* start on new pos system
* some stuff
* finish new position system
* api momento
* 1.16.2 fabric port
* start on hud gui
* temp remove 1.16.2 fabric since it doesn't compile
* fix fabric build
* hud gui stuff
* apiDump
* fix fabric build 2
* so true
* selecting stuff
* scaling + other small things
* More protecting
* fix nanovg not working with macOS ARM
move OneConfig.preLaunch to OneConfigInit
* clean up OneUIScreen
make kotlin version of TestNanoVGGui
* make keybinds have runnable by default
* rollback keybind things
* merge master into hud-improvements (#55)
* Release workflow (#53)
* release workflow
* update normal version to hash
* fix
* fix naming
* fix some stuff
* fix version thing
* switch to number from hash
* Release workflow (#54)
* release workflow
* update normal version to hash
* fix
* fix naming
* fix some stuff
* fix version thing
* switch to number from hash
* Maybe epic fixo
* gotta love those Java principles
* Revert "gotta love those Java principles", wrong branch
This reverts commit 333d8b2ad8941790c13c4bfe0777fbd203d463e5.
* start on snapping
* Finish snapping
* stop including mixin by default on legacy versions
this breaks builds if the mod itself does not use mixin
* merge draw and drawExample
* fix gradle publish
* Some fixes
* Api DUmpidy
* Help subcommand impovments (#59)
* Made the overall look of the "help" subcommand better + added the ability to change the colour for the command overall + each individual SubCommand
* Made the alliases show batter + added support for to show subcommand aliasses
* mr deliverer didnt reply but whatever, added a space between command/subcommand and alliasses
Co-authored-by: pinkulu <pinkulumc@gmail.com>
* fix file not overwriting
toJavaColor
* Fix full shadow not scaling correctly
Co-authored-by: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>
Co-authored-by: nxtdaydelivery <12willettsh@gmail.com>
Co-authored-by: pinkulu <56201697+pinkulu@users.noreply.github.com>
Co-authored-by: pinkulu <pinkulumc@gmail.com>
Diffstat (limited to 'versions/src/main/java/cc/polyfrost/oneconfig/internal')
6 files changed, 23 insertions, 91 deletions
diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java index 4f73198..7eb5ef9 100644 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java @@ -24,43 +24,32 @@ import java.io.File; //#if MC<=11202 @net.minecraftforge.fml.common.Mod(modid = "@ID@", name = "@NAME@", version = "@VER@") //#else +//#if FORGE==1 //$$ @net.minecraftforge.fml.common.Mod("@ID@") //#endif +//#endif public class OneConfig { public OneConfig() { EventManager.INSTANCE.register(this); } - public static final File oneConfigDir = new File("./OneConfig"); public static final Logger LOGGER = LogManager.getLogger("@NAME@"); - private static boolean preLaunched = false; private static boolean initialized = false; /** - * Called before mods are loaded. + * Called after mods are loaded. * <p><b>SHOULD NOT BE CALLED!</b></p> */ - public static void preLaunch() { - if (preLaunched) return; - oneConfigDir.mkdirs(); - new File(oneConfigDir, "profiles").mkdirs(); + @SuppressWarnings("ResultOfMethodCallIgnored") + public static void init() { + if (initialized) return; if (OneConfigConfig.getInstance() == null) { OneConfigConfig.getInstance(); } if (Preferences.getInstance() == null) { Preferences.getInstance(); } - preLaunched = true; - } - - /** - * Called after mods are loaded. - * <p><b>SHOULD NOT BE CALLED!</b></p> - */ - @SuppressWarnings("ResultOfMethodCallIgnored") - public static void init() { - if (initialized) return; GuiUtils.getDeltaTime(); // called to make sure static initializer is called try { EventManager.INSTANCE.register(BlurHandler.INSTANCE); diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java deleted file mode 100644 index f5e7bed..0000000 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/eggs/TechnobladeCrownRenderer.java +++ /dev/null @@ -1,39 +0,0 @@ -//#if MC<=11202 -package cc.polyfrost.oneconfig.internal.eggs; - -import cc.polyfrost.oneconfig.internal.config.Preferences; -import net.minecraft.client.model.ModelPig; -import net.minecraft.client.renderer.entity.RenderPig; -import net.minecraft.client.renderer.entity.layers.LayerRenderer; -import net.minecraft.entity.passive.EntityPig; -import net.minecraft.util.ResourceLocation; - -/** - * Adapted from technomodel under MIT - * <a href="https://github.com/thecolonel63/technomodel/blob/master/LICENSE">...</a> - */ -public class TechnobladeCrownRenderer<T extends EntityPig> implements LayerRenderer<T> { - - private static final ResourceLocation CROWN_TEXTURE = new ResourceLocation("oneconfig", "textures/entity/pig/technocrown.png"); - private final RenderPig renderer; - private final ModelPig pigModel = new ModelPig(0.5F); - - public TechnobladeCrownRenderer(RenderPig renderPig) { - renderer = renderPig; - } - - @Override - public void doRenderLayer(T entitylivingbaseIn, float f, float g, float partialTicks, float h, float i, float j, float scale) { - if (Preferences.easterEgg1 && entitylivingbaseIn.hasCustomName() && entitylivingbaseIn.getCustomNameTag().equals("Technoblade")) { - this.renderer.bindTexture(CROWN_TEXTURE); - this.pigModel.setModelAttributes(renderer.getMainModel()); - this.pigModel.render(entitylivingbaseIn, f, g, h, i, j, scale); - } - } - - @Override - public boolean shouldCombineTextures() { - return true; - } -} -//#endif
\ No newline at end of file diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java index 3424d2b..f4d15a4 100644 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/gui/impl/BlurHandlerImpl.java @@ -7,6 +7,9 @@ import cc.polyfrost.oneconfig.gui.OneConfigGui; import cc.polyfrost.oneconfig.internal.config.Preferences; import cc.polyfrost.oneconfig.internal.gui.BlurHandler; import cc.polyfrost.oneconfig.internal.mixin.ShaderGroupAccessor; +//#if FABRIC==1 +//$$ import cc.polyfrost.oneconfig.internal.mixin.GameRendererAccessor; +//#endif import cc.polyfrost.oneconfig.libs.eventbus.Subscribe; import cc.polyfrost.oneconfig.libs.universal.UMinecraft; import cc.polyfrost.oneconfig.libs.universal.UScreen; @@ -102,7 +105,11 @@ public class BlurHandlerImpl implements BlurHandler { // a one of ours, we should load our own blur! if (!isShaderActive() && gui instanceof OneConfigGui && Preferences.enableBlur) { + //#if FABRIC==1 + //$$ ((GameRendererAccessor) UMinecraft.getMinecraft().gameRenderer).invokeLoadShader(this.blurShader); + //#else UMinecraft.getMinecraft().entityRenderer.loadShader(this.blurShader); + //#endif this.start = System.currentTimeMillis(); this.progress = 0; diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java index 23d7d84..d49ea5d 100644 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/MinecraftMixin.java @@ -32,11 +32,6 @@ public class MinecraftMixin { Runtime.getRuntime().addShutdownHook(new Thread(() -> EventManager.INSTANCE.post(new ShutdownEvent()))); } - @Inject(method = "startGame", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;beginMinecraftLoading(Lnet/minecraft/client/Minecraft;Ljava/util/List;Lnet/minecraft/client/resources/IReloadableResourceManager;)V", remap = false), remap = true) - private void onPreLaunch(CallbackInfo ci) { - OneConfig.preLaunch(); - } - @Inject(method = "startGame", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;onInitializationComplete()V", shift = At.Shift.AFTER, remap = false), remap = true) private void onInit(CallbackInfo ci) { EventManager.INSTANCE.post(new InitializationEvent()); diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java deleted file mode 100644 index 1bd1fae..0000000 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/mixin/RenderPigMixin.java +++ /dev/null @@ -1,25 +0,0 @@ -//#if MC<=11202 -package cc.polyfrost.oneconfig.internal.mixin; - -import cc.polyfrost.oneconfig.internal.eggs.TechnobladeCrownRenderer; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.entity.RenderPig; -import net.minecraft.entity.passive.EntityPig; -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; - -@Mixin(RenderPig.class) -public abstract class RenderPigMixin extends RenderLiving<EntityPig> { - public RenderPigMixin(RenderManager renderManager, ModelBase modelBase, float f) { - super(renderManager, modelBase, f); - } - @Inject(method = "<init>", at = @At("TAIL")) - private void addCrown(RenderManager renderManager, ModelBase modelBase, float f, CallbackInfo ci) { - addLayer(new TechnobladeCrownRenderer<>((RenderPig) (Object) this)); - } -} -//#endif
\ No newline at end of file diff --git a/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java b/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java index 6a76a09..0ef5414 100644 --- a/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java +++ b/versions/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java @@ -43,11 +43,16 @@ public class OneConfigMixinPlugin implements IMixinConfigPlugin { public List<String> getMixins() { if (Platform.getInstance().getMinecraftVersion() >= 11600) { ArrayList<String> mixins = new ArrayList<>(); - mixins.add("ClientModLoaderMixin"); - mixins.add("KeyboardListenerMixin"); - mixins.add("MouseHelperAccessor"); - mixins.add("MouseHelperMixin"); - mixins.add("TimeTrackerMixin"); + if (Platform.getInstance().getLoader() == Platform.Loader.FORGE) { + mixins.add("ClientModLoaderMixin"); + } else { + mixins.add("FramebufferMixin"); + mixins.add("GameRendererAccessor"); + } + mixins.add("KeyboardMixin"); + mixins.add("MouseAccessor"); + mixins.add("MouseMixin"); + mixins.add("TickTimeTrackerMixin"); return mixins; } else { return null; |