Compare commits

...

11 commits

Author SHA1 Message Date
Oth3r
82c4b375d5 v1.2.4.3 2025-06-14 18:57:37 -05:00
Oth3r
02a7157a93 add otterlib max version as the beta changes a lot of stuff 2025-06-14 18:56:21 -05:00
Oth3r
c675a24e94 v1.2.4.2+1.21.5 2025-06-14 18:52:00 -05:00
Oth3r
2eb6952144 fix not(!) tag check logic 2025-06-14 18:50:55 -05:00
Haru
d82b4b49f9
Merge pull request #24 from Oth3r/crowdin/translations
Update translations from Crowdin
2025-06-14 18:07:09 -05:00
github-actions[bot]
cfcf68f463 Rename JSON translation files to lowercase for consistency 2025-06-14 22:49:33 +00:00
github-actions[bot]
235a0a61db New Crowdin translations by GitHub Action 2025-06-14 22:49:21 +00:00
Oth3r
dea8b5af3e fix target directory 2025-06-14 17:48:17 -05:00
Oth3r
86066ebfb1 Merge remote-tracking branch 'origin/master' 2025-06-14 17:45:58 -05:00
Oth3r
e6eb46d7fa lowercase locale 2025-06-14 17:43:38 -05:00
Oth3r
6c02b090ac get the player's actual reach when checking sitting 2025-06-14 17:13:19 -05:00
42 changed files with 166 additions and 90 deletions

View file

@ -3,31 +3,123 @@ name: Crowdin Download Action
permissions:
contents: write
pull-requests: write
actions: read
on:
workflow_dispatch:
inputs:
localization_branch_name:
description: 'The branch to create for the translations PR.'
required: true
default: 'crowdin/translations'
pull_request_base_branch:
description: 'The base branch for the pull request.'
required: true
default: 'dev'
jobs:
crowdin:
download-translations:
runs-on: ubuntu-latest
steps:
- name: Checkout
# Checkout the BASE branch first. The PR branch will be created later.
- name: Checkout Base Branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.pull_request_base_branch }}
- name: Synchronize with Crowdin
- name: Configure Git User
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Synchronize with Crowdin (Download Only)
uses: crowdin/github-action@v2
with:
upload_sources: false
upload_translations: false
download_translations: true
localization_branch_name: crowdin_translations
create_pull_request: true
pull_request_title: 'Updated Crowdin translations'
pull_request_body: 'New Crowdin pull request with translations'
pull_request_base_branch_name: 'dev'
create_pull_request: false
localization_branch_name: ${{ github.event.inputs.localization_branch_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
rename-files:
needs: download-translations
runs-on: ubuntu-latest
steps:
- name: Checkout Localization Branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.localization_branch_name }}
- name: Configure Git User
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Rename JSON Files to Lowercase
env:
TARGET_DIR: "src/main/resources/assets/sit-oth3r/lang/"
run: |
echo "Starting renaming process for JSON files within $TARGET_DIR..."
if [ ! -d "$TARGET_DIR" ]; then
echo "Warning: Target directory '$TARGET_DIR' does not exist. Skipping rename."
exit 0
fi
find "$TARGET_DIR" -type f -name '*[A-Z]*.json' | while IFS= read -r file; do
original_path="$file"
dir_name=$(dirname "$original_path")
base_name=$(basename "$original_path")
new_base_name=$(echo "$base_name" | tr '[:upper:]' '[:lower:]')
new_path="$dir_name/$new_base_name"
if [ "$original_path" != "$new_path" ]; then
if [ -e "$new_path" ] && [ ! "$(readlink -f "$original_path")" = "$(readlink -f "$new_path")" ]; then
echo "::warning file=$original_path::Cannot rename '$original_path' to '$new_path' because it already exists. Skipping."
else
git mv "$original_path" "$new_path"
fi
fi
done
echo "JSON file renaming complete."
- name: Commit Renamed Files
run: |
echo "Committing renamed files..."
git add -A
git commit -m "Rename JSON translation files to lowercase for consistency"
echo "Renames committed."
- name: Push Changes to Localization Branch
run: |
echo "Pushing combined changes to ${{ github.event.inputs.localization_branch_name }}..."
git push origin ${{ github.event.inputs.localization_branch_name }}
create-pr:
needs: [ download-translations, rename-files ]
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.localization_branch_name }}
- name: Set up Git config
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
- name: Install GitHub CLI
run: sudo apt-get install gh -y
- name: Authenticate GitHub CLI
run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: Create Pull Request
run: |
gh pr create \
--title "Update translations from Crowdin" \
--body "This PR includes:\n- New translations from Crowdin\n- Renamed translation files to lowercase" \
--head ${{ github.event.inputs.localization_branch_name }} \
--base ${{ github.event.inputs.pull_request_base_branch }} \
--label "localization"

