Skip to content

Commit

Permalink
update code for 1.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
RecursiveG committed Aug 14, 2022
1 parent ac8bc10 commit 082dc2b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
18 changes: 13 additions & 5 deletions src/main/java/me/recursiveg/Mc122477Fix.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -18,21 +17,30 @@ 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);
}
}

@SubscribeEvent
public void onPostClientTick(TickEvent.RenderTickEvent ev) {
if (ev.phase == TickEvent.Phase.END) renderTicksSinceScreenOpen++;
if (ev.phase == TickEvent.Phase.END) {
renderTicksSinceScreenOpen++;
}
}
}
6 changes: 4 additions & 2 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit 082dc2b

Please sign in to comment.