@@ -0,0 +1,5 @@
|
|||||||
|
# Disable autocrlf on generated files, they always generate with LF
|
||||||
|
# Add any extra files or paths here to make git stop saying they
|
||||||
|
# are changed when only line endings change.
|
||||||
|
src/generated/**/.cache/* text eol=lf
|
||||||
|
src/generated/**/*.json text eol=lf
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
- name: Setup JDK 21
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: '21'
|
||||||
|
distribution: 'temurin'
|
||||||
|
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: ./gradlew build
|
||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
### Gradle ###
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
!gradle/wrapper/gradle-wrapper.jar
|
||||||
|
!**/src/**/build/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
out/
|
||||||
|
!**/src/**/out/
|
||||||
|
|
||||||
|
.run/
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.eclipse/
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/**/bin/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
### Minecraft Modding ###
|
||||||
|
run/
|
||||||
|
!**/src/**/run/
|
||||||
|
**/src/generated/**/.cache/
|
||||||
|
repo/
|
||||||
|
!**/src/**/repo/
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 NeoForged project
|
||||||
|
|
||||||
|
This license applies to the template files as supplied by github.com/NeoForged/MDK
|
||||||
|
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
+176
@@ -0,0 +1,176 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java-library'
|
||||||
|
id 'maven-publish'
|
||||||
|
id 'net.neoforged.gradle.userdev' version '7.1.26'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('wrapper', Wrapper).configure {
|
||||||
|
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
|
||||||
|
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
|
||||||
|
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
|
||||||
|
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
|
||||||
|
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
|
||||||
|
distributionType = Wrapper.DistributionType.BIN
|
||||||
|
}
|
||||||
|
|
||||||
|
version = mod_version
|
||||||
|
group = mod_group_id
|
||||||
|
|
||||||
|
sourceSets.main.resources {
|
||||||
|
// Include resources generated by data generators.
|
||||||
|
srcDir('src/generated/resources')
|
||||||
|
|
||||||
|
// Exclude common development only resources from finalized outputs
|
||||||
|
exclude("**/*.bbmodel") // BlockBench project files
|
||||||
|
exclude("src/generated/**/.cache") // datagen cache files
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
// Add here additional repositories if required by some of the dependencies below.
|
||||||
|
}
|
||||||
|
|
||||||
|
base {
|
||||||
|
archivesName = mod_id
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mojang ships Java 21 to end users in 1.21.1, so mods should target Java 21.
|
||||||
|
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
|
||||||
|
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||||
|
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
|
||||||
|
|
||||||
|
// Default run configurations.
|
||||||
|
// These can be tweaked, removed, or duplicated as needed.
|
||||||
|
runs {
|
||||||
|
// applies to all the run configs below
|
||||||
|
configureEach {
|
||||||
|
// Recommended logging data for a userdev environment
|
||||||
|
// The markers can be added/remove as needed separated by commas.
|
||||||
|
// "SCAN": For mods scan.
|
||||||
|
// "REGISTRIES": For firing of registry events.
|
||||||
|
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||||
|
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
||||||
|
|
||||||
|
// Recommended logging level for the console
|
||||||
|
// You can set various levels here.
|
||||||
|
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||||
|
systemProperty 'forge.logging.console.level', 'debug'
|
||||||
|
|
||||||
|
workingDirectory project.layout.projectDirectory.dir('run').dir(name)
|
||||||
|
|
||||||
|
modSource project.sourceSets.main
|
||||||
|
}
|
||||||
|
|
||||||
|
client {
|
||||||
|
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||||
|
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
||||||
|
argument '--nogui'
|
||||||
|
}
|
||||||
|
|
||||||
|
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||||
|
// By default, the server will crash when no gametests are provided.
|
||||||
|
// The gametest system is also enabled by default for other run configs under the /test command.
|
||||||
|
gameTestServer {
|
||||||
|
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
||||||
|
}
|
||||||
|
|
||||||
|
data {
|
||||||
|
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
|
||||||
|
// workingDirectory project.file('run-data')
|
||||||
|
|
||||||
|
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||||
|
arguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets up a dependency configuration called 'localRuntime'.
|
||||||
|
// This configuration should be used instead of 'runtimeOnly' to declare
|
||||||
|
// a dependency that will be present for runtime testing but that is
|
||||||
|
// "optional", meaning it will not be pulled by dependents of this mod.
|
||||||
|
configurations {
|
||||||
|
runtimeClasspath.extendsFrom localRuntime
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// Specify the version of Minecraft to use.
|
||||||
|
// Depending on the plugin applied there are several options. We will assume you applied the userdev plugin as shown above.
|
||||||
|
// The group for userdev is net.neoforged, the module name is neoforge, and the version is the same as the neoforge version.
|
||||||
|
// You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader.
|
||||||
|
// And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version.
|
||||||
|
// For all intends and purposes: You can treat this dependency as if it is a normal library you would use.
|
||||||
|
implementation "net.neoforged:neoforge:${neo_version}"
|
||||||
|
|
||||||
|
// Example optional mod dependency with JEI
|
||||||
|
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
|
||||||
|
// compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
|
||||||
|
// compileOnly "mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}"
|
||||||
|
// We add the full version to localRuntime, not runtimeOnly, so that we do not publish a dependency on it
|
||||||
|
// localRuntime "mezz.jei:jei-${mc_version}-neoforge:${jei_version}"
|
||||||
|
|
||||||
|
// Example mod dependency using a mod jar from ./libs with a flat dir repository
|
||||||
|
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
|
||||||
|
// The group id is ignored when searching -- in this case, it is "blank"
|
||||||
|
// implementation "blank:coolmod-${mc_version}:${coolmod_version}"
|
||||||
|
|
||||||
|
// Example mod dependency using a file as dependency
|
||||||
|
// implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar")
|
||||||
|
|
||||||
|
// Example project dependency using a sister or child project:
|
||||||
|
// implementation project(":myproject")
|
||||||
|
|
||||||
|
// For more info:
|
||||||
|
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||||
|
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||||
|
}
|
||||||
|
|
||||||
|
// This block of code expands all declared replace properties in the specified resource targets.
|
||||||
|
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||||
|
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||||
|
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||||
|
tasks.withType(ProcessResources).configureEach {
|
||||||
|
var replaceProperties = [
|
||||||
|
minecraft_version : minecraft_version,
|
||||||
|
minecraft_version_range: minecraft_version_range,
|
||||||
|
neo_version : neo_version,
|
||||||
|
loader_version_range : loader_version_range,
|
||||||
|
mod_id : mod_id,
|
||||||
|
mod_name : mod_name,
|
||||||
|
mod_license : mod_license,
|
||||||
|
mod_version : mod_version,
|
||||||
|
]
|
||||||
|
inputs.properties replaceProperties
|
||||||
|
|
||||||
|
filesMatching(['META-INF/neoforge.mods.toml']) {
|
||||||
|
expand replaceProperties
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example configuration to allow publishing using the maven-publish plugin
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
register('mavenJava', MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
url "file://${project.projectDir}/repo"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType(JavaCompile).configureEach {
|
||||||
|
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||||
|
}
|
||||||
|
|
||||||
|
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
|
||||||
|
idea {
|
||||||
|
module {
|
||||||
|
downloadSources = true
|
||||||
|
downloadJavadoc = true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||||
|
org.gradle.jvmargs=-Xmx1G
|
||||||
|
org.gradle.daemon=true
|
||||||
|
org.gradle.parallel=true
|
||||||
|
org.gradle.caching=true
|
||||||
|
org.gradle.configuration-cache=true
|
||||||
|
|
||||||
|
#read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings
|
||||||
|
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
|
||||||
|
neogradle.subsystems.parchment.minecraftVersion=1.21.1
|
||||||
|
neogradle.subsystems.parchment.mappingsVersion=2024.11.17
|
||||||
|
# Environment Properties
|
||||||
|
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
|
||||||
|
# The Minecraft version must agree with the Neo version to get a valid artifact
|
||||||
|
minecraft_version=1.21.1
|
||||||
|
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||||
|
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||||
|
# as they do not follow standard versioning conventions.
|
||||||
|
minecraft_version_range=[1.21.1]
|
||||||
|
# The Neo version must agree with the Minecraft version to get a valid artifact
|
||||||
|
neo_version=21.1.228
|
||||||
|
# The loader version range can only use the major version of FML as bounds
|
||||||
|
loader_version_range=[1,)
|
||||||
|
|
||||||
|
## Mod Properties
|
||||||
|
|
||||||
|
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
|
||||||
|
# Must match the String constant located in the main mod class annotated with @Mod.
|
||||||
|
mod_id=ww1battle
|
||||||
|
# The human-readable display name for the mod.
|
||||||
|
mod_name=WW1 Battle
|
||||||
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
|
mod_license=All Rights Reserved
|
||||||
|
# The mod version. See https://semver.org/
|
||||||
|
mod_version=1.0.0
|
||||||
|
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||||
|
# This should match the base package used for the mod sources.
|
||||||
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
mod_group_id=com.ww1battle
|
||||||
Vendored
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# 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/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# 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 -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH="\\\"\\\""
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
Vendored
+94
@@ -0,0 +1,94 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@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 ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven { url = 'https://maven.neoforged.net/releases' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ww1battle.ww1battle;
|
||||||
|
|
||||||
|
import com.mojang.logging.LogUtils;
|
||||||
|
import net.neoforged.bus.api.IEventBus;
|
||||||
|
import net.neoforged.fml.common.Mod;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
@Mod(WW1BattleMod.MODID)
|
||||||
|
public class WW1BattleMod {
|
||||||
|
public static final String MODID = "ww1battle";
|
||||||
|
public static final Logger LOGGER = LogUtils.getLogger();
|
||||||
|
|
||||||
|
public WW1BattleMod(IEventBus modEventBus) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.ww1battle.ww1battle.client;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.Font;
|
||||||
|
import net.minecraft.client.gui.GuiGraphics;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import com.ww1battle.ww1battle.network.SyncBattleDataPacket;
|
||||||
|
|
||||||
|
public class BattleHUD {
|
||||||
|
public static void render(GuiGraphics guiGraphics, float partialTick) {
|
||||||
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
if (mc.options.hideGui) return;
|
||||||
|
|
||||||
|
int width = guiGraphics.guiWidth();
|
||||||
|
|
||||||
|
int maxScore = ClientBattleData.maxScore > 0 ? ClientBattleData.maxScore : 12000;
|
||||||
|
float redPct = Math.min(1.0f, (float) ClientBattleData.redScore / maxScore);
|
||||||
|
float bluePct = Math.min(1.0f, (float) ClientBattleData.blueScore / maxScore);
|
||||||
|
|
||||||
|
int barWidth = 240;
|
||||||
|
int barHeight = 8;
|
||||||
|
int x = (width - barWidth) / 2;
|
||||||
|
int y = 10;
|
||||||
|
|
||||||
|
// Draw background (dark gray)
|
||||||
|
guiGraphics.fill(x, y, x + barWidth, y + barHeight, 0xFF333333);
|
||||||
|
|
||||||
|
// Center line
|
||||||
|
int centerX = x + barWidth / 2;
|
||||||
|
|
||||||
|
// Draw blue from center towards left
|
||||||
|
int blueWidth = (int)((barWidth / 2) * bluePct);
|
||||||
|
guiGraphics.fill(centerX - blueWidth, y, centerX, y + barHeight, 0xFF5555FF);
|
||||||
|
|
||||||
|
// Draw red from center towards right
|
||||||
|
int redWidth = (int)((barWidth / 2) * redPct);
|
||||||
|
guiGraphics.fill(centerX, y, centerX + redWidth, y + barHeight, 0xFFFF5555);
|
||||||
|
|
||||||
|
// Center marker
|
||||||
|
guiGraphics.fill(centerX - 1, y - 2, centerX + 1, y + barHeight + 2, 0xFFFFFFFF);
|
||||||
|
|
||||||
|
// Draw points below the bar
|
||||||
|
Font font = mc.font;
|
||||||
|
int pointsCount = ClientBattleData.points.size();
|
||||||
|
if (pointsCount > 0) {
|
||||||
|
int spacing = 30;
|
||||||
|
int startX = centerX - ((pointsCount - 1) * spacing) / 2;
|
||||||
|
int pointY = y + barHeight + 5;
|
||||||
|
|
||||||
|
for (int i = 0; i < pointsCount; i++) {
|
||||||
|
SyncBattleDataPacket.SyncPointData cp = ClientBattleData.points.get(i);
|
||||||
|
int color = 0xFFAAAAAA; // Gray for neutral
|
||||||
|
if (cp.owningTeam().equals("red")) color = 0xFFFF5555;
|
||||||
|
if (cp.owningTeam().equals("blue")) color = 0xFF5555FF;
|
||||||
|
|
||||||
|
// Capture blinking
|
||||||
|
if (!cp.capturingTeam().equals("none")) {
|
||||||
|
long time = System.currentTimeMillis() % 1000;
|
||||||
|
if (time > 500) {
|
||||||
|
if (cp.capturingTeam().equals("red")) {
|
||||||
|
color = 0xFFFF5555; // Red blinking
|
||||||
|
} else if (cp.capturingTeam().equals("blue")) {
|
||||||
|
color = 0xFF5555FF; // Blue blinking
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String letter = cp.name().substring(0, 1).toUpperCase();
|
||||||
|
int textWidth = font.width(letter);
|
||||||
|
guiGraphics.drawString(font, letter, startX + (i * spacing) - textWidth / 2, pointY, color);
|
||||||
|
|
||||||
|
// Draw small diamond/box around letter
|
||||||
|
guiGraphics.fill(startX + (i * spacing) - 8, pointY - 2, startX + (i * spacing) + 8, pointY - 1, color);
|
||||||
|
guiGraphics.fill(startX + (i * spacing) - 8, pointY + 9, startX + (i * spacing) + 8, pointY + 10, color);
|
||||||
|
guiGraphics.fill(startX + (i * spacing) - 9, pointY - 1, startX + (i * spacing) - 8, pointY + 9, color);
|
||||||
|
guiGraphics.fill(startX + (i * spacing) + 8, pointY - 1, startX + (i * spacing) + 9, pointY + 9, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ww1battle.ww1battle.client;
|
||||||
|
|
||||||
|
import com.ww1battle.ww1battle.network.SyncBattleDataPacket;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ClientBattleData {
|
||||||
|
public static int redScore = 0;
|
||||||
|
public static int blueScore = 0;
|
||||||
|
public static int maxScore = 12000;
|
||||||
|
public static List<SyncBattleDataPacket.SyncPointData> points = new ArrayList<>();
|
||||||
|
|
||||||
|
public static void update(SyncBattleDataPacket packet) {
|
||||||
|
redScore = packet.redScore();
|
||||||
|
blueScore = packet.blueScore();
|
||||||
|
maxScore = packet.maxScore();
|
||||||
|
points = new ArrayList<>(packet.points());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.ww1battle.ww1battle.client;
|
||||||
|
|
||||||
|
import com.ww1battle.ww1battle.WW1BattleMod;
|
||||||
|
import net.neoforged.api.distmarker.Dist;
|
||||||
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
|
import net.neoforged.neoforge.client.event.RenderGuiEvent;
|
||||||
|
import net.neoforged.neoforge.client.event.RenderLevelStageEvent;
|
||||||
|
|
||||||
|
@EventBusSubscriber(modid = WW1BattleMod.MODID, bus = EventBusSubscriber.Bus.GAME, value = Dist.CLIENT)
|
||||||
|
public class ClientEvents {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onRenderGui(RenderGuiEvent.Post event) {
|
||||||
|
BattleHUD.render(event.getGuiGraphics(), event.getPartialTick().getGameTimeDeltaTicks());
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onRenderLevelStage(RenderLevelStageEvent event) {
|
||||||
|
if (event.getStage() == RenderLevelStageEvent.Stage.AFTER_TRANSLUCENT_BLOCKS) {
|
||||||
|
WorldRender.render(event.getPoseStack(), event.getCamera());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package com.ww1battle.ww1battle.client;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
|
import com.ww1battle.ww1battle.network.SyncBattleDataPacket;
|
||||||
|
import net.minecraft.client.Camera;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import org.joml.Matrix4f;
|
||||||
|
|
||||||
|
public class WorldRender {
|
||||||
|
public static void render(PoseStack poseStack, Camera camera) {
|
||||||
|
if (ClientBattleData.points.isEmpty()) return;
|
||||||
|
|
||||||
|
Vec3 cameraPos = camera.getPosition();
|
||||||
|
poseStack.pushPose();
|
||||||
|
poseStack.translate(-cameraPos.x, -cameraPos.y, -cameraPos.z);
|
||||||
|
|
||||||
|
VertexConsumer consumer = Minecraft.getInstance().renderBuffers().bufferSource().getBuffer(RenderType.lines());
|
||||||
|
|
||||||
|
for (SyncBattleDataPacket.SyncPointData cp : ClientBattleData.points) {
|
||||||
|
float r = cp.radius();
|
||||||
|
double cx = cp.pos().getX() + 0.5;
|
||||||
|
double cy = cp.pos().getY() + 0.1; // Slightly above ground
|
||||||
|
double cz = cp.pos().getZ() + 0.5;
|
||||||
|
|
||||||
|
int color = 0xFFAAAAAA; // Gray
|
||||||
|
if (cp.owningTeam().equals("red")) color = 0xFFFF5555;
|
||||||
|
if (cp.owningTeam().equals("blue")) color = 0xFF5555FF;
|
||||||
|
|
||||||
|
if (!cp.capturingTeam().equals("none")) {
|
||||||
|
long time = System.currentTimeMillis() % 1000;
|
||||||
|
if (time > 500) {
|
||||||
|
if (cp.capturingTeam().equals("red")) {
|
||||||
|
color = 0xFFFF5555; // Red blinking
|
||||||
|
} else if (cp.capturingTeam().equals("blue")) {
|
||||||
|
color = 0xFF5555FF; // Blue blinking
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int a = (color >> 24) & 0xFF;
|
||||||
|
int cr = (color >> 16) & 0xFF;
|
||||||
|
int cg = (color >> 8) & 0xFF;
|
||||||
|
int cb = color & 0xFF;
|
||||||
|
|
||||||
|
int segments = 64;
|
||||||
|
for (int i = 0; i < segments; i++) {
|
||||||
|
double angle1 = (i * 2 * Math.PI) / segments;
|
||||||
|
double angle2 = ((i + 1) * 2 * Math.PI) / segments;
|
||||||
|
|
||||||
|
float x1 = (float) (cx + r * Math.cos(angle1));
|
||||||
|
float z1 = (float) (cz + r * Math.sin(angle1));
|
||||||
|
float x2 = (float) (cx + r * Math.cos(angle2));
|
||||||
|
float z2 = (float) (cz + r * Math.sin(angle2));
|
||||||
|
|
||||||
|
consumer.addVertex(poseStack.last().pose(), x1, (float) cy, z1).setColor(cr, cg, cb, a).setNormal(poseStack.last(), 0.0F, 1.0F, 0.0F);
|
||||||
|
consumer.addVertex(poseStack.last().pose(), x2, (float) cy, z2).setColor(cr, cg, cb, a).setNormal(poseStack.last(), 0.0F, 1.0F, 0.0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw overhead marker
|
||||||
|
poseStack.pushPose();
|
||||||
|
poseStack.translate(cx, cp.pos().getY() + 7.0, cz); // High above ground
|
||||||
|
poseStack.mulPose(camera.rotation());
|
||||||
|
float scale = -0.05F;
|
||||||
|
poseStack.scale(scale, scale, scale);
|
||||||
|
|
||||||
|
Matrix4f matrix = poseStack.last().pose();
|
||||||
|
net.minecraft.client.renderer.MultiBufferSource.BufferSource bufferSource = Minecraft.getInstance().renderBuffers().bufferSource();
|
||||||
|
|
||||||
|
// Diamond background
|
||||||
|
VertexConsumer bgConsumer = bufferSource.getBuffer(RenderType.gui());
|
||||||
|
float s = 10.0f; // size of the diamond
|
||||||
|
bgConsumer.addVertex(matrix, 0, -s, 0).setColor(cr, cg, cb, 255);
|
||||||
|
bgConsumer.addVertex(matrix, -s, 0, 0).setColor(cr, cg, cb, 255);
|
||||||
|
bgConsumer.addVertex(matrix, 0, s, 0).setColor(cr, cg, cb, 255);
|
||||||
|
bgConsumer.addVertex(matrix, s, 0, 0).setColor(cr, cg, cb, 255);
|
||||||
|
|
||||||
|
// Letter
|
||||||
|
net.minecraft.client.gui.Font font = Minecraft.getInstance().font;
|
||||||
|
String letter = cp.name().substring(0, 1).toUpperCase();
|
||||||
|
float textWidth = font.width(letter);
|
||||||
|
float textX = -textWidth / 2.0f;
|
||||||
|
float textY = -font.lineHeight / 2.0f + 1;
|
||||||
|
font.drawInBatch(letter, textX, textY, 0xFFFFFFFF, false, matrix, bufferSource, net.minecraft.client.gui.Font.DisplayMode.NORMAL, 0, net.minecraft.client.renderer.LightTexture.FULL_BRIGHT);
|
||||||
|
|
||||||
|
poseStack.popPose();
|
||||||
|
}
|
||||||
|
|
||||||
|
Minecraft.getInstance().renderBuffers().bufferSource().endBatch();
|
||||||
|
poseStack.popPose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.ww1battle.ww1battle.commands;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.ww1battle.ww1battle.data.WW1SavedData;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.commands.Commands;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
|
public class BaseSpawnCommand {
|
||||||
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||||
|
dispatcher.register(Commands.literal("redteamspawn")
|
||||||
|
.requires(source -> source.hasPermission(2))
|
||||||
|
.then(Commands.literal("set").executes(context -> {
|
||||||
|
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||||
|
WW1SavedData data = WW1SavedData.get(player.serverLevel());
|
||||||
|
data.redTeamSpawn = player.blockPosition();
|
||||||
|
data.redTeamDimension = player.level().dimension();
|
||||||
|
data.setDirty();
|
||||||
|
context.getSource().sendSuccess(() -> Component.literal("Red team spawn set!"), true);
|
||||||
|
return 1;
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
|
||||||
|
dispatcher.register(Commands.literal("blueteamspawn")
|
||||||
|
.requires(source -> source.hasPermission(2))
|
||||||
|
.then(Commands.literal("set").executes(context -> {
|
||||||
|
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||||
|
WW1SavedData data = WW1SavedData.get(player.serverLevel());
|
||||||
|
data.blueTeamSpawn = player.blockPosition();
|
||||||
|
data.blueTeamDimension = player.level().dimension();
|
||||||
|
data.setDirty();
|
||||||
|
context.getSource().sendSuccess(() -> Component.literal("Blue team spawn set!"), true);
|
||||||
|
return 1;
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.ww1battle.ww1battle.commands;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
|
import com.ww1battle.ww1battle.data.WW1SavedData;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.commands.Commands;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
|
public class KitCommand {
|
||||||
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||||
|
dispatcher.register(Commands.literal("setkit")
|
||||||
|
.requires(source -> source.hasPermission(2))
|
||||||
|
.then(Commands.argument("team", StringArgumentType.word())
|
||||||
|
.executes(context -> {
|
||||||
|
String team = StringArgumentType.getString(context, "team");
|
||||||
|
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||||
|
WW1SavedData data = WW1SavedData.get(player.serverLevel());
|
||||||
|
|
||||||
|
ListTag inventoryTag = new ListTag();
|
||||||
|
player.getInventory().save(inventoryTag);
|
||||||
|
|
||||||
|
if (team.equalsIgnoreCase("red")) {
|
||||||
|
data.redKit = inventoryTag;
|
||||||
|
data.setDirty();
|
||||||
|
context.getSource().sendSuccess(() -> Component.literal("Red kit saved!"), true);
|
||||||
|
} else if (team.equalsIgnoreCase("blue")) {
|
||||||
|
data.blueKit = inventoryTag;
|
||||||
|
data.setDirty();
|
||||||
|
context.getSource().sendSuccess(() -> Component.literal("Blue kit saved!"), true);
|
||||||
|
} else {
|
||||||
|
context.getSource().sendFailure(Component.literal("Unknown team! Use 'red' or 'blue'."));
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.ww1battle.ww1battle.commands;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||||
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
|
import com.ww1battle.ww1battle.data.CapturePoint;
|
||||||
|
import com.ww1battle.ww1battle.data.WW1SavedData;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.commands.Commands;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
|
public class MarkCommand {
|
||||||
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||||
|
dispatcher.register(Commands.literal("createmark")
|
||||||
|
.requires(source -> source.hasPermission(2))
|
||||||
|
.then(Commands.argument("name", StringArgumentType.word())
|
||||||
|
.then(Commands.argument("radius", IntegerArgumentType.integer(1))
|
||||||
|
.executes(context -> {
|
||||||
|
String name = StringArgumentType.getString(context, "name");
|
||||||
|
int radius = IntegerArgumentType.getInteger(context, "radius");
|
||||||
|
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||||
|
WW1SavedData data = WW1SavedData.get(player.serverLevel());
|
||||||
|
|
||||||
|
data.points.put(name, new CapturePoint(name, player.blockPosition(), radius));
|
||||||
|
data.setDirty();
|
||||||
|
|
||||||
|
context.getSource().sendSuccess(() -> Component.literal("Capture point '" + name + "' created!"), true);
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.ww1battle.ww1battle.commands;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||||
|
import com.ww1battle.ww1battle.data.WW1SavedData;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.commands.Commands;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
|
||||||
|
public class MatchCommand {
|
||||||
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||||
|
dispatcher.register(Commands.literal("match")
|
||||||
|
.requires(source -> source.hasPermission(2))
|
||||||
|
.then(Commands.literal("skip")
|
||||||
|
.executes(context -> {
|
||||||
|
WW1SavedData data = WW1SavedData.get(context.getSource().getLevel());
|
||||||
|
WW1SavedData.MatchState nextState;
|
||||||
|
switch (data.state) {
|
||||||
|
case WAITING -> nextState = WW1SavedData.MatchState.TEAM_SELECTION;
|
||||||
|
case TEAM_SELECTION -> nextState = WW1SavedData.MatchState.BATTLE_START;
|
||||||
|
case BATTLE_START -> {
|
||||||
|
com.ww1battle.ww1battle.events.GameLogic.endMatch((net.minecraft.server.level.ServerLevel) context.getSource().getLevel(), "MATCH SKIPPED");
|
||||||
|
context.getSource().getServer().getPlayerList().broadcastSystemMessage(
|
||||||
|
Component.literal("Match state changed to: BATTLE_END"), false);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
case BATTLE_END -> {
|
||||||
|
data.resetGame();
|
||||||
|
nextState = WW1SavedData.MatchState.WAITING;
|
||||||
|
}
|
||||||
|
default -> nextState = WW1SavedData.MatchState.WAITING;
|
||||||
|
}
|
||||||
|
data.state = nextState;
|
||||||
|
data.setDirty();
|
||||||
|
context.getSource().getServer().getPlayerList().broadcastSystemMessage(
|
||||||
|
Component.literal("Match state changed to: " + nextState.name()), false);
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.then(Commands.literal("config")
|
||||||
|
.then(Commands.literal("max_score")
|
||||||
|
.then(Commands.argument("score", IntegerArgumentType.integer(1))
|
||||||
|
.executes(context -> {
|
||||||
|
int score = IntegerArgumentType.getInteger(context, "score");
|
||||||
|
WW1SavedData data = WW1SavedData.get(context.getSource().getLevel());
|
||||||
|
data.maxScore = score;
|
||||||
|
data.setDirty();
|
||||||
|
context.getSource().sendSuccess(() -> Component.literal("Max score set to " + score), true);
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.then(Commands.literal("capture_time")
|
||||||
|
.then(Commands.argument("seconds", IntegerArgumentType.integer(1))
|
||||||
|
.executes(context -> {
|
||||||
|
int seconds = IntegerArgumentType.getInteger(context, "seconds");
|
||||||
|
WW1SavedData data = WW1SavedData.get(context.getSource().getLevel());
|
||||||
|
data.captureTimeTicks = seconds * 20;
|
||||||
|
data.setDirty();
|
||||||
|
context.getSource().sendSuccess(() -> Component.literal("Capture time set to " + seconds + " seconds"), true);
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.ww1battle.ww1battle.commands;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||||
|
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||||
|
import com.ww1battle.ww1battle.data.WW1SavedData;
|
||||||
|
import net.minecraft.commands.CommandSourceStack;
|
||||||
|
import net.minecraft.commands.Commands;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
|
||||||
|
public class ZoneCommand {
|
||||||
|
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
|
||||||
|
dispatcher.register(Commands.literal("setzone")
|
||||||
|
.requires(source -> source.hasPermission(2))
|
||||||
|
.then(Commands.argument("team", StringArgumentType.word())
|
||||||
|
.then(Commands.argument("radius", IntegerArgumentType.integer(1))
|
||||||
|
.executes(context -> {
|
||||||
|
String team = StringArgumentType.getString(context, "team");
|
||||||
|
int radius = IntegerArgumentType.getInteger(context, "radius");
|
||||||
|
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||||
|
WW1SavedData data = WW1SavedData.get(player.serverLevel());
|
||||||
|
|
||||||
|
if (team.equalsIgnoreCase("red")) {
|
||||||
|
data.redZonePos = player.blockPosition();
|
||||||
|
data.redZoneRadius = radius;
|
||||||
|
data.setDirty();
|
||||||
|
context.getSource().sendSuccess(() -> Component.literal("Red team selection zone set!"), true);
|
||||||
|
} else if (team.equalsIgnoreCase("blue")) {
|
||||||
|
data.blueZonePos = player.blockPosition();
|
||||||
|
data.blueZoneRadius = radius;
|
||||||
|
data.setDirty();
|
||||||
|
context.getSource().sendSuccess(() -> Component.literal("Blue team selection zone set!"), true);
|
||||||
|
} else {
|
||||||
|
context.getSource().sendFailure(Component.literal("Unknown team! Use 'red' or 'blue'."));
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.ww1battle.ww1battle.data;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
|
||||||
|
public class CapturePoint {
|
||||||
|
public String name;
|
||||||
|
public BlockPos pos;
|
||||||
|
public int radius;
|
||||||
|
public int captureProgress; // -captureTimeTicks (red) to captureTimeTicks (blue)
|
||||||
|
public String owningTeam; // "none", "red", "blue"
|
||||||
|
public String capturingTeam; // "none", "red", "blue"
|
||||||
|
|
||||||
|
public CapturePoint(String name, BlockPos pos, int radius) {
|
||||||
|
this.name = name;
|
||||||
|
this.pos = pos;
|
||||||
|
this.radius = radius;
|
||||||
|
this.captureProgress = 0;
|
||||||
|
this.owningTeam = "none";
|
||||||
|
this.capturingTeam = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CapturePoint load(CompoundTag tag) {
|
||||||
|
CapturePoint cp = new CapturePoint(tag.getString("name"),
|
||||||
|
new BlockPos(tag.getInt("x"), tag.getInt("y"), tag.getInt("z")),
|
||||||
|
tag.getInt("radius"));
|
||||||
|
cp.captureProgress = tag.getInt("captureProgress");
|
||||||
|
cp.owningTeam = tag.getString("owningTeam");
|
||||||
|
if (tag.contains("capturingTeam")) {
|
||||||
|
cp.capturingTeam = tag.getString("capturingTeam");
|
||||||
|
} else {
|
||||||
|
cp.capturingTeam = "none";
|
||||||
|
}
|
||||||
|
return cp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompoundTag save(CompoundTag tag) {
|
||||||
|
tag.putString("name", name);
|
||||||
|
tag.putInt("x", pos.getX());
|
||||||
|
tag.putInt("y", pos.getY());
|
||||||
|
tag.putInt("z", pos.getZ());
|
||||||
|
tag.putInt("radius", radius);
|
||||||
|
tag.putInt("captureProgress", captureProgress);
|
||||||
|
tag.putString("owningTeam", owningTeam);
|
||||||
|
tag.putString("capturingTeam", capturingTeam);
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
package com.ww1battle.ww1battle.data;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.HolderLookup;
|
||||||
|
import net.minecraft.core.registries.Registries;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
|
import net.minecraft.nbt.Tag;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.level.saveddata.SavedData;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class WW1SavedData extends SavedData {
|
||||||
|
public BlockPos redTeamSpawn = null;
|
||||||
|
public ResourceKey<Level> redTeamDimension = null;
|
||||||
|
public BlockPos blueTeamSpawn = null;
|
||||||
|
public ResourceKey<Level> blueTeamDimension = null;
|
||||||
|
|
||||||
|
public BlockPos redZonePos = null;
|
||||||
|
public int redZoneRadius = 0;
|
||||||
|
public BlockPos blueZonePos = null;
|
||||||
|
public int blueZoneRadius = 0;
|
||||||
|
|
||||||
|
public ListTag redKit = new ListTag();
|
||||||
|
public ListTag blueKit = new ListTag();
|
||||||
|
|
||||||
|
public Map<String, CapturePoint> points = new HashMap<>();
|
||||||
|
|
||||||
|
public int redScore = 0;
|
||||||
|
public int blueScore = 0;
|
||||||
|
|
||||||
|
public enum MatchState {
|
||||||
|
WAITING, TEAM_SELECTION, BATTLE_START, BATTLE_END
|
||||||
|
}
|
||||||
|
|
||||||
|
public MatchState state = MatchState.WAITING;
|
||||||
|
public int maxScore = 12000;
|
||||||
|
public int captureTimeTicks = 1000;
|
||||||
|
|
||||||
|
public static final SavedData.Factory<WW1SavedData> FACTORY = new SavedData.Factory<>(WW1SavedData::new, WW1SavedData::load, null);
|
||||||
|
|
||||||
|
public WW1SavedData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WW1SavedData load(CompoundTag tag, HolderLookup.Provider provider) {
|
||||||
|
WW1SavedData data = new WW1SavedData();
|
||||||
|
if (tag.contains("redSpawnX")) {
|
||||||
|
data.redTeamSpawn = new BlockPos(tag.getInt("redSpawnX"), tag.getInt("redSpawnY"), tag.getInt("redSpawnZ"));
|
||||||
|
data.redTeamDimension = ResourceKey.create(Registries.DIMENSION, ResourceLocation.parse(tag.getString("redSpawnDim")));
|
||||||
|
}
|
||||||
|
if (tag.contains("blueSpawnX")) {
|
||||||
|
data.blueTeamSpawn = new BlockPos(tag.getInt("blueSpawnX"), tag.getInt("blueSpawnY"), tag.getInt("blueSpawnZ"));
|
||||||
|
data.blueTeamDimension = ResourceKey.create(Registries.DIMENSION, ResourceLocation.parse(tag.getString("blueSpawnDim")));
|
||||||
|
}
|
||||||
|
if (tag.contains("redZoneX")) {
|
||||||
|
data.redZonePos = new BlockPos(tag.getInt("redZoneX"), tag.getInt("redZoneY"), tag.getInt("redZoneZ"));
|
||||||
|
data.redZoneRadius = tag.getInt("redZoneRadius");
|
||||||
|
}
|
||||||
|
if (tag.contains("blueZoneX")) {
|
||||||
|
data.blueZonePos = new BlockPos(tag.getInt("blueZoneX"), tag.getInt("blueZoneY"), tag.getInt("blueZoneZ"));
|
||||||
|
data.blueZoneRadius = tag.getInt("blueZoneRadius");
|
||||||
|
}
|
||||||
|
if (tag.contains("redKit")) {
|
||||||
|
data.redKit = tag.getList("redKit", Tag.TAG_COMPOUND);
|
||||||
|
}
|
||||||
|
if (tag.contains("blueKit")) {
|
||||||
|
data.blueKit = tag.getList("blueKit", Tag.TAG_COMPOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
ListTag pointsTag = tag.getList("points", Tag.TAG_COMPOUND);
|
||||||
|
for (int i = 0; i < pointsTag.size(); i++) {
|
||||||
|
CapturePoint cp = CapturePoint.load(pointsTag.getCompound(i));
|
||||||
|
data.points.put(cp.name, cp);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.redScore = tag.getInt("redScore");
|
||||||
|
data.blueScore = tag.getInt("blueScore");
|
||||||
|
|
||||||
|
if (tag.contains("matchState")) {
|
||||||
|
data.state = MatchState.valueOf(tag.getString("matchState"));
|
||||||
|
}
|
||||||
|
if (tag.contains("maxScore")) {
|
||||||
|
data.maxScore = tag.getInt("maxScore");
|
||||||
|
}
|
||||||
|
if (tag.contains("captureTimeTicks")) {
|
||||||
|
data.captureTimeTicks = tag.getInt("captureTimeTicks");
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompoundTag save(CompoundTag tag, HolderLookup.Provider provider) {
|
||||||
|
if (redTeamSpawn != null && redTeamDimension != null) {
|
||||||
|
tag.putInt("redSpawnX", redTeamSpawn.getX());
|
||||||
|
tag.putInt("redSpawnY", redTeamSpawn.getY());
|
||||||
|
tag.putInt("redSpawnZ", redTeamSpawn.getZ());
|
||||||
|
tag.putString("redSpawnDim", redTeamDimension.location().toString());
|
||||||
|
}
|
||||||
|
if (blueTeamSpawn != null && blueTeamDimension != null) {
|
||||||
|
tag.putInt("blueSpawnX", blueTeamSpawn.getX());
|
||||||
|
tag.putInt("blueSpawnY", blueTeamSpawn.getY());
|
||||||
|
tag.putInt("blueSpawnZ", blueTeamSpawn.getZ());
|
||||||
|
tag.putString("blueSpawnDim", blueTeamDimension.location().toString());
|
||||||
|
}
|
||||||
|
if (redZonePos != null) {
|
||||||
|
tag.putInt("redZoneX", redZonePos.getX());
|
||||||
|
tag.putInt("redZoneY", redZonePos.getY());
|
||||||
|
tag.putInt("redZoneZ", redZonePos.getZ());
|
||||||
|
tag.putInt("redZoneRadius", redZoneRadius);
|
||||||
|
}
|
||||||
|
if (blueZonePos != null) {
|
||||||
|
tag.putInt("blueZoneX", blueZonePos.getX());
|
||||||
|
tag.putInt("blueZoneY", blueZonePos.getY());
|
||||||
|
tag.putInt("blueZoneZ", blueZonePos.getZ());
|
||||||
|
tag.putInt("blueZoneRadius", blueZoneRadius);
|
||||||
|
}
|
||||||
|
tag.put("redKit", redKit);
|
||||||
|
tag.put("blueKit", blueKit);
|
||||||
|
|
||||||
|
ListTag pointsTag = new ListTag();
|
||||||
|
for (CapturePoint cp : points.values()) {
|
||||||
|
pointsTag.add(cp.save(new CompoundTag()));
|
||||||
|
}
|
||||||
|
tag.put("points", pointsTag);
|
||||||
|
|
||||||
|
tag.putInt("redScore", redScore);
|
||||||
|
tag.putInt("blueScore", blueScore);
|
||||||
|
|
||||||
|
tag.putString("matchState", state.name());
|
||||||
|
tag.putInt("maxScore", maxScore);
|
||||||
|
tag.putInt("captureTimeTicks", captureTimeTicks);
|
||||||
|
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WW1SavedData get(ServerLevel level) {
|
||||||
|
return level.getServer().overworld().getDataStorage().computeIfAbsent(FACTORY, "ww1battle");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetGame() {
|
||||||
|
redScore = 0;
|
||||||
|
blueScore = 0;
|
||||||
|
for (CapturePoint cp : points.values()) {
|
||||||
|
cp.captureProgress = 0;
|
||||||
|
cp.owningTeam = "none";
|
||||||
|
cp.capturingTeam = "none";
|
||||||
|
}
|
||||||
|
state = MatchState.WAITING;
|
||||||
|
setDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,221 @@
|
|||||||
|
package com.ww1battle.ww1battle.events;
|
||||||
|
|
||||||
|
import com.ww1battle.ww1battle.WW1BattleMod;
|
||||||
|
import com.ww1battle.ww1battle.data.CapturePoint;
|
||||||
|
import com.ww1battle.ww1battle.data.WW1SavedData;
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import com.ww1battle.ww1battle.network.SyncBattleDataPacket;
|
||||||
|
import net.minecraft.nbt.ListTag;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundSetTitleTextPacket;
|
||||||
|
import net.minecraft.network.protocol.game.ClientboundSetTitlesAnimationPacket;
|
||||||
|
import net.minecraft.resources.ResourceKey;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import net.minecraft.world.scores.PlayerTeam;
|
||||||
|
import net.minecraft.world.scores.Scoreboard;
|
||||||
|
import net.minecraft.world.scores.Team;
|
||||||
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
|
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
|
||||||
|
import net.neoforged.neoforge.event.tick.LevelTickEvent;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@EventBusSubscriber(modid = WW1BattleMod.MODID, bus = EventBusSubscriber.Bus.GAME)
|
||||||
|
public class GameLogic {
|
||||||
|
|
||||||
|
private static int tickCounter = 0;
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onLevelTick(LevelTickEvent.Post event) {
|
||||||
|
if (!(event.getLevel() instanceof ServerLevel level)) return;
|
||||||
|
if (level.dimension() != Level.OVERWORLD) return;
|
||||||
|
|
||||||
|
WW1SavedData data = WW1SavedData.get(level);
|
||||||
|
tickCounter++;
|
||||||
|
|
||||||
|
// Process capture points
|
||||||
|
if (data.state == WW1SavedData.MatchState.BATTLE_START) {
|
||||||
|
for (CapturePoint cp : data.points.values()) {
|
||||||
|
List<ServerPlayer> players = level.getEntitiesOfClass(ServerPlayer.class,
|
||||||
|
new net.minecraft.world.phys.AABB(cp.pos).inflate(cp.radius));
|
||||||
|
|
||||||
|
int redCount = 0;
|
||||||
|
int blueCount = 0;
|
||||||
|
|
||||||
|
for (ServerPlayer player : players) {
|
||||||
|
if (getTeam(player).equals("red")) redCount++;
|
||||||
|
else if (getTeam(player).equals("blue")) blueCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (redCount > 0 && blueCount == 0) {
|
||||||
|
cp.captureProgress = Math.max(-data.captureTimeTicks, cp.captureProgress - 1);
|
||||||
|
cp.capturingTeam = "red";
|
||||||
|
data.setDirty();
|
||||||
|
} else if (blueCount > 0 && redCount == 0) {
|
||||||
|
cp.captureProgress = Math.min(data.captureTimeTicks, cp.captureProgress + 1);
|
||||||
|
cp.capturingTeam = "blue";
|
||||||
|
data.setDirty();
|
||||||
|
} else {
|
||||||
|
cp.capturingTeam = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cp.captureProgress <= -data.captureTimeTicks) {
|
||||||
|
cp.capturingTeam = "none";
|
||||||
|
if (!cp.owningTeam.equals("red")) {
|
||||||
|
cp.owningTeam = "red";
|
||||||
|
level.getServer().getPlayerList().broadcastSystemMessage(Component.literal("Point " + cp.name + " captured by RED!").withStyle(ChatFormatting.RED), false);
|
||||||
|
}
|
||||||
|
if (tickCounter % 20 == 0) {
|
||||||
|
data.redScore++;
|
||||||
|
data.setDirty();
|
||||||
|
}
|
||||||
|
} else if (cp.captureProgress >= data.captureTimeTicks) {
|
||||||
|
cp.capturingTeam = "none";
|
||||||
|
if (!cp.owningTeam.equals("blue")) {
|
||||||
|
cp.owningTeam = "blue";
|
||||||
|
level.getServer().getPlayerList().broadcastSystemMessage(Component.literal("Point " + cp.name + " captured by BLUE!").withStyle(ChatFormatting.BLUE), false);
|
||||||
|
}
|
||||||
|
if (tickCounter % 20 == 0) {
|
||||||
|
data.blueScore++;
|
||||||
|
data.setDirty();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cp.owningTeam = "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check Win Condition
|
||||||
|
if (data.redScore >= data.maxScore) {
|
||||||
|
endMatch(level, "RED");
|
||||||
|
} else if (data.blueScore >= data.maxScore) {
|
||||||
|
endMatch(level, "BLUE");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Action bar scores removed in favor of HUD
|
||||||
|
if (tickCounter % 10 == 0) {
|
||||||
|
List<SyncBattleDataPacket.SyncPointData> syncPoints = new java.util.ArrayList<>();
|
||||||
|
for (CapturePoint cp : data.points.values()) {
|
||||||
|
syncPoints.add(new SyncBattleDataPacket.SyncPointData(cp.name, cp.pos, cp.radius, cp.captureProgress, cp.owningTeam, cp.capturingTeam));
|
||||||
|
}
|
||||||
|
SyncBattleDataPacket packet = new SyncBattleDataPacket(data.redScore, data.blueScore, data.maxScore, syncPoints);
|
||||||
|
for (ServerPlayer player : level.getServer().getPlayerList().getPlayers()) {
|
||||||
|
net.neoforged.neoforge.network.PacketDistributor.sendToPlayer(player, packet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle Lobby Zones
|
||||||
|
if (data.state == WW1SavedData.MatchState.TEAM_SELECTION) {
|
||||||
|
ResourceKey<Level> lobbyKey = ResourceKey.create(net.minecraft.core.registries.Registries.DIMENSION, ResourceLocation.parse("ww1battle:lobby"));
|
||||||
|
ServerLevel lobbyLevel = level.getServer().getLevel(lobbyKey);
|
||||||
|
if (lobbyLevel != null) {
|
||||||
|
List<ServerPlayer> lobbyPlayers = new java.util.ArrayList<>(lobbyLevel.players());
|
||||||
|
for (ServerPlayer player : lobbyPlayers) {
|
||||||
|
if (data.redZonePos != null && player.blockPosition().distSqr(data.redZonePos) <= data.redZoneRadius * data.redZoneRadius) {
|
||||||
|
joinTeam(player, "red", data);
|
||||||
|
} else if (data.blueZonePos != null && player.blockPosition().distSqr(data.blueZonePos) <= data.blueZoneRadius * data.blueZoneRadius) {
|
||||||
|
joinTeam(player, "blue", data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void endMatch(ServerLevel level, String winner) {
|
||||||
|
WW1SavedData data = WW1SavedData.get(level);
|
||||||
|
Component winMsg = Component.literal(winner + " WINS!").withStyle(winner.equals("RED") ? ChatFormatting.RED : ChatFormatting.BLUE);
|
||||||
|
|
||||||
|
ResourceKey<Level> lobbyKey = ResourceKey.create(net.minecraft.core.registries.Registries.DIMENSION, ResourceLocation.parse("ww1battle:lobby"));
|
||||||
|
ServerLevel lobbyLevel = level.getServer().getLevel(lobbyKey);
|
||||||
|
|
||||||
|
for (ServerPlayer player : level.getServer().getPlayerList().getPlayers()) {
|
||||||
|
player.connection.send(new ClientboundSetTitlesAnimationPacket(10, 70, 20));
|
||||||
|
player.connection.send(new ClientboundSetTitleTextPacket(winMsg));
|
||||||
|
|
||||||
|
player.getInventory().clearContent();
|
||||||
|
setTeam(player, "white");
|
||||||
|
|
||||||
|
if (lobbyLevel != null) {
|
||||||
|
player.teleportTo(lobbyLevel, 0, -60, 0, 0, 0); // approx spawn
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.state = WW1SavedData.MatchState.BATTLE_END;
|
||||||
|
data.setDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void joinTeam(ServerPlayer player, String team, WW1SavedData data) {
|
||||||
|
setTeam(player, team);
|
||||||
|
player.getInventory().clearContent();
|
||||||
|
|
||||||
|
if (team.equals("red")) {
|
||||||
|
if (data.redTeamSpawn != null && data.redTeamDimension != null) {
|
||||||
|
ServerLevel targetLevel = player.server.getLevel(data.redTeamDimension);
|
||||||
|
if (targetLevel != null) {
|
||||||
|
player.teleportTo(targetLevel, data.redTeamSpawn.getX(), data.redTeamSpawn.getY(), data.redTeamSpawn.getZ(), player.getYRot(), player.getXRot());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.getInventory().load(data.redKit);
|
||||||
|
} else if (team.equals("blue")) {
|
||||||
|
if (data.blueTeamSpawn != null && data.blueTeamDimension != null) {
|
||||||
|
ServerLevel targetLevel = player.server.getLevel(data.blueTeamDimension);
|
||||||
|
if (targetLevel != null) {
|
||||||
|
player.teleportTo(targetLevel, data.blueTeamSpawn.getX(), data.blueTeamSpawn.getY(), data.blueTeamSpawn.getZ(), player.getYRot(), player.getXRot());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
player.getInventory().load(data.blueKit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getTeam(Player player) {
|
||||||
|
if (player.getTeam() != null) {
|
||||||
|
return player.getTeam().getName();
|
||||||
|
}
|
||||||
|
return "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setTeam(ServerPlayer player, String teamName) {
|
||||||
|
Scoreboard scoreboard = player.getScoreboard();
|
||||||
|
PlayerTeam team = scoreboard.getPlayerTeam(teamName);
|
||||||
|
if (team == null) {
|
||||||
|
team = scoreboard.addPlayerTeam(teamName);
|
||||||
|
if (teamName.equals("red")) team.setColor(ChatFormatting.RED);
|
||||||
|
if (teamName.equals("blue")) team.setColor(ChatFormatting.BLUE);
|
||||||
|
if (teamName.equals("white")) team.setColor(ChatFormatting.WHITE);
|
||||||
|
}
|
||||||
|
scoreboard.addPlayerToTeam(player.getScoreboardName(), team);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onPlayerRespawn(PlayerEvent.PlayerRespawnEvent event) {
|
||||||
|
if (event.getEntity() instanceof ServerPlayer player) {
|
||||||
|
WW1SavedData data = WW1SavedData.get(player.serverLevel());
|
||||||
|
String team = getTeam(player);
|
||||||
|
if (team.equals("red")) {
|
||||||
|
player.getInventory().clearContent();
|
||||||
|
player.getInventory().load(data.redKit);
|
||||||
|
if (data.redTeamSpawn != null && data.redTeamDimension != null) {
|
||||||
|
ServerLevel targetLevel = player.server.getLevel(data.redTeamDimension);
|
||||||
|
if (targetLevel != null) {
|
||||||
|
player.teleportTo(targetLevel, data.redTeamSpawn.getX(), data.redTeamSpawn.getY(), data.redTeamSpawn.getZ(), player.getYRot(), player.getXRot());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (team.equals("blue")) {
|
||||||
|
player.getInventory().clearContent();
|
||||||
|
player.getInventory().load(data.blueKit);
|
||||||
|
if (data.blueTeamSpawn != null && data.blueTeamDimension != null) {
|
||||||
|
ServerLevel targetLevel = player.server.getLevel(data.blueTeamDimension);
|
||||||
|
if (targetLevel != null) {
|
||||||
|
player.teleportTo(targetLevel, data.blueTeamSpawn.getX(), data.blueTeamSpawn.getY(), data.blueTeamSpawn.getZ(), player.getYRot(), player.getXRot());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.ww1battle.ww1battle.events;
|
||||||
|
|
||||||
|
import com.ww1battle.ww1battle.WW1BattleMod;
|
||||||
|
import com.ww1battle.ww1battle.commands.BaseSpawnCommand;
|
||||||
|
import com.ww1battle.ww1battle.commands.KitCommand;
|
||||||
|
import com.ww1battle.ww1battle.commands.MatchCommand;
|
||||||
|
import com.ww1battle.ww1battle.commands.MarkCommand;
|
||||||
|
import com.ww1battle.ww1battle.commands.ZoneCommand;
|
||||||
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
|
import net.neoforged.neoforge.event.RegisterCommandsEvent;
|
||||||
|
|
||||||
|
@EventBusSubscriber(modid = WW1BattleMod.MODID, bus = EventBusSubscriber.Bus.GAME)
|
||||||
|
public class ModEvents {
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onCommandsRegister(RegisterCommandsEvent event) {
|
||||||
|
BaseSpawnCommand.register(event.getDispatcher());
|
||||||
|
MarkCommand.register(event.getDispatcher());
|
||||||
|
KitCommand.register(event.getDispatcher());
|
||||||
|
MatchCommand.register(event.getDispatcher());
|
||||||
|
ZoneCommand.register(event.getDispatcher());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.ww1battle.ww1battle.network;
|
||||||
|
|
||||||
|
import com.ww1battle.ww1battle.WW1BattleMod;
|
||||||
|
import com.ww1battle.ww1battle.client.ClientBattleData;
|
||||||
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
|
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
|
||||||
|
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||||
|
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
|
||||||
|
|
||||||
|
@EventBusSubscriber(modid = WW1BattleMod.MODID, bus = EventBusSubscriber.Bus.MOD)
|
||||||
|
public class NetworkHandler {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void register(RegisterPayloadHandlersEvent event) {
|
||||||
|
final PayloadRegistrar registrar = event.registrar(WW1BattleMod.MODID);
|
||||||
|
registrar.playToClient(
|
||||||
|
SyncBattleDataPacket.TYPE,
|
||||||
|
SyncBattleDataPacket.STREAM_CODEC,
|
||||||
|
NetworkHandler::handleSyncBattleData
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void handleSyncBattleData(SyncBattleDataPacket packet, IPayloadContext context) {
|
||||||
|
context.enqueueWork(() -> {
|
||||||
|
ClientBattleData.update(packet);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.ww1battle.ww1battle.network;
|
||||||
|
|
||||||
|
import com.ww1battle.ww1battle.WW1BattleMod;
|
||||||
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
|
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public record SyncBattleDataPacket(int redScore, int blueScore, int maxScore, List<SyncPointData> points) implements CustomPacketPayload {
|
||||||
|
public static final Type<SyncBattleDataPacket> TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath(WW1BattleMod.MODID, "sync_battle_data"));
|
||||||
|
|
||||||
|
public static final StreamCodec<FriendlyByteBuf, SyncBattleDataPacket> STREAM_CODEC = StreamCodec.ofMember(
|
||||||
|
SyncBattleDataPacket::write,
|
||||||
|
SyncBattleDataPacket::new
|
||||||
|
);
|
||||||
|
|
||||||
|
public SyncBattleDataPacket(FriendlyByteBuf buf) {
|
||||||
|
this(buf.readInt(), buf.readInt(), buf.readInt(), readPoints(buf));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<SyncPointData> readPoints(FriendlyByteBuf buf) {
|
||||||
|
int size = buf.readInt();
|
||||||
|
List<SyncPointData> list = new ArrayList<>();
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
list.add(new SyncPointData(buf.readUtf(), buf.readBlockPos(), buf.readInt(), buf.readInt(), buf.readUtf(), buf.readUtf()));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void write(FriendlyByteBuf buf) {
|
||||||
|
buf.writeInt(redScore);
|
||||||
|
buf.writeInt(blueScore);
|
||||||
|
buf.writeInt(maxScore);
|
||||||
|
buf.writeInt(points.size());
|
||||||
|
for (SyncPointData point : points) {
|
||||||
|
buf.writeUtf(point.name());
|
||||||
|
buf.writeBlockPos(point.pos());
|
||||||
|
buf.writeInt(point.radius());
|
||||||
|
buf.writeInt(point.captureProgress());
|
||||||
|
buf.writeUtf(point.owningTeam());
|
||||||
|
buf.writeUtf(point.capturingTeam());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<? extends CustomPacketPayload> type() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public record SyncPointData(String name, BlockPos pos, int radius, int captureProgress, String owningTeam, String capturingTeam) {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
# This is an example neoforge.mods.toml file. It contains the data relating to the loading mods.
|
||||||
|
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
|
||||||
|
# The overall format is standard TOML format, v0.5.0.
|
||||||
|
# Note that there are a couple of TOML lists in this file.
|
||||||
|
# Find more information on toml format here: https://github.com/toml-lang/toml
|
||||||
|
|
||||||
|
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||||
|
modLoader="javafml" #mandatory
|
||||||
|
|
||||||
|
# A version range to match for said mod loader - for regular FML @Mod it will be the FML version. This is currently 2.
|
||||||
|
loaderVersion="${loader_version_range}" #mandatory
|
||||||
|
|
||||||
|
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||||
|
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||||
|
license="${mod_license}"
|
||||||
|
|
||||||
|
# A URL to refer people to when problems occur with this mod
|
||||||
|
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
|
||||||
|
|
||||||
|
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||||
|
[[mods]] #mandatory
|
||||||
|
|
||||||
|
# The modid of the mod
|
||||||
|
modId="${mod_id}" #mandatory
|
||||||
|
|
||||||
|
# The version number of the mod
|
||||||
|
version="${mod_version}" #mandatory
|
||||||
|
|
||||||
|
# A display name for the mod
|
||||||
|
displayName="${mod_name}" #mandatory
|
||||||
|
|
||||||
|
# A URL to query for updates for this mod. See the JSON update specification https://docs.neoforged.net/docs/misc/updatechecker/
|
||||||
|
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
||||||
|
|
||||||
|
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||||
|
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
|
||||||
|
|
||||||
|
# A file name (in the root of the mod JAR) containing a logo for display
|
||||||
|
#logoFile="examplemod.png" #optional
|
||||||
|
|
||||||
|
# A text field displayed in the mod UI
|
||||||
|
#credits="" #optional
|
||||||
|
|
||||||
|
# The authors of the mod, displayed in the mod UI (optional)
|
||||||
|
#authors=""
|
||||||
|
|
||||||
|
# The description text for the mod (multi line!) (#mandatory)
|
||||||
|
description='''
|
||||||
|
Example mod description.
|
||||||
|
'''
|
||||||
|
|
||||||
|
# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded.
|
||||||
|
#[[mixins]]
|
||||||
|
#config="${mod_id}.mixins.json"
|
||||||
|
|
||||||
|
# The [[accessTransformers]] block allows you to declare where your AT file is.
|
||||||
|
# If this block is omitted, a fallback attempt will be made to load an AT from META-INF/accesstransformer.cfg
|
||||||
|
#[[accessTransformers]]
|
||||||
|
#file="META-INF/accesstransformer.cfg"
|
||||||
|
|
||||||
|
# The coremods config file path is not configurable and is always loaded from META-INF/coremods.json
|
||||||
|
|
||||||
|
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||||
|
[[dependencies.${mod_id}]] #optional
|
||||||
|
# the modid of the dependency
|
||||||
|
modId="neoforge" #mandatory
|
||||||
|
# The type of the dependency. Can be one of "required", "optional", "incompatible" or "discouraged" (case insensitive).
|
||||||
|
# 'required' requires the mod to exist, 'optional' does not
|
||||||
|
# 'incompatible' will prevent the game from loading when the mod exists, and 'discouraged' will show a warning
|
||||||
|
type="required" #mandatory
|
||||||
|
# Optional field describing why the dependency is required or why it is incompatible
|
||||||
|
# reason="..."
|
||||||
|
# The version range of the dependency
|
||||||
|
versionRange="[${neo_version},)" #mandatory
|
||||||
|
# An ordering relationship for the dependency.
|
||||||
|
# BEFORE - This mod is loaded BEFORE the dependency
|
||||||
|
# AFTER - This mod is loaded AFTER the dependency
|
||||||
|
ordering="NONE"
|
||||||
|
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
|
||||||
|
side="BOTH"
|
||||||
|
|
||||||
|
# Here's another dependency
|
||||||
|
[[dependencies.${mod_id}]]
|
||||||
|
modId="minecraft"
|
||||||
|
type="required"
|
||||||
|
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||||
|
versionRange="${minecraft_version_range}"
|
||||||
|
ordering="NONE"
|
||||||
|
side="BOTH"
|
||||||
|
|
||||||
|
# Features are specific properties of the game environment, that you may want to declare you require. This example declares
|
||||||
|
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
|
||||||
|
# stop your mod loading on the server for example.
|
||||||
|
#[features.${mod_id}]
|
||||||
|
#openGLVersion="[3.2,)"
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"itemGroup.examplemod": "Example Mod Tab",
|
||||||
|
"block.examplemod.example_block": "Example Block",
|
||||||
|
"item.examplemod.example_item": "Example Item",
|
||||||
|
|
||||||
|
"examplemod.configuration.title": "Example Mod Configs",
|
||||||
|
"examplemod.configuration.section.examplemod.common.toml": "Example Mod Configs",
|
||||||
|
"examplemod.configuration.section.examplemod.common.toml.title": "Example Mod Configs",
|
||||||
|
"examplemod.configuration.items": "Item List",
|
||||||
|
"examplemod.configuration.logDirtBlock": "Log Dirt Block",
|
||||||
|
"examplemod.configuration.magicNumberIntroduction": "Magic Number Text",
|
||||||
|
"examplemod.configuration.magicNumber": "Magic Number"
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"type": "ww1battle:lobby",
|
||||||
|
"generator": {
|
||||||
|
"type": "minecraft:flat",
|
||||||
|
"settings": {
|
||||||
|
"layers": [
|
||||||
|
{
|
||||||
|
"block": "minecraft:bedrock",
|
||||||
|
"height": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"biome": "minecraft:the_void"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"ultrawarm": false,
|
||||||
|
"natural": false,
|
||||||
|
"coordinate_scale": 1.0,
|
||||||
|
"has_skylight": true,
|
||||||
|
"has_ceiling": false,
|
||||||
|
"ambient_light": 0.0,
|
||||||
|
"fixed_time": 6000,
|
||||||
|
"monster_spawn_light_level": 0,
|
||||||
|
"monster_spawn_block_light_limit": 0,
|
||||||
|
"piglin_safe": false,
|
||||||
|
"bed_works": false,
|
||||||
|
"respawn_anchor_works": false,
|
||||||
|
"has_raids": false,
|
||||||
|
"logical_height": 384,
|
||||||
|
"min_y": -64,
|
||||||
|
"height": 384,
|
||||||
|
"infiniburn": "#minecraft:infiniburn_overworld",
|
||||||
|
"effects": "minecraft:overworld"
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"pack": {
|
||||||
|
"description": "ww1battle resources",
|
||||||
|
"pack_format": 34
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user