View file

@ -2,7 +2,7 @@ name: Crowdin Upload Action
on:
push:
paths: [ "src/main/resources/assets/sit-oth3r/lang/en_US.json"]
paths: [ "src/main/resources/assets/sit-oth3r/lang/en_us.json"]
branches: [ dev ]
workflow_dispatch:

View file

@ -43,6 +43,7 @@ processResources {
min_minecraft_version : min_minecraft_version,
max_minecraft_version : max_minecraft_version,
otterlib_version : otterlib_version,
otterlib_max_version : otterlib_max_version,
loader_version : loader_version
]

View file

@ -1,3 +1,11 @@
# v1.2.4.3
* added a max OtterLib version as the beta will have breaking changes between major versions
# v1.2.4.2
* fixed language file not loading (reverted uppercase locales)
* fixed block checking having a hardcoded player reach - now uses player reach
* fixed block and item tag check logic for cases with only not(!) tags
# v1.2.4.1
* removed unused assets
* enabled file logging for easier debugging

View file

@ -6,7 +6,7 @@
files: [
{
"source": "src/main/resources/assets/sit-oth3r/lang/en_US.json",
"source": "src/main/resources/assets/sit-oth3r/lang/en_us.json",
"translation": "src/main/resources/assets/sit-oth3r/lang/%locale_with_underscore%.json",
}
]

View file

@ -13,7 +13,7 @@ yarn_mappings=1.21.5+build.1
loader_version=0.16.14
# Mod Properties
mod_version=1.2.4.1+1.21.5
mod_version=1.2.4.3+1.21.5
maven_group=one.oth3r
file_name=sit!
@ -21,3 +21,4 @@ file_name=sit!
fabric_version=0.124.0+1.21.5
modmenu_version=14.0.0-rc.2
otterlib_version=0.1.2.1+1.21.5-fabric
otterlib_max_version=0.2.0.0+1.21.5-fabric

View file

@ -91,19 +91,27 @@ public class CustomBlock {
}
// a boolean to check if one of the blocks are in a filtered tag
boolean tagCheck = false;
// & a switch for if there is only not(!) tags
boolean tagCheck = false, hasPositiveTags = false;
// for all the entered tags
for (String tag : blockTags) {
// substring to remove # and if needed, !
// if there is a math for the NOT(!) tag, return false
if (tag.startsWith("!") && blockState.isIn(TagKey.of(Registries.BLOCK.getKey(), Identifier.of(tag.substring(2))))) return false;
// if there is a match, return true
if (blockState.isIn(TagKey.of(Registries.BLOCK.getKey(), Identifier.tryParse(tag.substring(1))))) tagCheck = true;
if (tag.startsWith("!")) {
// if there is a match for the NOT(!) tag, return false
Identifier id = Identifier.tryParse(tag.substring(2));
if (id != null && blockState.isIn(TagKey.of(Registries.BLOCK.getKey(), id))) return false;
} else {
// flip the hasPositiveTags boolean
hasPositiveTags = true;
// if there is a match, return true
Identifier id = Identifier.tryParse(tag.substring(1));
if (id != null && blockState.isIn(TagKey.of(Registries.BLOCK.getKey(), id))) tagCheck = true;
}
}
// not returning true in the loop because there might be a (!) not tag that the block might fall into, after the block was already in another tag
return tagCheck;
// if there were any required tags, return whether we matched one
// if there were only not(!) tags, and we didn't violate any, return true
return hasPositiveTags? tagCheck : true;
}
@Override

View file

