Skip to content

Commit

Permalink
Merge branch 'master' into optional-baritone
Browse files Browse the repository at this point in the history
  • Loading branch information
MineGame159 committed Oct 22, 2023
2 parents 21a1c4e + 3fb57b6 commit f6e7d72
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 10 deletions.
16 changes: 9 additions & 7 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,34 @@ body:
label: Describe the bug
description: |
A clear and concise description of what the issue is.
Provide as much information as possible, videos, crash reports, etc.
DO NOT PASTE A CRASH REPORT HERE!!!!
Provide as much information as possible, videos, images, etc.
placeholder: |
This module is broken / not working as intended.
It should do X but it does Y instead.
validations:
required: true
- type: textarea
id: reproducing
attributes:
label: Steps to reproduce
description: How do you trigger this bug?
render: bash
placeholder: |
1. I did this thing;
2. Then I did this other thing, which caused the bug.
validations:
required: true
- type: input
id: crash-report
attributes:
label: Link to crash report/log if applicable (https://mclo.gs)
- type: input
id: meteor-version
attributes:
label: Meteor Version
placeholder: Meteor X.Y.Z (or X.Y.Z-build_number)
validations:
required: true
- type: input
id: mc-version
attributes:
label: Minecraft Version
placeholder: MC X.Y.Z
validations:
required: true
- type: dropdown
Expand Down
56 changes: 56 additions & 0 deletions .github/ISSUE_TEMPLATE/crash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Crash
description: Report a crash to help us improve Meteor.
labels: [ crash ]
body:
- type: textarea
id: reproducing
attributes:
label: Steps to reproduce
description: How do you trigger this crash?
placeholder: |
1. I did this thing;
2. Then I did this other thing, which caused the crash.
validations:
required: true
- type: input
id: crash-report
attributes:
label: Link to crash report/log (upload to https://mclo.gs and paste resulting link here)
placeholder: https://mclo.gs/xxxxxx
validations:
required: true
- type: input
id: meteor-version
attributes:
label: Meteor Version
placeholder: Meteor X.Y.Z (or X.Y.Z-build_number)
validations:
required: true
- type: input
id: mc-version
attributes:
label: Minecraft Version
placeholder: MC X.Y.Z
validations:
required: true
- type: dropdown
id: operating-systems
attributes:
label: Operating System
options:
- macOS
- Windows
- Linux
validations:
required: true
- type: checkboxes
id: prerequisites
attributes:
label: Before submitting a crash report
options:
- label: |
This crash wasn't already reported (I have searched crash reports on GitHub).
required: true
- label: |
This is a valid crash (I am able to reproduce this on the latest dev build).
required: true
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void onGameJoinTail(GameJoinS2CPacket packet, CallbackInfo info) {
}

// the server sends a GameJoin packet after the reconfiguration phase
@Inject(method = "onEnterReconfiguration", at = @At("HEAD"))
@Inject(method = "onEnterReconfiguration", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/util/thread/ThreadExecutor;)V", shift = At.Shift.AFTER))
private void onEnterReconfiguration(EnterReconfigurationS2CPacket packet, CallbackInfo info) {
MeteorClient.EVENT_BUS.post(GameLeftEvent.get());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,8 @@ private void drawTexture(DrawContext context, IChatHudLine line, int y) {
int startOffset = 0;

try {
startOffset = TIMESTAMP_REGEX.matcher(text).end();
Matcher m = TIMESTAMP_REGEX.matcher(text);
if (m.find()) startOffset = m.end() + 1;
}
catch (IllegalStateException ignored) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,8 @@ private void getTooltipData(TooltipDataEvent event) {

// EChest preview
else if (event.itemStack.getItem() == Items.ENDER_CHEST && previewEChest()) {
event.tooltipData = new ContainerTooltipComponent(EChestMemory.ITEMS, ECHEST_COLOR);
event.tooltipData = EChestMemory.isKnown() ? new ContainerTooltipComponent(EChestMemory.ITEMS, ECHEST_COLOR)
: new TextTooltipComponent(Text.literal("Unknown ender chest inventory.").formatted(Formatting.DARK_RED));
}

// Map preview
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package meteordevelopment.meteorclient.utils.player;

import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.events.game.GameLeftEvent;
import meteordevelopment.meteorclient.events.game.OpenScreenEvent;
import meteordevelopment.meteorclient.events.world.BlockActivateEvent;
import meteordevelopment.meteorclient.utils.PreInit;
Expand All @@ -22,6 +23,7 @@
public class EChestMemory {
public static final DefaultedList<ItemStack> ITEMS = DefaultedList.ofSize(27, ItemStack.EMPTY);
private static int echestOpenedState;
private static boolean isKnown = false;

@PreInit
public static void init() {
Expand Down Expand Up @@ -49,7 +51,18 @@ private static void onOpenScreenEvent(OpenScreenEvent event) {
for (int i = 0; i < 27; i++) {
ITEMS.set(i, inv.getStack(i));
}
isKnown = true;

echestOpenedState = 0;
}

@EventHandler
private static void onLeaveEvent(GameLeftEvent event) {
ITEMS.clear();
isKnown = false;
}

public static boolean isKnown() {
return isKnown;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
* Copyright (c) Meteor Development.
*/

package meteordevelopment.meteorclient.utils.tooltip;

import net.minecraft.client.gui.tooltip.OrderedTextTooltipComponent;
import net.minecraft.client.gui.tooltip.TooltipComponent;
import net.minecraft.text.OrderedText;
import net.minecraft.text.Text;

public class TextTooltipComponent extends OrderedTextTooltipComponent implements MeteorTooltipData {
public TextTooltipComponent(OrderedText text) {
super(text);
}

public TextTooltipComponent(Text text) {
this(text.asOrderedText());
}

@Override
public TooltipComponent getComponent() {
return this;
}
}

0 comments on commit f6e7d72

Please sign in to comment.