Skip to content

Commit

Permalink
0.6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
burningtnt committed Dec 14, 2024
1 parent aa1c607 commit c1dede9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mod_name=Sign Me Up
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=BSD-3-Clause
# The mod version. See https://semver.org/
mod_version=0.6.5
mod_version=0.6.6
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import cn.ussshenzhou.t88.network.NetworkHelper;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.Tooltip;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.Level;
import org.joml.Vector2i;
import org.teacon.signmeup.SignMeUp;
import org.teacon.signmeup.config.Waypoints;
Expand Down Expand Up @@ -117,7 +119,11 @@ public boolean mouseClicked(double pMouseX, double pMouseY, int pButton) {
long time = System.currentTimeMillis();
if (time - lastClickedTime <= 200) {
lastClickedTime = 0;
NetworkHelper.sendToServer(new TeleportToWayPointPacket(logicWaypoints.inverse().get(this).name));
Minecraft mc = Minecraft.getInstance();
if (mc.level != null && mc.level.dimension() == Level.OVERWORLD) {
NetworkHelper.sendToServer(new TeleportToWayPointPacket(logicWaypoints.inverse().get(this).name));
}

getTopParentScreenOptional().ifPresent(tScreen -> tScreen.onClose(false));
return true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.client.gui.components.Tooltip;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.Nullable;
import org.teacon.signmeup.SignMeUp;
import org.teacon.signmeup.config.Waypoints;
Expand Down Expand Up @@ -65,7 +66,11 @@ public WayPointsButtonPanel() {
var button = new THoverSensitiveImageButtonImpl(
wayPoint.name,
b -> {
NetworkHelper.sendToServer(new TeleportToWayPointPacket(wayPoint.name));
Minecraft mc = Minecraft.getInstance();
if (mc.level != null && mc.level.dimension() == Level.OVERWORLD) {
NetworkHelper.sendToServer(new TeleportToWayPointPacket(wayPoint.name));
}

getTopParentScreenOptional().ifPresent(tScreen -> tScreen.onClose(false));
},
SignMeUp.id("textures/gui/button_panel_button.png"),
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/teacon/signmeup/hud/MiniMapPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
import cn.ussshenzhou.t88.gui.widegt.TPanel;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.world.level.Level;
import org.joml.Quaternionf;
import org.teacon.signmeup.SignMeUp;
import org.teacon.signmeup.config.MiniMap;
import org.teacon.signmeup.gui.map.MapScreen;

import java.util.Set;

import static net.minecraft.util.Mth.PI;

/**
Expand Down Expand Up @@ -49,8 +48,10 @@ public MiniMapPanel() {
public void tickT() {
super.tickT();
Minecraft mc = Minecraft.getInstance();

var visible = !mc.getDebugOverlay().showDebugScreen()
&& !mc.options.hideGui
&& (mc.level != null && mc.level.dimension() == Level.OVERWORLD)
&& MiniMapAPI.INSTANCE.visible()
&& !(mc.screen instanceof MapScreen);
children.forEach(childTComponent -> childTComponent.setVisibleT(visible));
Expand Down
25 changes: 15 additions & 10 deletions src/main/java/org/teacon/signmeup/input/ModKeyInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mojang.blaze3d.platform.InputConstants;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.world.level.Level;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
Expand All @@ -20,23 +21,27 @@ public class ModKeyInput {
public static final KeyMapping OPEN_MAP = new KeyMapping(
"key.sign_up.open_map", KeyConflictContext.IN_GAME, KeyModifier.NONE,
InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_M, "key.categories.sign_up"
); public static final KeyMapping OPEN_NEW_MAP = new KeyMapping(
);
public static final KeyMapping OPEN_NEW_MAP = new KeyMapping(
"key.sign_up.open_new_map", KeyConflictContext.IN_GAME, KeyModifier.NONE,
InputConstants.Type.KEYSYM, -1, "key.categories.sign_up"
);


@SubscribeEvent
public static void onKeyInput(InputEvent.Key event) {
MapScreen screen;
if (OPEN_NEW_MAP.consumeClick()) {
screen = MapScreen.getNewInstance();
} else if (OPEN_MAP.consumeClick()) {
screen = MapScreen.getInstance();
} else {
return;
Minecraft mc = Minecraft.getInstance();
if (mc.level != null && mc.level.dimension() == Level.OVERWORLD) {
MapScreen screen;
if (OPEN_NEW_MAP.consumeClick()) {
screen = MapScreen.getNewInstance();
} else if (OPEN_MAP.consumeClick()) {
screen = MapScreen.getInstance();
} else {
return;
}
mc.setScreen(screen);
screen.layout();
}
Minecraft.getInstance().setScreen(screen);
screen.layout();
}
}

0 comments on commit c1dede9

Please sign in to comment.