Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mod to 1.19.2 and make it localized #2

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
9bb8e3b
Update mod for 1.19.2 and make it english
Ivan-Khar Oct 3, 2022
89aec71
Update ManhuntCommand.java
Ivan-Khar Oct 3, 2022
2293552
Update ServerPlayerEntityMixin.java
Ivan-Khar Oct 3, 2022
dd0f01e
Change world colors
Ivan-Khar Oct 3, 2022
79d01cd
Added compass usage delay and `/mh compassDelay <Seconds>` command
Ivan-Khar Oct 3, 2022
77ffc12
Fixed delay working for all items
Ivan-Khar Oct 3, 2022
f39e3a5
Mute "No runners" message
Ivan-Khar Oct 3, 2022
b246e3a
Revert "Mute "No runners" message"
Ivan-Khar Oct 3, 2022
00cf2d0
revert last commit
Ivan-Khar Oct 3, 2022
2da4c6c
add mods for faster server loading and make all text translatable usi…
Ivan-Khar Oct 3, 2022
0bdc4fa
Added colors to translations
Ivan-Khar Oct 3, 2022
5f049d2
fix typo
Ivan-Khar Oct 3, 2022
f37495a
Create build.yml
Ivan-Khar Oct 3, 2022
69e6488
Change version of the mod
Ivan-Khar Oct 3, 2022
97b637d
Configuration file, and now you can change colors of the teams(and co…
Ivan-Khar Oct 4, 2022
dfa1894
Merge remote-tracking branch 'origin/master'
Ivan-Khar Oct 4, 2022
56ea177
1.0.4 version
Ivan-Khar Oct 4, 2022
bd2ca73
fix crash
Ivan-Khar Oct 4, 2022
830fff0
fixed fabric.mod.json and brought back the old Chinese translation
Ivan-Khar Nov 5, 2022
240f511
new version
Ivan-Khar Nov 5, 2022
b13012b
Update README.md
Ivan-Khar Nov 5, 2022
18661a9
Add win message on dragon death
Ivan-Khar Nov 6, 2022
65486da
Merge remote-tracking branch 'origin/master'
Ivan-Khar Nov 6, 2022
acd4971
update server-translations-api
Ivan-Khar Nov 6, 2022
4c1826e
runners now can win the game
Ivan-Khar Nov 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Build mod"
on:
push:
pull_request:

jobs:
build:
strategy:
matrix:
java: [17]
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v2
with:
distribution: adopt
java-version: ${{ matrix.java }}
- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: capture build artifacts
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
33 changes: 33 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# gradle

.gradle/
build/
out/
classes/

# eclipse

*.launch

# idea

.idea/
*.iml
*.ipr
*.iws

# vscode

.settings/
.vscode/
bin/
.classpath
.project

# macos

*.DS_Store

# fabric

run/
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# 猎人游戏 Manhunt
# Manhunt
A Minecraft Manhunt Mod for Fabric Server. (requires Fabric API)

# 如何使用 How 2 Use
On server is initialized, the hunters and runners teams will be automatically added, players can use command "/mh join <team>" to join teams.
Hunters will have a tracker, left-click to select a runner, right-click to update the coordinates.
Furthermore, you can use command "/mh cure <player(s)>" to cure players, "/mh freezeAllHunters <time(seconds)>" to freeze hunters (if you are an admin).
## How to use
- In order to join teams you need to type `/mh join <team>`.
- Hunters will get the compass. Left-click to select the runner and right-click to update the coordinates of the runner.

服务器初始化后,会自动添加猎人和逃者队伍,玩家可以使用命令“/mh join <team>”加入队伍。
猎人会有一个追踪器,左键可以选择逃者,右键更新坐标。
另外,你还可以使用命令“/mh cure <玩家选择器>”来治愈玩家,“/mh freezeAllHunters <秒>”来冻结猎人(如果你是管理的话)。
## Commands
- `/mh join <team>` allows you to join **hunters** or **runners** teams
- `/mh compassDelay <seconds>` changes compass usage delay.
- `/mh freeze <seconds>` freezes hunters for \<seconds\>
- `/mh cure <player(s)>` heals \<player(s)\>
- `/mh setColor <team> <color>` sets the \<color\> of the \<team\>
- `/mh reload` reloads config file
24 changes: 21 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'maven-publish'
}

@@ -12,15 +12,33 @@ group = project.maven_group

repositories {
maven { url "https://maven.shedaniel.me/" }
maven { url "https://jitpack.io" }
maven { url 'https://maven.nucleoid.xyz/' }
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}

dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
//Fabric api
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

//Server translations API
include(modImplementation("fr.catcore:server-translations-api:${project.server_translations_version}"))
//Carpet for fake players
modImplementation "com.github.gnembon:fabric-carpet:${project.carpet_version}"