@ -51,22 +51,27 @@ public class CustomItem {
}
// a boolean to check if one of the items are in a filtered tag
boolean tagCheck = false;
// & a switch for if there is only not(!) tags
boolean tagCheck = false, hasPositiveTags = false;
// check the custom item tags
for (String tag : itemTags) {
// substring to remove # and if needed, "!"
// if a NOT tag
if (tag.startsWith("!")) {
// if there is a math for the NOT(!) tag, return false
if (itemStack.isIn(TagKey.of(Registries.ITEM.getKey(), Identifier.of(tag.substring(2))))) return false;
Identifier id = Identifier.tryParse(tag.substring(2));
if (id != null && itemStack.isIn(TagKey.of(Registries.ITEM.getKey(), id))) return false;
} else {
// flip the hasPositiveTags boolean
hasPositiveTags = true;
// else (normal tag), if there is a match, set tagCheck to true
Identifier id = Identifier.tryParse(tag.substring(1));
if (id != null && itemStack.isIn(TagKey.of(Registries.ITEM.getKey(), id))) tagCheck = true;
}
// else (normal tag), if there is a match, set tagCheck to true
else if (itemStack.isIn(TagKey.of(Registries.ITEM.getKey(), Identifier.of(tag.substring(1))))) tagCheck = true;
}
// not returning true in the loop because there might be a (!) not tag that the item might fall into, after the item was already in another tag
return tagCheck;
// if there were any required tags, return whether we matched one
// if there were only not(!) tags, and we didn't violate any, return true
return hasPositiveTags? tagCheck : true;
}
@Override

View file

