Commit a76d9835 by Jonathan Thomas

Merge branch '1.20-minecraft-support' into 'develop'

1.20 to 1.20.4 Build Support

See merge request !1
parents 56e15a43 e6f6b2a9
Pipeline #12136 passed with stage
in 1 minute 40 seconds
variables: variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false" GRADLE_OPTS: "-Dorg.gradle.daemon=false"
JAVA_HOME: "/home/jonathan/.jdks/openjdk-22.0.1"
cache: cache:
paths: paths:
...@@ -11,18 +12,39 @@ stages: ...@@ -11,18 +12,39 @@ stages:
build_mod: build_mod:
stage: build stage: build
before_script:
- export PATH=$JAVA_HOME/bin:$PATH
- java -version
script: script:
- ./gradlew build - |
- find build/libs -type f -name '*sources*.jar' -exec rm {} \; declare -a versions=("1.20" "1.20.1" "1.20.2" "1.20.3" "1.20.4")
- mv build/libs/creaturechat-*.jar . declare -a mappings=("1.20+build.1" "1.20.1+build.10" "1.20.2+build.4" "1.20.3+build.1" "1.20.4+build.3")
- export FABRIC_VERSION=$(grep 'fabric_version' gradle.properties | cut -d'=' -f2) declare -a fabric_versions=("0.83.0+1.20" "0.92.1+1.20.1" "0.91.6+1.20.2" "0.91.1+1.20.3" "0.97.0+1.20.4")
- export FABRIC_API_JAR="fabric-api-${FABRIC_VERSION}.jar"
- echo Detected Fabric API version from gradle.properties $FABRIC_API_JAR
- export DOWNLOAD_URL="https://github.com/FabricMC/fabric/releases/download/${FABRIC_VERSION//+/%2B}/${FABRIC_API_JAR}"
- echo Download Fabric API from $DOWNLOAD_URL
- wget -q -O "${FABRIC_API_JAR}" $DOWNLOAD_URL
- ls . -la
for i in "${!versions[@]}"; do
minecraft_version="${versions[$i]}"
yarn_mappings="${mappings[$i]}"
fabric_version="${fabric_versions[$i]}"
echo "****"
echo "Building for Minecraft Version $minecraft_version with Fabric $fabric_version\n"
echo "****"
# Replace versions before build attempt
sed -i "s/minecraft_version=.*/minecraft_version=$minecraft_version/" gradle.properties
sed -i "s/yarn_mappings=.*/yarn_mappings=$yarn_mappings/" gradle.properties
sed -i "s/loader_version=.*/loader_version=0.15.11/" gradle.properties
sed -i "s/fabric_version=.*/fabric_version=$fabric_version/" gradle.properties
./gradlew build
find build/libs -type f -name '*sources*.jar' -exec rm {} \;
mv build/libs/creaturechat-*.jar .
FABRIC_API_JAR="fabric-api-${fabric_version}.jar"
DOWNLOAD_URL="https://github.com/FabricMC/fabric/releases/download/${fabric_version//+/%2B}/${FABRIC_API_JAR}"
wget -q -O "${FABRIC_API_JAR}" $DOWNLOAD_URL
ls . -la
done
artifacts: artifacts:
paths: paths:
- creaturechat-*.jar - creaturechat-*.jar
...@@ -30,4 +52,4 @@ build_mod: ...@@ -30,4 +52,4 @@ build_mod:
only: only:
- develop - develop
tags: tags:
- minecraft - minecraft
\ No newline at end of file
...@@ -4,6 +4,14 @@ All notable changes to **CreatureChat** are documented in this file. The format ...@@ -4,6 +4,14 @@ All notable changes to **CreatureChat** are documented in this file. The format
[Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html). [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- Added support for Minecraft 1.20, 1.20.1, 1.20.2, 1.20.3, and 1.20.4 (new build pipeline)
### Changed
- Replaced calls to getLiteralString() with getString() for wider compatability
## [1.0.1] - 2024-05-06 ## [1.0.1] - 2024-05-06
### Added ### Added
......
...@@ -33,7 +33,7 @@ public class ClientPackets { ...@@ -33,7 +33,7 @@ public class ClientPackets {
public static void sendGenerateGreeting(Entity entity) { public static void sendGenerateGreeting(Entity entity) {
// Get user language // Get user language
String userLanguageCode = MinecraftClient.getInstance().getLanguageManager().getLanguage(); String userLanguageCode = MinecraftClient.getInstance().getLanguageManager().getLanguage();
String userLanguageName = MinecraftClient.getInstance().getLanguageManager().getLanguage(userLanguageCode).getDisplayText().getLiteralString(); String userLanguageName = MinecraftClient.getInstance().getLanguageManager().getLanguage(userLanguageCode).getDisplayText().getString();
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer()); PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeString(entity.getUuidAsString()); buf.writeString(entity.getUuidAsString());
...@@ -79,7 +79,7 @@ public class ClientPackets { ...@@ -79,7 +79,7 @@ public class ClientPackets {
public static void sendChat(Entity entity, String message) { public static void sendChat(Entity entity, String message) {
// Get user language // Get user language
String userLanguageCode = MinecraftClient.getInstance().getLanguageManager().getLanguage(); String userLanguageCode = MinecraftClient.getInstance().getLanguageManager().getLanguage();
String userLanguageName = MinecraftClient.getInstance().getLanguageManager().getLanguage(userLanguageCode).getDisplayText().getLiteralString(); String userLanguageName = MinecraftClient.getInstance().getLanguageManager().getLanguage(userLanguageCode).getDisplayText().getString();
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer()); PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
buf.writeString(entity.getUuidAsString()); buf.writeString(entity.getUuidAsString());
......
...@@ -243,11 +243,11 @@ public class BubbleRenderer { ...@@ -243,11 +243,11 @@ public class BubbleRenderer {
if (entity instanceof MobEntity) { if (entity instanceof MobEntity) {
// Custom Name Tag (MobEntity) // Custom Name Tag (MobEntity)
if (entity.getCustomName() != null) { if (entity.getCustomName() != null) {
nameText = entity.getCustomName().getLiteralString(); nameText = entity.getCustomName().getString();
} }
} else if (entity instanceof PlayerEntity) { } else if (entity instanceof PlayerEntity) {
// Player Name // Player Name
nameText = entity.getName().getLiteralString(); nameText = entity.getName().getString();
} }
// Truncate long names // Truncate long names
......
...@@ -191,7 +191,7 @@ public class ChatDataManager { ...@@ -191,7 +191,7 @@ public class ChatDataManager {
if (entity.getCustomName() == null) { if (entity.getCustomName() == null) {
contextData.put("entity_name", ""); contextData.put("entity_name", "");
} else { } else {
contextData.put("entity_name", entity.getCustomName().getLiteralString()); contextData.put("entity_name", entity.getCustomName().getString());
} }
contextData.put("entity_type", entity.getType().getName().getString()); contextData.put("entity_type", entity.getType().getName().getString());
contextData.put("entity_health", entity.getHealth() + "/" + entity.getMaxHealth()); contextData.put("entity_health", entity.getHealth() + "/" + entity.getMaxHealth());
......
...@@ -66,7 +66,7 @@ public class CreatureChatCommands { ...@@ -66,7 +66,7 @@ public class CreatureChatCommands {
Text feedbackMessage = Text.literal(settingDescription + " Set Successfully!").formatted(Formatting.GREEN);; Text feedbackMessage = Text.literal(settingDescription + " Set Successfully!").formatted(Formatting.GREEN);;
source.sendFeedback(() -> feedbackMessage, false); source.sendFeedback(() -> feedbackMessage, false);
LOGGER.info("Command executed: " + feedbackMessage.getLiteralString()); LOGGER.info("Command executed: " + feedbackMessage.getString());
return 1; return 1;
} }
......
...@@ -244,8 +244,8 @@ public class ServerPackets { ...@@ -244,8 +244,8 @@ public class ServerPackets {
StringBuilder userMessageBuilder = new StringBuilder(); StringBuilder userMessageBuilder = new StringBuilder();
userMessageBuilder.append("Please generate a " + randomFrequency + " " + randomAdjective); userMessageBuilder.append("Please generate a " + randomFrequency + " " + randomAdjective);
userMessageBuilder.append(" character "); userMessageBuilder.append(" character ");
if (entity.getCustomName() != null && !entity.getCustomName().getLiteralString().equals("N/A")) { if (entity.getCustomName() != null && !entity.getCustomName().getString().equals("N/A")) {
userMessageBuilder.append("named '").append(entity.getCustomName().getLiteralString()).append("' "); userMessageBuilder.append("named '").append(entity.getCustomName().getString()).append("' ");
} else { } else {
userMessageBuilder.append("whose name starts with the letter '").append(Randomizer.RandomLetter()).append("' "); userMessageBuilder.append("whose name starts with the letter '").append(Randomizer.RandomLetter()).append("' ");
userMessageBuilder.append("and uses ").append(Randomizer.RandomNumber(4) + 1).append(" syllables "); userMessageBuilder.append("and uses ").append(Randomizer.RandomNumber(4) + 1).append(" syllables ");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment