Fix crash when opening GUIs

This commit is contained in:
modmuss50 2021-05-29 13:47:09 +01:00
parent ffa75aba8d
commit d8db208279
3 changed files with 6 additions and 6 deletions

View file

@ -32,7 +32,6 @@ import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer; import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.Selectable; import net.minecraft.client.gui.Selectable;
import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget; import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.resource.language.I18n; import net.minecraft.client.resource.language.I18n;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
@ -59,7 +58,7 @@ import reborncore.client.screen.builder.slot.PlayerInventorySlot;
import reborncore.common.blockentity.MachineBaseBlockEntity; import reborncore.common.blockentity.MachineBaseBlockEntity;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import reborncore.mixin.client.ScreenAccessor; import reborncore.mixin.client.AccessorScreen;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -281,8 +280,8 @@ public class GuiBase<T extends ScreenHandler> extends HandledScreen<T> {
offset += 24; offset += 24;
} }
ScreenAccessor screenAccessor = (ScreenAccessor)this; AccessorScreen accessorScreen = (AccessorScreen)this;
for (Selectable selectable : screenAccessor.getSelectables()) { for (Selectable selectable : accessorScreen.getSelectables()) {
if (selectable instanceof ClickableWidget clickable) { if (selectable instanceof ClickableWidget clickable) {
if (clickable.isHovered()) { if (clickable.isHovered()) {
clickable.renderToolTip(matrixStack, mouseX, mouseY); clickable.renderToolTip(matrixStack, mouseX, mouseY);

View file

@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.List; import java.util.List;
@Mixin(Screen.class) @Mixin(Screen.class)
public interface ScreenAccessor { public interface AccessorScreen {
@Accessor @Accessor
List<Selectable> getSelectables(); List<Selectable> getSelectables();
} }

View file

@ -8,7 +8,8 @@
"MixinDebugRenderer", "MixinDebugRenderer",
"MixinWorldRenderer", "MixinWorldRenderer",
"AccessorModelPredicateProviderRegistry", "AccessorModelPredicateProviderRegistry",
"AccessorChatHud" "AccessorChatHud",
"AccessorScreen"
], ],
"injectors": { "injectors": {
"defaultRequire": 1 "defaultRequire": 1