@ -27,12 +27,12 @@ import java.util.stream.Collectors;
public class ServerConfig implements CustomFile<ServerConfig> {
@SerializedName("version")
private Double version = 2.2;
private Double version = 2.3;
@SerializedName("lang")
private String lang = "en_US";
private String lang = "en_us";
@SerializedName("lang-options")
private final String langOptions = "en_US, it_IT, pt_BR, tr_TR, zh_TW, zh_CH, de_DE";
private final String langOptions = "en_us, it_it, pt_br, tr_tr, zh_tw, zh_ch, de_de";
@SerializedName("keep-active")
private Boolean keepActive = true;
@ -276,6 +276,11 @@ public class ServerConfig implements CustomFile<ServerConfig> {
if (version >= 2.0 && version <= 2.1) {
version = 2.2;
}
if (version == 2.2) {
// make sure that the lang is all lowercase
version = 2.3;
this.lang = this.lang.substring(0,3)+this.lang.substring(3).toLowerCase();
}
}
@Override

View file

@ -77,7 +77,8 @@ public class Logic {
* @return true if sitting was successful
*/
public static boolean sitLooking(ServerPlayerEntity player) {
return sit(player, Utl.getBlockPosPlayerIsLookingAt(player.getServerWorld(),player,5),null);
return sit(player, Utl.getBlockPosPlayerIsLookingAt(player.getServerWorld(),player,
Utl.getPlayerReach(player)),null);
}
/**

View file

@ -10,6 +10,7 @@ import net.minecraft.block.*;
import net.minecraft.block.enums.BlockHalf;
import net.minecraft.block.enums.SlabType;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.decoration.DisplayEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
@ -482,4 +483,13 @@ public class Utl {
return new BlockPos(player.getBlockPos());
}
public static double getPlayerReach(PlayerEntity player) {
// use the BLOCK_INTERACTION_RANGE attribute if available
if (player.getAttributeInstance(EntityAttributes.BLOCK_INTERACTION_RANGE) != null) {
return player.getAttributeValue(EntityAttributes.BLOCK_INTERACTION_RANGE);
}
// fallback to 5
return 5;
}
}

View file

@ -68,13 +68,8 @@
"key.sit!.sit": "Sitzen",
"key.sit!.config": "Konfiguration öffnen",
"sit!.screen.config": "Sit! Konfiguration",
"sit!.gui.button.file": "Datei öffnen",
"sit!.gui.button.folder": "Ordner öffnen",
"sit!.gui.button.reset": "Zurücksetzen",
"sit!.gui.button.issues": "Probleme",
"sit!.gui.button.donate": "Spenden",
"sit!.gui.button.revert": "Änderungen rückgängig machen",
"sit!.gui.button.save": "Speichern und schließen",
"sit!.gui.button.website": "Website",
"sit!.console.connected": "Verbunden mit Sit! Server: %s",
"sit!.console.player_settings": "Benutzerdefinierte Sitzungseinstellungen von %s erhalten!",

View file

@ -68,13 +68,8 @@
"key.sit!.sit": "Sentarse",
"key.sit!.config": "Abrir configuración",
"sit!.screen.config": "Configuracion de Sit!",
"sit!.gui.button.file": "Abrir Archivo",
"sit!.gui.button.folder": "Abrir Carpeta",
"sit!.gui.button.reset": "Reiniciar",
"sit!.gui.button.issues": "Problemas",
"sit!.gui.button.donate": "Donar",
"sit!.gui.button.revert": "Revertir cambios",
"sit!.gui.button.save": "Guardar y salir",
"sit!.gui.button.website": "Sitio web ",
"sit!.console.player_settings": "¡Se recibió configuraciones personalizadas dé %s!",
"modmenu.descriptionTranslation.sit-oth3r": "¡Añade la capacidad de sentarse a Minecraft! Configuración extensa para restricciones de mano y bloques sentables.\n ¡Los jugadores pueden tener su propia configuración cuando usan Sit! del lado del cliente en un servidor!"

View file

@ -68,13 +68,8 @@
"key.sit!.sit": "S'asseoir",
"key.sit!.config": "Ouvrir la configuration",
"sit!.screen.config": "Sit! Config",
"sit!.gui.button.file": "Ouvrir le fichier",
"sit!.gui.button.folder": "Ouvrir le dossier",
"sit!.gui.button.reset": "Restaurer",
"sit!.gui.button.issues": "Problèmes",
"sit!.gui.button.donate": "Faire un don",
"sit!.gui.button.revert": "Annuler les modifications",
"sit!.gui.button.save": "Enregistrer et fermer",
"sit!.gui.button.website": "Site web",
"sit!.console.connected": "Connecté au serveur Sit! : %s",
"sit!.console.player_settings": "Reçu les paramètres de séance personnalisés de %s!",

View file

@ -68,13 +68,8 @@
"key.sit!.sit": "Siediti",
"key.sit!.config": "Apri Impostazioni",
"sit!.screen.config": "Impostazioni Sit!",
"sit!.gui.button.file": "Apri File",
"sit!.gui.button.folder": "Apri Cartella",
"sit!.gui.button.reset": "Resetta",
"sit!.gui.button.issues": "Problemi",
"sit!.gui.button.donate": "Dona",
"sit!.gui.button.revert": "Annulla i Cambiamenti",
"sit!.gui.button.save": "Salva ed Esci",
"sit!.gui.button.website": "Sito Web",
"sit!.console.connected": "Connesso al server Sit!: %s",
"sit!.console.player_settings": "Ricevute impostazioni custom da %s!",

View file

@ -44,12 +44,7 @@
"key.sit!.toggle": "Przełącz możliwość siadania",
"key.sit!.config": "Otwórz ustawienia",
"sit!.screen.config": "Konfiguracja Sit!",
"sit!.gui.button.file": "Otwórz plik",
"sit!.gui.button.folder": "Otwórz folder",
"sit!.gui.button.reset": "Reset",
"sit!.gui.button.donate": "Wesprzyj",
"sit!.gui.button.revert": "Cofnij zmiany",
"sit!.gui.button.save": "Zapisz i zamknij",
"sit!.gui.button.website": "Strona",
"sit!.console.connected": "Połączono z serwerem wspierającym Sit!: %s",
"sit!.console.player_settings": "Otrzymano niestandardowe ustawienia z: %s!",

View file

@ -68,13 +68,8 @@
"key.sit!.sit": "Sentar",
"key.sit!.config": "Abrir Configuração",
"sit!.screen.config": "Configuração do Sit!",
"sit!.gui.button.file": "Abrir Arquivo",
"sit!.gui.button.folder": "Abrir Pasta",
"sit!.gui.button.reset": "Reiniciar",
"sit!.gui.button.issues": "Problemas",
"sit!.gui.button.donate": "Doar",
"sit!.gui.button.revert": "Reverter Alterações",
"sit!.gui.button.save": "Salvar e Fechar",
"sit!.gui.button.website": "Website",
"sit!.console.connected": "Conectado ao servidor Sit!: %s",
"sit!.console.player_settings": "Recebidas configurações de sentar personalizadas de %s!",

View file

@ -68,13 +68,8 @@
"key.sit!.sit": "Sentar",
"key.sit!.config": "Abrir definições",
"sit!.screen.config": "Definições do Sit!",
"sit!.gui.button.file": "Abrir ficheiro",
"sit!.gui.button.folder": "Abrir pasta",
"sit!.gui.button.reset": "Repor",
"sit!.gui.button.issues": "Problemas",
"sit!.gui.button.donate": "Doar",
"sit!.gui.button.revert": "Reverter alterações",
"sit!.gui.button.save": "Guardar e fechar",
"sit!.gui.button.website": "Website",
"sit!.console.connected": "Conectado ao servidor Sit!: %s",
"sit!.console.player_settings": "Recebidas definições de sentar personalizadas de %s!",

View file

@ -68,13 +68,8 @@
"key.sit!.sit": "Сесть",
"key.sit!.config": "Открыть Конфигурацию",
"sit!.screen.config": "Конфигурация Sit!",
"sit!.gui.button.file": "Открыть Файл",
"sit!.gui.button.folder": "Открыть Папку",
"sit!.gui.button.reset": "Сбросить",
"sit!.gui.button.issues": "Баг‑трекер",
"sit!.gui.button.donate": "Пожертвовать",
"sit!.gui.button.revert": "Отменить Изменения",
"sit!.gui.button.save": "Сохранить и Закрыть",
"sit!.gui.button.website": "Веб-сайт",
"sit!.console.connected": "Подключено к серверу Sit!: %s",
"sit!.console.player_settings": "Получены пользовательские настройки сидения от %s!",

View file

@ -68,13 +68,8 @@
"key.sit!.sit": "Otur",
"key.sit!.config": "Ayarlandırmaları aç",
"sit!.screen.config": "Sit! Ayarlandırmaları",
"sit!.gui.button.file": "Dosya Aç",
"sit!.gui.button.folder": "Klasörü Aç",
"sit!.gui.button.reset": "Sıfırla",
"sit!.gui.button.issues": "Sorunlar",
"sit!.gui.button.donate": "Bağış yap",
"sit!.gui.button.revert": "Değişiklikleri Geri Al",
"sit!.gui.button.save": "Kaydet ve Kapat",
"sit!.gui.button.website": "İnternet Sitesi",
"sit!.console.connected": "Sit! sunucusuna bağlanıldı: %s",
"sit!.console.player_settings": "Özel oturma ayarları %s alındı!",

View file

@ -68,13 +68,8 @@
"key.sit!.sit": "坐下",
"key.sit!.config": "打开配置",
"sit!.screen.config": "Sit! 配置",
"sit!.gui.button.file": "打开文件",
"sit!.gui.button.folder": "打开文件夹",
"sit!.gui.button.reset": "重置",
"sit!.gui.button.issues": "问题反馈",
"sit!.gui.button.donate": "赞助",
"sit!.gui.button.revert": "还原更改",
"sit!.gui.button.save": "保存并关闭",
"sit!.gui.button.website": "网站",
"sit!.console.connected": "已连接到 Sit! 服务器: %s",
"sit!.console.player_settings": "已从 %s 获得自定义坐下设置。",

View file

@ -68,13 +68,8 @@
"key.sit!.sit": "坐下",
"key.sit!.config": "開啟設定",
"sit!.screen.config": "坐下! 設定",
"sit!.gui.button.file": "開啟檔案",
"sit!.gui.button.folder": "開啟資料夾",
"sit!.gui.button.reset": "重置",
"sit!.gui.button.issues": "問題",
"sit!.gui.button.donate": "贊助",
"sit!.gui.button.revert": "還原變更",
"sit!.gui.button.save": "儲存並關閉",
"sit!.gui.button.website": "網站",
"sit!.console.connected": "已連線至 Sit! 伺服器: %s",
"sit!.console.player_settings": "已從 %s 收到自訂坐下設定!",

View file

@ -29,7 +29,7 @@
"fabricloader": ">=0.14.21",
"minecraft": ">=${min_minecraft_version} <=${max_minecraft_version}",
"fabric": "*",
"otterlib": ">=${otterlib_version}"
"otterlib": ">=${otterlib_version} <${otterlib_max_version}"
},
"suggests": {
"modmenu": "*"