From 082dc2b096d4c42817dcebcb4ed0463619788e86 Mon Sep 17 00:00:00 2001 From: Recursive G Date: Sat, 13 Aug 2022 22:00:12 -0500 Subject: [PATCH] update code for 1.19.2 --- src/main/java/me/recursiveg/Mc122477Fix.java | 18 +++++++++++++----- src/main/resources/META-INF/mods.toml | 6 ++++-- src/main/resources/pack.mcmeta | 6 ++++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/main/java/me/recursiveg/Mc122477Fix.java b/src/main/java/me/recursiveg/Mc122477Fix.java index cb87fa2..fa2e4f8 100644 --- a/src/main/java/me/recursiveg/Mc122477Fix.java +++ b/src/main/java/me/recursiveg/Mc122477Fix.java @@ -3,7 +3,6 @@ import net.minecraft.client.gui.screens.ChatScreen; import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen; import net.minecraftforge.client.event.ScreenEvent; -import net.minecraftforge.client.event.ScreenOpenEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; @@ -18,14 +17,21 @@ public Mc122477Fix() { long renderTicksSinceScreenOpen = 0; @SubscribeEvent - public void onScreenOpen(ScreenOpenEvent ev) { - if (ev.getScreen() instanceof ChatScreen || ev.getScreen() instanceof CreativeModeInventoryScreen) { + public void onScreenOpen(ScreenEvent.Opening ev) { + if (ev.getNewScreen() instanceof ChatScreen || ev.getNewScreen() instanceof CreativeModeInventoryScreen) { renderTicksSinceScreenOpen = 0; } } @SubscribeEvent - public void onCharTyped(ScreenEvent.KeyboardCharTypedEvent.Pre ev) { + public void onKeyPressed(ScreenEvent.KeyPressed.Pre ev) { + if (renderTicksSinceScreenOpen < 2) { + ev.setCanceled(true); + } + } + + @SubscribeEvent + public void onCharTyped(ScreenEvent.CharacterTyped.Pre ev) { if (renderTicksSinceScreenOpen < 2) { ev.setCanceled(true); } @@ -33,6 +39,8 @@ public void onCharTyped(ScreenEvent.KeyboardCharTypedEvent.Pre ev) { @SubscribeEvent public void onPostClientTick(TickEvent.RenderTickEvent ev) { - if (ev.phase == TickEvent.Phase.END) renderTicksSinceScreenOpen++; + if (ev.phase == TickEvent.Phase.END) { + renderTicksSinceScreenOpen++; + } } } diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 66fa45b..95fa2dc 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -6,11 +6,13 @@ # The name of the mod loader type to load - for regular FML @Mod mods it should be javafml modLoader="javafml" #mandatory # A version range to match for said mod loader - for regular FML @Mod it will be the forge version -loaderVersion="[38,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +loaderVersion="[43,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. +# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. +# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here. +license="MIT" # A URL to refer people to when problems occur with this mod issueTrackerURL="https://github.com/RecursiveG/Mc122477Fix/issues" #optional # A list of mods - how many allowed here is determined by the individual mod loader -license="MIT" [[mods]] #mandatory # The modid of the mod modId="mc122477fix" #mandatory diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index b18e3cd..c02497f 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,8 @@ { "pack": { - "description": "examplemod resources", - "pack_format": 8 + "description": "mc122477fix resources", + "pack_format": 9, + "forge:resource_pack_format": 9, + "forge:data_pack_format": 10 } }