-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See #11
- Loading branch information
Showing
25 changed files
with
332 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,50 @@ | ||
# Automatically builds and publishes the mod when a new release is created on GitHub. | ||
# It uploads the mod to GitHub, CurseForge and Modrinth. | ||
|
||
name: Release | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
publish: | ||
name: Build & Publish | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.gradle/loom-cache | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
gradle- | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 17 | ||
java-version: '17' | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
run: chmod +x ./gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build | ||
run: ./gradlew clean build -Pversion=${{ github.event.release.tag_name }} | ||
|
||
- name: Upload GitHub release | ||
uses: AButler/[email protected] | ||
- name: Publish mod to GitHub, CurseForge and Modrinth | ||
id: publish | ||
uses: Kir-Antipov/[email protected] | ||
with: | ||
files: 'build/libs/*.jar;!build/libs/*-sources.jar;!build/libs/*-dev.jar' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} | ||
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
changelog: ${{ github.event.release.body }} | ||
java: 17 | ||
|
||
modrinth-featured: false | ||
|
||
- name: Add job summary | ||
run: | | ||
echo "# Results" >> $GITHUB_STEP_SUMMARY | ||
echo "- [CurseForge Link](${{ steps.publish.outputs.curseforge-url }})" >> $GITHUB_STEP_SUMMARY | ||
echo "- [Modrinth Link](${{ steps.publish.outputs.modrinth-url }})" >> $GITHUB_STEP_SUMMARY | ||
echo "- [GitHub Link](${{ steps.publish.outputs.github-url }})" >> $GITHUB_STEP_SUMMARY | ||
echo "# Changelog" >> $GITHUB_STEP_SUMMARY | ||
echo "${{ github.event.release.body }}" >> $GITHUB_STEP_SUMMARY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,34 @@ | ||
# UHC | ||
The UHC (abbreviation for Ultra HardCore) is a popular Minecraft survival minigame that can be played alone or with a team. | ||
This a mod that implements it for Fabric using the [Plasmid API](https://github.com/NucleoidMC/plasmid). | ||
# 🍏 UHC | ||
|
||
Check out the [wiki](https://github.com/NucleoidMC/UHC/wiki) for instructions on how to personalize your UHC experience! | ||
UHC (abbreviation for Ultra HardCore) is a popular Minecraft survival minigame that can be played alone or with a team. | ||
This mod also includes UHCRun, a variant of UHC that tweaks the game in many ways to make it 2x faster. | ||
|
||
This is a part of an attempt to create an open source Fabric-based minigames server. | ||
For more information, see [our website](https://nucleoid.xyz). | ||
UHC is one of the minigames made for the [Nucleoid Project](https://nucleoid.xyz/), an effort to build an open source ecosystem for server-side Minecraft minigames. | ||
You may even be interested in playing some of them over on our testing Minecraft server at `nucleoid.xyz`! | ||
You can also find us on our [Discord](https://nucleoid.xyz/discord) if you have any troubles or queries, or would like to get involved. | ||
|
||
## Installation | ||
|
||
UHC can be installed on a client or a server. As this is a multiplayer minigame though, it is recommended to install it on a server. | ||
|
||
⚠ UHC **needs** the following mods to be installed: | ||
- Plasmid: [GitHub](https://github.com/NucleoidMC/plasmid) / [Modrinth](https://modrinth.com/mod/plasmid) | ||
- Fabric API: [GitHub](https://github.com/FabricMC/fabric) / [CurseForge](https://www.curseforge.com/minecraft/mc-mods/fabric-api) / [Modrinth](https://modrinth.com/mod/fabric-api) | ||
|
||
## Usage | ||
|
||
To start a game of UHC, use `/game open` and browse the list of available game modes. | ||
|
||
## Modifications | ||
|
||
To configure UHC, or to contribute to the project, visit [the official documentation](https://docs.nucleoid.xyz/uhc/). | ||
|
||
## Credits | ||
|
||
- [Hugman](https://github.com/Hugman76) - Development | ||
|
||
### 🌐 Translations | ||
| Language | Translators | | ||
|----------------|---------------------------------------| | ||
| English (base) | [Hugman](https://github.com/Hugman76) | | ||
| French | [Hugman](https://github.com/Hugman76) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
# Done to increase the memory available to gradle. | ||
org.gradle.jvmargs=-Xmx1G | ||
|
||
# Mod Properties | ||
mod_version=2.2.0 | ||
maven_group=com.hugman | ||
archives_base_name=uhc | ||
|
||
# Fabric Properties | ||
# check these on https://fabricmc.net/develop/ | ||
minecraft_version=1.20.1 | ||
yarn_mappings=1.20.1+build.9 | ||
yarn_mappings=1.20.1+build.10 | ||
loader_version=0.14.21 | ||
fabric_version=0.86.0+1.20.1 | ||
# Mod Properties | ||
mod_version=2.1.0 | ||
maven_group=com.hugman | ||
archives_base_name=uhc | ||
fabric_version=0.86.1+1.20.1 | ||
|
||
# check this on https://nucleoid.xyz/use/ | ||
plasmid_version=0.5+1.20.1-SNAPSHOT | ||
plasmid_version=0.5.101-SNAPSHOT+1.20.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,43 @@ | ||
package com.hugman.uhc.config; | ||
|
||
import com.hugman.uhc.UHC; | ||
import com.hugman.uhc.UHCRegistries; | ||
import com.hugman.uhc.modifier.Modifier; | ||
import com.hugman.uhc.modifier.ModifierType; | ||
import com.hugman.uhc.module.Module; | ||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.registry.entry.RegistryEntryList; | ||
import xyz.nucleoid.plasmid.game.common.config.PlayerConfig; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public record UHCConfig(PlayerConfig players, int teamSize, UHCMapConfig mapConfig, UHCChapterConfig chapterConfig, | ||
List<Identifier> moduleIds) { | ||
RegistryEntryList<Module> modules) { | ||
public static final Codec<UHCConfig> CODEC = RecordCodecBuilder.create(instance -> instance.group( | ||
PlayerConfig.CODEC.fieldOf("players").forGetter(UHCConfig::players), | ||
Codec.INT.fieldOf("team_size").forGetter(UHCConfig::teamSize), | ||
UHCMapConfig.CODEC.fieldOf("map").forGetter(UHCConfig::mapConfig), | ||
UHCChapterConfig.CODEC.fieldOf("chapters").forGetter(UHCConfig::chapterConfig), | ||
Identifier.CODEC.listOf().fieldOf("modules").orElse(List.of()).forGetter(UHCConfig::moduleIds) | ||
// NOTE: we cannot use Module.REGISTRY_LIST_CODEC as Plasmid | ||
// loads the game configs before all the other dynamic registries | ||
// we need to work around this and use raw identifiers there | ||
Module.LIST_CODEC.optionalFieldOf("modules", RegistryEntryList.of()).forGetter(UHCConfig::modules) | ||
).apply(instance, UHCConfig::new)); | ||
|
||
public List<Module> getModules() { | ||
List<Module> modules = new ArrayList<>(); | ||
if (!this.moduleIds.isEmpty()) { | ||
for (Identifier moduleId : this.moduleIds) { | ||
Module module = UHCRegistries.MODULE.get(moduleId); | ||
if (module == null) { | ||
UHC.LOGGER.error("Module {} not found", moduleId); | ||
continue; | ||
} | ||
modules.add(module); | ||
} | ||
public List<Modifier> getModifiers() { | ||
List<Modifier> modifiers = new ArrayList<>(); | ||
for (var moduleEntry : modules) { | ||
modifiers.addAll(moduleEntry.value().modifiers()); | ||
} | ||
return modules; | ||
return modifiers; | ||
} | ||
|
||
public List<Modifier> getModulesPieces() { | ||
List<Modifier> modifiers = new ArrayList<>(); | ||
if (!this.moduleIds.isEmpty()) { | ||
for (Identifier moduleId : this.moduleIds) { | ||
Module module = UHCRegistries.MODULE.get(moduleId); | ||
if (module == null) { | ||
continue; | ||
public <V extends Modifier> List<V> getModifiers(ModifierType<V> type) { | ||
List<V> modifiers = new ArrayList<>(); | ||
for (var moduleEntry : modules) { | ||
for(Modifier modifier : moduleEntry.value().modifiers()) { | ||
if(modifier.getType() == type) { | ||
modifiers.add((V) modifier); | ||
} | ||
modifiers.addAll(module.pieces()); | ||
} | ||
} | ||
return modifiers; | ||
} | ||
|
||
public <V extends Modifier> List<V> getModulesPieces(ModifierType<V> type) { | ||
return (List<V>) getModulesPieces().stream().filter(piece -> piece.getType().equals(type)).toList(); | ||
} | ||
} |
Oops, something went wrong.