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

Implement tier two #156

Merged
merged 16 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Bug report
description: Report issues with plugin incompatbility or other behavior related issues.
description: Report issues with mod incompatibility or other behavior related issues.
labels: [ "bug" ]
body:
- type: textarea
Expand Down Expand Up @@ -42,7 +42,7 @@ body:
label: Relevent logs and/or screenshots/videos
description: |
Paste any relevant logs - please use code blocks (```) to format console output, logs, and code, as
it's very hard to read otherwise. You can also use https://pastebin.com to make our life easier.
it's very hard to read otherwise. You can also use https://pastes.dev or similar to make our life easier.
validations:
required: false

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
# Use these Java versions
java: [
'17' # Latest version
'21' # Latest version
]
# and run on both Linux and Windows
os: [ ubuntu-20.04 ]
Expand All @@ -32,7 +32,7 @@ jobs:
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from LTS java on one OS
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v3
with:
name: Artifacts
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
# Use these Java versions
java: [
'17' # Latest version
'21' # Latest version
]
# and run on both Linux and Windows
os: [ubuntu-20.04]
Expand All @@ -33,7 +33,7 @@ jobs:
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from LTS java on one OS
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from LTS java on one OS
uses: actions/upload-artifact@v3
with:
name: Artifacts
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
build/
out/
classes/
lib/

# eclipse

Expand Down
37 changes: 21 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
plugins {
id 'groovy'
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
}

java.sourceCompatibility = JavaVersion.VERSION_17
java.targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
Expand All @@ -19,7 +16,6 @@ repositories {
maven { url "https://maven.terraformersmc.com/" }
maven { url "https://server.bbkr.space/artifactory/libs-release" }
maven { url "https://jitpack.io" }
maven { url "https://ladysnake.jfrog.io/artifactory/mods" }
}

sourceSets {
Expand Down Expand Up @@ -84,10 +80,14 @@ dependencies {
// I took a lot of this from dynamic fps just for examples

// Mod Menu, to add the hook for a config screen
modImplementation "com.terraformersmc:modmenu:${project.modmenu_version}"
modImplementation("com.terraformersmc:modmenu:${project.modmenu_version}")

annotationProcessor modImplementation("io.wispforest:owo-lib:${project.owo_version}")
modCompileOnly include("io.wispforest:owo-sentinel:${project.owo_version}")
annotationProcessor modImplementation("io.wispforest:owo-lib:${project.owo_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
modCompileOnly include("io.wispforest:owo-sentinel:${project.owo_version}") {
exclude(group: "net.fabricmc.fabric-api")
}

modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_version}") {
exclude(group: "net.fabricmc.fabric-api")
Expand Down Expand Up @@ -118,7 +118,7 @@ tasks {
duplicatesStrategy = DuplicatesStrategy.WARN
from file('src/main/generated')
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
rename { "${it}_${project.base.archivesName.get()}"}
}
dependsOn 'runDatagen'
}
Expand All @@ -143,28 +143,33 @@ tasks.withType(JavaCompile).configureEach {
options.compilerArgs << '-Xlint:all'
options.deprecation = true

// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
it.options.release = 21
}

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}

// select the repositories you want to publish to
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// uncomment to publish to the local maven
// mavenLocal()
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
}
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ org.gradle.jvmargs=-Xmx2G

# Fabric Properties
# check these on https://fabricmc.net/develop/
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.15.6
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.3

#Fabric api
fabric_version=0.91.6+1.20.2
# Fabric API
fabric_version=0.103.0+1.21.1

# Mod Properties
mod_version = 1.0.6
Expand All @@ -22,7 +22,7 @@ modid = taleofkingdoms

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
modmenu_version = 8.0.0
cloth_version = 12.0.109
modmenu_version = 11.0.2
cloth_version = 15.0.130
toml4j_version = 0.7.2
owo_version = 0.11.3+1.20.2
owo_version = 0.12.11+1.21
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.convallyria.taleofkingdoms.client.gui.generic.ScreenStartConquest;
import com.convallyria.taleofkingdoms.client.gui.shop.ScreenSellItem;
import com.convallyria.taleofkingdoms.client.listener.ClientGameInstanceListener;
import com.convallyria.taleofkingdoms.client.packet.ClientPacketHandler;
import com.convallyria.taleofkingdoms.client.listener.StartWorldListener;
import com.convallyria.taleofkingdoms.client.packet.both.BothSignContractPacketHandler;
import com.convallyria.taleofkingdoms.client.packet.incoming.IncomingInstanceSyncPacketHandler;
import com.convallyria.taleofkingdoms.client.packet.incoming.IncomingOpenScreenPacketHandler;
Expand All @@ -20,8 +20,11 @@
import com.convallyria.taleofkingdoms.client.packet.outgoing.OutgoingHunterPacketHandler;
import com.convallyria.taleofkingdoms.client.packet.outgoing.OutgoingInnkeeperPacketHandler;
import com.convallyria.taleofkingdoms.client.packet.outgoing.OutgoingToggleSellGuiPacketHandler;
import com.convallyria.taleofkingdoms.client.listener.StartWorldListener;
import com.convallyria.taleofkingdoms.common.kingdom.PlayerKingdom;
import com.convallyria.taleofkingdoms.common.packet.PacketHandler;
import com.convallyria.taleofkingdoms.common.world.ConquestInstance;
import com.convallyria.taleofkingdoms.server.packet.outgoing.OutgoingOpenScreenPacketHandler;
import com.convallyria.taleofkingdoms.server.world.ServerConquestInstance;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
Expand All @@ -30,6 +33,7 @@
import net.minecraft.client.gui.screen.ingame.HandledScreens;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import net.minecraft.server.network.ServerPlayerEntity;
import org.lwjgl.glfw.GLFW;

import java.io.File;
Expand Down Expand Up @@ -57,6 +61,7 @@ public void onInitializeClient() {
new RenderSetup(api.getMod());
registerPacketHandlers();
registerEvents();
registerTasks();
HandledScreens.register(TaleOfKingdoms.SELL_SCREEN_HANDLER, ScreenSellItem::new);

ClientTickEvents.END_CLIENT_TICK.register(client -> {
Expand All @@ -72,7 +77,7 @@ public void onInitializeClient() {
return;
}

File file = new File(api.getDataFolder() + "worlds/" + worldName + ".conquestworld");
File file = new File(api.getDataFolder() + "worlds/" + worldName + ConquestInstance.FILE_TYPE);
client.setScreen(new ScreenStartConquest(worldName, file, client.player));
}
});
Expand All @@ -95,11 +100,11 @@ private void registerPacketHandlers() {
registerHandler(new IncomingInstanceSyncPacketHandler());
registerHandler(new IncomingOpenScreenPacketHandler());

api.registerIntegratedHandler(new OutgoingOpenScreenPacketHandler());
api.registerPacketHandler(EnvType.SERVER, new OutgoingOpenScreenPacketHandler());
}

protected void registerHandler(ClientPacketHandler clientPacketHandler) {
api.registerClientHandler(clientPacketHandler);
protected void registerHandler(PacketHandler<?> clientPacketHandler) {
api.registerPacketHandler(EnvType.CLIENT, clientPacketHandler);
}

private void registerEvents() {
Expand All @@ -108,4 +113,20 @@ private void registerEvents() {
new ClientGameInstanceListener();
new RenderListener();
}

private void registerTasks() {
api.getScheduler().repeating(server -> {
api.getConquestInstanceStorage().mostRecentInstance().ifPresent(instance -> {
instance.getGuildPlayers().forEach((id, guildPlayer) -> {
final PlayerKingdom kingdom = guildPlayer.getKingdom();
if (kingdom == null) return;
kingdom.tryTaxCollection(guildPlayer);
final ServerPlayerEntity player = server.getPlayerManager().getPlayer(id);
if (player != null) {
ServerConquestInstance.sync(player, instance);
}
});
});
}, 20, 1000);
}
}
Loading
Loading