Skip to content

Commit

Permalink
Merge pull request #3 from qyl27/1.20-forge
Browse files Browse the repository at this point in the history
Update to 1.20 with old gui.
  • Loading branch information
3TUSK authored Aug 21, 2023
2 parents 1788914 + ca4f1a6 commit e9e0e18
Show file tree
Hide file tree
Showing 37 changed files with 297 additions and 688 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ bin/
eclipse/
run_client/
run_server/
run_test/
logs/
remappedSrc/

Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'eclipse'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
}

apply from: 'gradle/teacon-forge.gradle'
Expand All @@ -17,8 +18,8 @@ teacon {
modAuthors = ['3TUSK', 'yuesha-yc (YueSha)', 'Hookan', 'ustc-zzzz']
modDescription = 'Sign up, sign in, in-game guide map and more.'

platform = 'forge-1.19.4-45.0.9'
// parchment = '2022.01.23'
platform = 'forge-1.20.1-47.1.0'
parchment = '2023.07.23'

// uncomment these lines if you need
modName = 'Sign Me Up' // default to repo name
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
org.gradle.jvmargs=-Xmx5G
org.gradle.daemon=false
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pluginManagement.repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://maven.parchmentmc.org' }
}

rootProject.name = 'SignMeUp'
10 changes: 6 additions & 4 deletions src/main/java/org/teacon/signin/SignMeUp.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,18 @@
import org.teacon.signin.command.CommandImpl;
import org.teacon.signin.data.DynamicLocationStorage;
import org.teacon.signin.data.GuideMapManager;
import org.teacon.signin.data.Trigger;
import org.teacon.signin.data.entity.Trigger;
import org.teacon.signin.network.*;

@Mod("sign_up")
@Mod.EventBusSubscriber(modid = "sign_up", bus = Mod.EventBusSubscriber.Bus.FORGE)
@Mod(SignMeUp.MODID)
@Mod.EventBusSubscriber(modid = SignMeUp.MODID, bus = Mod.EventBusSubscriber.Bus.FORGE)
public final class SignMeUp {

public static final String MODID = "sign_up";

public static final GuideMapManager MANAGER = new GuideMapManager();

public static SimpleChannel channel = NetworkRegistry.ChannelBuilder.named(new ResourceLocation("sign_up", "data"))
public static SimpleChannel channel = NetworkRegistry.ChannelBuilder.named(new ResourceLocation(SignMeUp.MODID, "data"))
.networkProtocolVersion(() -> "0.0")
.clientAcceptedVersions("0.0"::equals)
.serverAcceptedVersions("0.0"::equals)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.phys.Vec3;

import org.teacon.signin.data.GuideMap;
import org.teacon.signin.data.Trigger;
import org.teacon.signin.data.Waypoint;
import org.teacon.signin.client.gui.MapScreen;
import org.teacon.signin.data.entity.GuideMap;
import org.teacon.signin.data.entity.Trigger;
import org.teacon.signin.data.entity.Waypoint;
import org.teacon.signin.network.MapScreenPacket;

import java.util.*;
Expand All @@ -23,10 +24,9 @@ public void openMapByPacket(MapScreenPacket.Action action, ResourceLocation mapI
if (action == MapScreenPacket.Action.OPEN_SPECIFIC) {
Objects.requireNonNull(mapId);
GuideMap map = SignMeUpClient.MANAGER.findMap(mapId);
mc.setScreen(new GuideMapScreen(mapId, map, position));
} else if (mc.screen instanceof GuideMapScreen) {
final GuideMapScreen screen = (GuideMapScreen) mc.screen;
if (action != MapScreenPacket.Action.CLOSE_SPECIFIC || screen.mapId.equals(mapId)) {
mc.setScreen(new MapScreen(mapId, map, position));
} else if (mc.screen instanceof MapScreen screen) {
if (action != MapScreenPacket.Action.CLOSE_SPECIFIC || screen.getMapId().equals(mapId)) {
mc.setScreen(null);
}
}
Expand All @@ -46,7 +46,7 @@ public Map.Entry<ResourceLocation, GuideMap> nearestTo(Vec3 pos) {
final GuideMap guideMap = entry.getValue();
final double dx = pos.x() - guideMap.center.getX();
final double dz = pos.z() - guideMap.center.getZ();
if (Math.min(Math.abs(dx), Math.abs(dz)) <= guideMap.radius) {
if (Math.min(Math.abs(dx), Math.abs(dz)) <= guideMap.range) {
final double distanceSq = dx * dx + dz * dz;
if (distanceSq < minDistanceSq) {
minDistanceSq = distanceSq;
Expand Down
Loading

0 comments on commit e9e0e18

Please sign in to comment.