//optimizations
modImplementation "maven.modrinth:lazydfu:0.1.3"
//modImplementation "maven.modrinth:starlight:1.1.1+1.19"
//modImplementation "maven.modrinth:lithium:mc1.19.2-0.8.3"
//modImplementation "maven.modrinth:ferrite-core:5.0.0-fabric"
}

processResources {
17 changes: 11 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -2,13 +2,18 @@
org.gradle.jvmargs=-Xmx1G

# Fabric Properties
minecraft_version=1.18.1
yarn_mappings=1.18.1+build.18
loader_version=0.12.12

fabric_version=0.46.0+1.18
minecraft_version=1.19.2
yarn_mappings=1.19.2+build.28
loader_version=0.14.10
fabric_version=0.64.0+1.19.2

# Mod Properties
mod_version = 1.0.2
mod_version = 1.0.6
maven_group = cn.noryea
archives_base_name = manhunt-fabric

# External mods
# Permissions API
server_translations_version = 1.4.18+1.19.2
# Carpet snapshot
carpet_version = 1.4.84
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStorePath=wrapper/dists
102 changes: 51 additions & 51 deletions src/main/java/cn/noryea/manhunt/Manhunt.java
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
package cn.noryea.manhunt;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.scoreboard.AbstractTeam;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.scoreboard.Team;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.util.Formatting;
import net.minecraft.text.Text;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.LinkedList;
import java.util.List;

public class Manhunt implements ModInitializer {

public static List<ServerPlayerEntity> allPlayers;
public static List<ServerPlayerEntity> allRunners;

public static final Formatting huntersColor = Formatting.RED;
public static final Formatting runnersColor = Formatting.GREEN;


@Override
public void onInitialize() {

ServerTickEvents.START_WORLD_TICK.register((world) -> {

//删除追踪器实体
world.getServer().getCommandManager().execute(world.getServer().getCommandSource().withSilent(),"kill @e[type=item,nbt={Item:{tag:{Tracker:1b}}}]");

//创建队伍
Scoreboard scoreboard = world.getServer().getScoreboard();
if (scoreboard.getTeam("hunters") == null) {
Team team = scoreboard.addTeam("hunters");
team.setDisplayName(new LiteralText("猎人"));
team.setColor(huntersColor);
}

if (scoreboard.getTeam("runners") == null) {
Team team = scoreboard.addTeam("runners");
team.setDisplayName(new LiteralText("逃者"));
team.setColor(runnersColor);
}

//获取玩家列表
allPlayers = world.getServer().getPlayerManager().getPlayerList();
allRunners = new LinkedList<>();

Team runners = scoreboard.getTeam("runners");
for (ServerPlayerEntity x : allPlayers) {
if (x != null) {
if (x.isTeamPlayer(runners)) {
allRunners.add(x);
}
}
}

});

//命令注册
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> ManhuntCommand.registerCommands(dispatcher));

}
public static List<ServerPlayerEntity> allPlayers;
public static List<ServerPlayerEntity> allRunners;

public static Logger LOGGER = LoggerFactory.getLogger("manhunt");

@Override
public void onInitialize() {
ManhuntConfig config = ManhuntConfig.INSTANCE;
config.load();
ServerTickEvents.START_WORLD_TICK.register((world) -> {
world.getServer().getCommandManager().executeWithPrefix(world.getServer().getCommandSource().withSilent(), "kill @e[type=item,nbt={Item:{tag:{Tracker:1b}}}]");

Scoreboard scoreboard = world.getServer().getScoreboard();
if (scoreboard.getTeam("hunters") == null) {
Team team = scoreboard.addTeam("hunters");
team.setDisplayName(Text.translatable("manhunt.teams.hunters.name"));
team.setCollisionRule(AbstractTeam.CollisionRule.ALWAYS);
team.setShowFriendlyInvisibles(false);
}
scoreboard.getTeam("hunters").setColor(config.getHuntersColor());

if (scoreboard.getTeam("runners") == null) {
Team team = scoreboard.addTeam("runners");
team.setDisplayName(Text.translatable("manhunt.teams.runners.name"));
team.setCollisionRule(AbstractTeam.CollisionRule.ALWAYS);
team.setShowFriendlyInvisibles(false);
}
scoreboard.getTeam("runners").setColor(config.getRunnersColor());

allPlayers = world.getServer().getPlayerManager().getPlayerList();
allRunners = new LinkedList<>();

Team runners = scoreboard.getTeam("runners");
for (ServerPlayerEntity x : allPlayers) {
if (x != null) {
if (x.isTeamPlayer(runners)) {
allRunners.add(x);
}
}
}

});

CommandRegistrationCallback.EVENT.register(ManhuntCommand::registerCommands);

}
}
Loading