mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
@@ -42,14 +42,7 @@ allprojects {
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
|
||||
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
|
||||
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
|
||||
// We'll use that if it's available, but otherwise we'll use the older option.
|
||||
def targetVersion = 8
|
||||
if (JavaVersion.current().isJava9Compatible()) {
|
||||
options.release = targetVersion
|
||||
}
|
||||
options.release = 16
|
||||
}
|
||||
|
||||
license {
|
||||
|
||||
@@ -22,6 +22,7 @@ package me.shedaniel.architectury.event.events;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import me.shedaniel.architectury.event.Event;
|
||||
import me.shedaniel.architectury.event.EventFactory;
|
||||
import me.shedaniel.architectury.hooks.screen.ScreenAccess;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
@@ -68,12 +69,12 @@ public interface GuiEvent {
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
interface ScreenInitPre {
|
||||
InteractionResult init(Screen screen, List<AbstractWidget> widgets, List<GuiEventListener> children);
|
||||
InteractionResult init(Screen screen, ScreenAccess access);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
interface ScreenInitPost {
|
||||
void init(Screen screen, List<AbstractWidget> widgets, List<GuiEventListener> children);
|
||||
void init(Screen screen, ScreenAccess access);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package me.shedaniel.architectury.hooks.screen;
|
||||
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ScreenAccess {
|
||||
Screen getScreen();
|
||||
|
||||
List<NarratableEntry> getNarratables();
|
||||
|
||||
List<Widget> getRenderables();
|
||||
|
||||
<T extends AbstractWidget & Widget & NarratableEntry> T addRenderableWidget(T widget);
|
||||
|
||||
<T extends Widget> T addRenderableOnly(T listener);
|
||||
|
||||
<T extends GuiEventListener & NarratableEntry> T addWidget(T listener);
|
||||
}
|
||||
@@ -17,13 +17,15 @@
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package me.shedaniel.architectury.hooks;
|
||||
package me.shedaniel.architectury.hooks.screen;
|
||||
|
||||
import me.shedaniel.architectury.annotations.ExpectPlatform;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
|
||||
import java.util.List;
|
||||
@@ -34,17 +36,27 @@ public final class ScreenHooks {
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
public static List<AbstractWidget> getButtons(Screen screen) {
|
||||
public static List<NarratableEntry> getNarratables(Screen screen) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
public static <T extends AbstractWidget> T addButton(Screen screen, T widget) {
|
||||
public static List<Widget> getRenderables(Screen screen) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
public static <T extends GuiEventListener> T addChild(Screen screen, T listener) {
|
||||
public static <T extends AbstractWidget & Widget & NarratableEntry> T addRenderableWidget(Screen screen, T widget) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
public static <T extends Widget> T addRenderableOnly(Screen screen, T listener) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
public static <T extends GuiEventListener & NarratableEntry> T addWidget(Screen screen, T listener) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package me.shedaniel.architectury.impl;
|
||||
|
||||
import me.shedaniel.architectury.hooks.screen.ScreenAccess;
|
||||
import me.shedaniel.architectury.hooks.screen.ScreenHooks;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ScreenAccessImpl implements ScreenAccess {
|
||||
private Screen screen;
|
||||
|
||||
public ScreenAccessImpl(Screen screen) {
|
||||
this.screen = screen;
|
||||
}
|
||||
|
||||
public void setScreen(Screen screen) {
|
||||
this.screen = screen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Screen getScreen() {
|
||||
return screen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<NarratableEntry> getNarratables() {
|
||||
return ScreenHooks.getNarratables(screen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Widget> getRenderables() {
|
||||
return ScreenHooks.getRenderables(screen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends AbstractWidget & Widget & NarratableEntry> T addRenderableWidget(T widget) {
|
||||
return ScreenHooks.addRenderableWidget(screen, widget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Widget> T addRenderableOnly(T listener) {
|
||||
return ScreenHooks.addRenderableOnly(screen, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends GuiEventListener & NarratableEntry> T addWidget(T listener) {
|
||||
return ScreenHooks.addWidget(screen, listener);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "5.0.0"
|
||||
id "com.github.johnrengelman.shadow" version "7.0.0"
|
||||
id "com.matthewprenger.cursegradle"
|
||||
}
|
||||
|
||||
|
||||
@@ -17,27 +17,37 @@
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package me.shedaniel.architectury.hooks.fabric;
|
||||
package me.shedaniel.architectury.hooks.screen.fabric;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class ScreenHooksImpl {
|
||||
public static List<AbstractWidget> getButtons(Screen screen) {
|
||||
return screen.buttons;
|
||||
public static List<NarratableEntry> getNarratables(Screen screen) {
|
||||
return screen.narratables;
|
||||
}
|
||||
|
||||
public static <T extends AbstractWidget> T addButton(Screen screen, T widget) {
|
||||
return screen.addButton(widget);
|
||||
public static List<Widget> getRenderables(Screen screen) {
|
||||
return screen.renderables;
|
||||
}
|
||||
|
||||
public static <T extends GuiEventListener> T addChild(Screen screen, T listener) {
|
||||
public static <T extends AbstractWidget & Widget & NarratableEntry> T addRenderableWidget(Screen screen, T widget) {
|
||||
return screen.addRenderableWidget(widget);
|
||||
}
|
||||
|
||||
public static <T extends Widget> T addRenderableOnly(Screen screen, T listener) {
|
||||
return screen.addRenderableOnly(listener);
|
||||
}
|
||||
|
||||
public static <T extends GuiEventListener & NarratableEntry> T addWidget(Screen screen, T listener) {
|
||||
return screen.addWidget(listener);
|
||||
}
|
||||
}
|
||||
@@ -21,13 +21,12 @@ package me.shedaniel.architectury.impl.fabric;
|
||||
|
||||
import me.shedaniel.architectury.event.events.client.ClientScreenInputEvent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
||||
public interface ScreenInputDelegate {
|
||||
GuiEventListener architectury_delegateInputs();
|
||||
Screen architectury_delegateInputs();
|
||||
|
||||
class DelegateScreen extends Screen {
|
||||
private Screen parent;
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.minecraft.client.KeyboardHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.events.ContainerEventHandler;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -45,7 +46,7 @@ public class MixinKeyboardHandler {
|
||||
@Shadow
|
||||
private boolean sendRepeatsToGui;
|
||||
|
||||
@ModifyVariable(method = {"method_1458", "lambda$charTyped$5"}, at = @At("HEAD"), require = 0, ordinal = 0, argsOnly = true)
|
||||
@ModifyVariable(method = {"method_1458", "lambda$charTyped$7"}, at = @At("HEAD"), ordinal = 0, argsOnly = true)
|
||||
private static GuiEventListener wrapCharTypedFirst(GuiEventListener screen) {
|
||||
if (screen instanceof ScreenInputDelegate) {
|
||||
return ((ScreenInputDelegate) screen).architectury_delegateInputs();
|
||||
@@ -53,7 +54,7 @@ public class MixinKeyboardHandler {
|
||||
return screen;
|
||||
}
|
||||
|
||||
@ModifyVariable(method = {"method_1473", "lambda$charTyped$6"}, at = @At("HEAD"), require = 0, ordinal = 0, argsOnly = true)
|
||||
@ModifyVariable(method = {"method_1473", "lambda$charTyped$8"}, at = @At("HEAD"), ordinal = 0, argsOnly = true)
|
||||
private static GuiEventListener wrapCharTypedSecond(GuiEventListener screen) {
|
||||
if (screen instanceof ScreenInputDelegate) {
|
||||
return ((ScreenInputDelegate) screen).architectury_delegateInputs();
|
||||
@@ -61,22 +62,6 @@ public class MixinKeyboardHandler {
|
||||
return screen;
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "lambda$onCharEvent$5", at = @At("HEAD"), require = 0, ordinal = 0, argsOnly = true)
|
||||
private GuiEventListener wrapCharTypedFirstOptiFabric(GuiEventListener screen) {
|
||||
if (screen instanceof ScreenInputDelegate) {
|
||||
return ((ScreenInputDelegate) screen).architectury_delegateInputs();
|
||||
}
|
||||
return screen;
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "lambda$onCharEvent$6", at = @At("HEAD"), require = 0, ordinal = 0, argsOnly = true)
|
||||
private GuiEventListener wrapCharTypedSecondOptiFabric(GuiEventListener screen) {
|
||||
if (screen instanceof ScreenInputDelegate) {
|
||||
return ((ScreenInputDelegate) screen).architectury_delegateInputs();
|
||||
}
|
||||
return screen;
|
||||
}
|
||||
|
||||
@Inject(method = "keyPress", at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/gui/screens/Screen;wrapScreenError(Ljava/lang/Runnable;Ljava/lang/String;Ljava/lang/String;)V",
|
||||
ordinal = 0), cancellable = true)
|
||||
@@ -100,13 +85,13 @@ public class MixinKeyboardHandler {
|
||||
target = "Lnet/minecraft/client/gui/screens/Screen;wrapScreenError(Ljava/lang/Runnable;Ljava/lang/String;Ljava/lang/String;)V",
|
||||
ordinal = 0, shift = At.Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD,
|
||||
cancellable = true)
|
||||
public void onKeyAfter(long long_1, int int_1, int int_2, int int_3, int int_4, CallbackInfo info, ContainerEventHandler containerEventHandler, boolean bls[]) {
|
||||
public void onKeyAfter(long long_1, int int_1, int int_2, int int_3, int int_4, CallbackInfo info, Screen screen, boolean bls[]) {
|
||||
if (!info.isCancelled() && !bls[0]) {
|
||||
InteractionResult result;
|
||||
if (int_3 != 1 && (int_3 != 2 || !this.sendRepeatsToGui)) {
|
||||
result = ClientScreenInputEvent.KEY_RELEASED_POST.invoker().keyReleased(minecraft, minecraft.screen, int_1, int_2, int_4);
|
||||
result = ClientScreenInputEvent.KEY_RELEASED_POST.invoker().keyReleased(minecraft, screen, int_1, int_2, int_4);
|
||||
} else {
|
||||
result = ClientScreenInputEvent.KEY_PRESSED_POST.invoker().keyPressed(minecraft, minecraft.screen, int_1, int_2, int_4);
|
||||
result = ClientScreenInputEvent.KEY_PRESSED_POST.invoker().keyPressed(minecraft, screen, int_1, int_2, int_4);
|
||||
}
|
||||
if (result != InteractionResult.PASS)
|
||||
info.cancel();
|
||||
|
||||
@@ -25,6 +25,7 @@ import me.shedaniel.architectury.impl.fabric.ScreenInputDelegate;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.MouseHandler;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@@ -83,9 +84,10 @@ public class MixinMouseHandler {
|
||||
|
||||
@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Inject(method = {"lambda$onPress$0", "method_1611"}, at = @At("HEAD"), cancellable = true, remap = false)
|
||||
public void onGuiMouseClicked(boolean[] bls, double d, double e, int button, CallbackInfo info) {
|
||||
private static void onGuiMouseClicked(boolean[] bls, Screen screen, double d, double e, int button, CallbackInfo info) {
|
||||
var minecraft = Minecraft.getInstance();
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(minecraft, minecraft.screen, d, e, button);
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_CLICKED_PRE.invoker().mouseClicked(minecraft, screen, d, e, button);
|
||||
if (result != InteractionResult.PASS) {
|
||||
bls[0] = true;
|
||||
info.cancel();
|
||||
@@ -95,9 +97,10 @@ public class MixinMouseHandler {
|
||||
|
||||
@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Inject(method = {"lambda$onPress$0", "method_1611"}, at = @At("RETURN"), cancellable = true, remap = false)
|
||||
public void onGuiMouseClickedPost(boolean[] bls, double d, double e, int button, CallbackInfo info) {
|
||||
private static void onGuiMouseClickedPost(boolean[] bls, Screen screen, double d, double e, int button, CallbackInfo info) {
|
||||
var minecraft = Minecraft.getInstance();
|
||||
if (!info.isCancelled() && !bls[0]) {
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(minecraft, minecraft.screen, d, e, button);
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_CLICKED_POST.invoker().mouseClicked(minecraft, screen, d, e, button);
|
||||
if (result != InteractionResult.PASS) {
|
||||
bls[0] = true;
|
||||
info.cancel();
|
||||
@@ -127,9 +130,10 @@ public class MixinMouseHandler {
|
||||
|
||||
@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Inject(method = {"lambda$onPress$1", "method_1605"}, at = @At("HEAD"), cancellable = true, remap = false)
|
||||
public void onGuiMouseReleased(boolean[] bls, double d, double e, int button, CallbackInfo info) {
|
||||
private static void onGuiMouseReleased(boolean[] bls, Screen screen, double d, double e, int button, CallbackInfo info) {
|
||||
var minecraft = Minecraft.getInstance();
|
||||
if (!info.isCancelled()) {
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(minecraft, minecraft.screen, d, e, button);
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_RELEASED_PRE.invoker().mouseReleased(minecraft, screen, d, e, button);
|
||||
if (result != InteractionResult.PASS) {
|
||||
bls[0] = true;
|
||||
info.cancel();
|
||||
@@ -139,9 +143,10 @@ public class MixinMouseHandler {
|
||||
|
||||
@SuppressWarnings("UnresolvedMixinReference")
|
||||
@Inject(method = {"lambda$onPress$1", "method_1605"}, at = @At("RETURN"), cancellable = true, remap = false)
|
||||
public void onGuiMouseReleasedPost(boolean[] bls, double d, double e, int button, CallbackInfo info) {
|
||||
private static void onGuiMouseReleasedPost(boolean[] bls, Screen screen, double d, double e, int button, CallbackInfo info) {
|
||||
var minecraft = Minecraft.getInstance();
|
||||
if (!info.isCancelled() && !bls[0]) {
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_RELEASED_POST.invoker().mouseReleased(minecraft, minecraft.screen, d, e, button);
|
||||
InteractionResult result = ClientScreenInputEvent.MOUSE_RELEASED_POST.invoker().mouseReleased(minecraft, screen, d, e, button);
|
||||
if (result != InteractionResult.PASS) {
|
||||
bls[0] = true;
|
||||
info.cancel();
|
||||
@@ -151,7 +156,7 @@ public class MixinMouseHandler {
|
||||
|
||||
@SuppressWarnings("UnresolvedMixinReference")
|
||||
@ModifyVariable(method = {"method_1602", "lambda$onMove$11"}, at = @At("HEAD"), ordinal = 0, argsOnly = true)
|
||||
private GuiEventListener wrapMouseDragged(GuiEventListener screen) {
|
||||
private Screen wrapMouseDragged(Screen screen) {
|
||||
if (screen instanceof ScreenInputDelegate) {
|
||||
return ((ScreenInputDelegate) screen).architectury_delegateInputs();
|
||||
}
|
||||
|
||||
@@ -23,17 +23,17 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import me.shedaniel.architectury.event.events.GuiEvent;
|
||||
import me.shedaniel.architectury.event.events.TooltipEvent;
|
||||
import me.shedaniel.architectury.event.events.client.ClientChatEvent;
|
||||
import me.shedaniel.architectury.hooks.screen.ScreenAccess;
|
||||
import me.shedaniel.architectury.impl.ScreenAccessImpl;
|
||||
import me.shedaniel.architectury.impl.TooltipEventColorContextImpl;
|
||||
import me.shedaniel.architectury.impl.TooltipEventPositionContextImpl;
|
||||
import me.shedaniel.architectury.impl.fabric.ScreenInputDelegate;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.util.FormattedCharSequence;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
@@ -44,39 +44,48 @@ import java.util.List;
|
||||
|
||||
@Mixin(Screen.class)
|
||||
public abstract class MixinScreen implements ScreenInputDelegate {
|
||||
@Shadow
|
||||
@Final
|
||||
public List<AbstractWidget> buttons;
|
||||
@Unique
|
||||
private static ThreadLocal<TooltipEventPositionContextImpl> tooltipPositionContext = ThreadLocal.withInitial(TooltipEventPositionContextImpl::new);
|
||||
@Unique
|
||||
private static ThreadLocal<TooltipEventColorContextImpl> tooltipColorContext = ThreadLocal.withInitial(TooltipEventColorContextImpl::new);
|
||||
@Unique
|
||||
private ScreenAccessImpl access;
|
||||
|
||||
@Shadow
|
||||
public abstract List<? extends GuiEventListener> children();
|
||||
|
||||
@Unique
|
||||
private GuiEventListener inputDelegate;
|
||||
private Screen inputDelegate;
|
||||
|
||||
@Unique
|
||||
private ScreenAccess getAccess() {
|
||||
if (access == null) {
|
||||
return access = new ScreenAccessImpl((Screen) (Object) this);
|
||||
}
|
||||
|
||||
access.setScreen((Screen) (Object) this); // Preventive set
|
||||
return access;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiEventListener architectury_delegateInputs() {
|
||||
public Screen architectury_delegateInputs() {
|
||||
if (inputDelegate == null) {
|
||||
inputDelegate = new DelegateScreen((Screen) (Object) this);
|
||||
}
|
||||
return inputDelegate;
|
||||
}
|
||||
|
||||
@Inject(method = "init(Lnet/minecraft/client/Minecraft;II)V", at = @At(value = "INVOKE", target = "Ljava/util/List;clear()V", ordinal = 0),
|
||||
@Inject(method = "init(Lnet/minecraft/client/Minecraft;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;clearWidgets()V", ordinal = 0),
|
||||
cancellable = true)
|
||||
private void preInit(Minecraft minecraft, int i, int j, CallbackInfo ci) {
|
||||
if (GuiEvent.INIT_PRE.invoker().init((Screen) (Object) this, buttons, (List<GuiEventListener>) children()) == InteractionResult.FAIL) {
|
||||
if (GuiEvent.INIT_PRE.invoker().init((Screen) (Object) this, getAccess()) == InteractionResult.FAIL) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "init(Lnet/minecraft/client/Minecraft;II)V", at = @At(value = "RETURN"))
|
||||
private void postInit(Minecraft minecraft, int i, int j, CallbackInfo ci) {
|
||||
GuiEvent.INIT_POST.invoker().init((Screen) (Object) this, buttons, (List<GuiEventListener>) children());
|
||||
GuiEvent.INIT_POST.invoker().init((Screen) (Object) this, getAccess());
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "sendMessage(Ljava/lang/String;Z)V", at = @At("HEAD"), argsOnly = true, ordinal = 0)
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
accessWidener v1 named
|
||||
accessible method net/minecraft/client/gui/screens/Screen addButton (Lnet/minecraft/client/gui/components/AbstractWidget;)Lnet/minecraft/client/gui/components/AbstractWidget;
|
||||
accessible method net/minecraft/client/gui/screens/Screen addRenderableWidget (Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener;
|
||||
accessible method net/minecraft/client/gui/screens/Screen addRenderableOnly (Lnet/minecraft/client/gui/components/Widget;)Lnet/minecraft/client/gui/components/Widget;
|
||||
accessible method net/minecraft/client/gui/screens/Screen addWidget (Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener;
|
||||
accessible field net/minecraft/client/gui/screens/Screen buttons Ljava/util/List;
|
||||
accessible field net/minecraft/client/gui/screens/Screen narratables Ljava/util/List;
|
||||
accessible field net/minecraft/client/gui/screens/Screen renderables Ljava/util/List;
|
||||
accessible field net/minecraft/world/level/block/state/BlockBehaviour properties Lnet/minecraft/world/level/block/state/BlockBehaviour$Properties;
|
||||
accessible field net/minecraft/world/level/block/state/BlockBehaviour$Properties material Lnet/minecraft/world/level/material/Material;
|
||||
mutable field net/minecraft/world/level/block/state/BlockBehaviour$Properties material Lnet/minecraft/world/level/material/Material;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "5.0.0"
|
||||
id "com.github.johnrengelman.shadow" version "7.0.0"
|
||||
id "com.matthewprenger.cursegradle"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
||||
minecraft_version=21w19a
|
||||
supported_version=21w19a
|
||||
minecraft_version=21w20a
|
||||
supported_version=21w20a
|
||||
|
||||
cf_type=beta
|
||||
|
||||
@@ -12,7 +12,7 @@ base_version=2.0
|
||||
maven_group=me.shedaniel
|
||||
|
||||
fabric_loader_version=0.11.3
|
||||
fabric_api_version=0.34.4+1.17
|
||||
fabric_api_version=0.34.5+1.17
|
||||
mod_menu_version=2.0.0-beta.4
|
||||
|
||||
#forge_version=36.0.42
|
||||
|
||||
@@ -257,7 +257,7 @@ public class DebugEvents {
|
||||
ClientPlayerEvent.CLIENT_PLAYER_RESPAWN.register((oldPlayer, newPlayer) -> {
|
||||
SINK.accept(newPlayer.getScoreboardName() + " respawned (client)");
|
||||
});
|
||||
GuiEvent.INIT_PRE.register((screen, widgets, children) -> {
|
||||
GuiEvent.INIT_PRE.register((screen, access) -> {
|
||||
SINK.accept(toSimpleName(screen) + " initializes");
|
||||
return InteractionResult.PASS;
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "5.0.0"
|
||||
id "com.github.johnrengelman.shadow" version "7.0.0"
|
||||
id "com.matthewprenger.cursegradle"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.github.johnrengelman.shadow" version "5.0.0"
|
||||
id "com.github.johnrengelman.shadow" version "7.0.0"
|
||||
id "com.matthewprenger.cursegradle"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user