Skip to content

Commit 3617fce

Browse files
committed
Squashed 'pvp/' content from commit 0ac087ffe
git-subtree-dir: pvp git-subtree-split: 0ac087ffe11cff3fece1637db92a373e2fde2484
0 parents  commit 3617fce

476 files changed

Lines changed: 45558 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Polyp
2+
3+
Configurable PvP mechanics for [Minestom](https://minestom.net/), built for mixed-version servers: modern (1.21.x)
4+
and legacy (1.8, via ViaVersion/ViaBackwards/ViaRewind) clients play the same 1.8-style combat on one
5+
modern server, with the mechanics themselves tunable per scope down to individual knockback constants.
6+
7+
## What's in the box
8+
9+
- **Combat systems** — attack, damage, knockback, blocking, attributes/enchants, projectiles (bow, snowball, egg,
10+
pearl, splash potion, fishing rod, fireball), explosions/TNT, hunger and natural regen, consumables, death handling.
11+
Every system installs independently and reads its tuning from a profile.
12+
- **Profiles** — a `MechanicsProfile` bundles per-system configs and resolves per player → world → instance → global,
13+
so one server can run different mechanics per arena, kit, or player.
14+
- **Presets**`Vanilla18` (source-accurate 1.8 baseline), plus measured recreations of live servers in
15+
`io.github.term4.polyp.presets`: `Mmc18` (MineMenClub) and `Hypixel`, reverse-engineered from packet
16+
captures. `Preset.MMC18.profile()` is a working server setup.
17+
- **Cross-version compat** (`Compat18`) — makes a modern client behave like 1.8: attack-box stamping, sword-block
18+
pose, throw-swing suppression, bare-fist swing fill, elytra/offhand/sprint/pose/placement restrictions, 1.8 eye
19+
heights and hitboxes. Legacy clients get wire-accurate 1.8 velocity and a set of client-fix packets.
20+
- **TPS-independent** — combat windows and physics scale with the configured tick rate.
21+
22+
## Quick start
23+
24+
```java
25+
Polyp polyp = Polyp.getInstance();
26+
polyp.init();
27+
28+
polyp.profiles().setGlobal(Preset.MMC18.profile().toBuilder()
29+
.set(MechanicsKeys.COMPAT, Compat18.config()) // 1.8 behavior for modern clients
30+
.set(MechanicsKeys.FIXES, Fixes18.config()) // legacy-client wire fixes
31+
.build());
32+
33+
AttackSystem.install(polyp);
34+
DamageSystem.install(polyp);
35+
KnockbackSystem.install(polyp);
36+
ProjectileSystem.install(polyp);
37+
// ...each system is optional; see test/ExampleServer.java for a full setup
38+
```
39+
40+
Requires the published `net.minestom:minestom` artifact (see `minestomVersion` in the build) — no Minestom fork.
41+
42+
## Status
43+
44+
Pre-release. APIs move; presets are updated as captures refine the measured values.

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v6
12+
13+
- name: Set up Java
14+
uses: actions/setup-java@v5
15+
with:
16+
distribution: temurin
17+
java-version: 25
18+
19+
- name: Set up Gradle
20+
uses: gradle/actions/setup-gradle@v5
21+
22+
- name: Add execute permissions for gradlew
23+
run: chmod +x gradlew
24+
25+
- name: Build with Gradle
26+
run: ./gradlew build

.github/workflows/publish.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
13+
steps:
14+
- uses: actions/checkout@v6
15+
16+
- name: Set up Java
17+
uses: actions/setup-java@v5
18+
with:
19+
distribution: temurin
20+
java-version: 25
21+
22+
- name: Set up Gradle
23+
uses: gradle/actions/setup-gradle@v5
24+
25+
- name: Add execute permissions for gradlew
26+
run: chmod +x gradlew
27+
28+
- name: Build
29+
run: ./gradlew build
30+
31+
- name: Publish to Maven Central
32+
run: ./gradlew publishToMavenCentral --no-configuration-cache
33+
env:
34+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
35+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
36+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
37+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
38+
39+
- name: Upload JARs to Release
40+
run: |
41+
gh release upload ${{ github.event.release.tag_name }} \
42+
build/libs/*.jar \
43+
--clobber
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.gradle
2+
build/
3+
!gradle/wrapper/gradle-wrapper.jar
4+
!**/src/main/**/build/
5+
!**/src/test/**/build/
6+
.kotlin
7+
8+
### IntelliJ IDEA ###
9+
.idea/
10+
*.iws
11+
*.iml
12+
*.ipr
13+
out/
14+
!**/src/main/**/out/
15+
!**/src/test/**/out/
16+
17+
### Eclipse ###
18+
.apt_generated
19+
.classpath
20+
.factorypath
21+
.project
22+
.settings
23+
.springBeans
24+
.sts4-cache
25+
bin/
26+
!**/src/main/**/bin/
27+
!**/src/test/**/bin/
28+
29+
### NetBeans ###
30+
/nbproject/private/
31+
/nbbuild/
32+
/dist/
33+
/nbdist/
34+
/.nb-gradle/
35+
36+
### VS Code ###
37+
.vscode/
38+
39+
### Mac OS ###
40+
.DS_Store
41+
42+
### Markdown (scratch docs / session handoffs; already-tracked .md stay tracked) ###
43+
*.md

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Term4
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

artifact_src/ExplosionPacket.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package net.minestom.server.network.packet.server.play;
2+
3+
import net.minestom.server.coordinate.Point;
4+
import net.minestom.server.network.NetworkBuffer;
5+
import net.minestom.server.network.NetworkBufferTemplate;
6+
import net.minestom.server.network.packet.server.ServerPacket;
7+
import net.minestom.server.particle.Particle;
8+
import net.minestom.server.sound.SoundEvent;
9+
import net.minestom.server.utils.WeightedList;
10+
import org.jetbrains.annotations.Nullable;
11+
12+
import static net.minestom.server.network.NetworkBuffer.VECTOR3D;
13+
14+
public record ExplosionPacket(
15+
Point center, float radius, int blockCount,
16+
@Nullable Point playerKnockback,
17+
Particle particle, SoundEvent sound,
18+
WeightedList<BlockParticleInfo> blockParticles
19+
) implements ServerPacket.Play {
20+
public static final NetworkBuffer.Type<ExplosionPacket> SERIALIZER = NetworkBufferTemplate.template(
21+
VECTOR3D, ExplosionPacket::center,
22+
NetworkBuffer.FLOAT, ExplosionPacket::radius,
23+
NetworkBuffer.INT, ExplosionPacket::blockCount,
24+
VECTOR3D.optional(), ExplosionPacket::playerKnockback,
25+
Particle.NETWORK_TYPE, ExplosionPacket::particle,
26+
SoundEvent.NETWORK_TYPE, ExplosionPacket::sound,
27+
WeightedList.networkType(BlockParticleInfo.SERIALIZER), ExplosionPacket::blockParticles,
28+
ExplosionPacket::new);
29+
30+
public record BlockParticleInfo(Particle particle, float scaling, float speed) {
31+
public static final NetworkBuffer.Type<BlockParticleInfo> SERIALIZER = NetworkBufferTemplate.template(
32+
Particle.NETWORK_TYPE, BlockParticleInfo::particle,
33+
NetworkBuffer.FLOAT, BlockParticleInfo::scaling,
34+
NetworkBuffer.FLOAT, BlockParticleInfo::speed,
35+
BlockParticleInfo::new);
36+
}
37+
}

build.gradle.kts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
plugins {
2+
`java-library`
3+
id("com.vanniktech.maven.publish") version "0.36.0"
4+
}
5+
6+
description = "A library for Minestom 1.8 mechanics"
7+
group = "io.github.term4"
8+
version = "0.2.0"
9+
java.toolchain.languageVersion = JavaLanguageVersion.of(25)
10+
11+
mavenPublishing {
12+
coordinates(group.toString(), "polyp", version.toString())
13+
publishToMavenCentral()
14+
// sign only when keys are configured (release env); keyless dev machines can still publishToMavenLocal
15+
if (providers.gradleProperty("signingInMemoryKey").isPresent || providers.gradleProperty("signing.keyId").isPresent) {
16+
signAllPublications()
17+
}
18+
19+
pom {
20+
name = "polyp"
21+
description = project.description
22+
url = "https://github.com/Term4/Polyp"
23+
24+
licenses {
25+
license {
26+
name = "MIT License"
27+
url = "https://opensource.org/licenses/MIT"
28+
distribution = "repo"
29+
}
30+
}
31+
32+
developers {
33+
developer {
34+
name = "Term4"
35+
id = "Term4"
36+
email = "gptkc2003@gmail.com"
37+
url = "https://github.com/Term4"
38+
}
39+
}
40+
41+
scm {
42+
url = "https://github.com/Term4/Polyp"
43+
connection = "scm:git:git://github.com/Term4/Polyp.git"
44+
developerConnection = "scm:git:ssh://git@github.com/Term4/Polyp.git"
45+
}
46+
}
47+
}
48+
49+
repositories {
50+
mavenCentral()
51+
maven("https://jitpack.io")
52+
}
53+
54+
dependencies {
55+
compileOnly(project(":codegen"))
56+
annotationProcessor(project(":codegen"))
57+
val minestomVersion = "2026.07.12-26.2"
58+
val slf4jVersion = "2.0.18"
59+
val junitVersion = "6.0.3"
60+
61+
compileOnly("net.minestom:minestom:$minestomVersion")
62+
// SLF4J facade only; a Minestom runtime always provides the api + a binding, so compileOnly (like Minestom). Never ship a binding.
63+
compileOnly("org.slf4j:slf4j-api:$slf4jVersion")
64+
65+
// Unit testing
66+
testImplementation("net.minestom:minestom:$minestomVersion")
67+
// headless server harness (Env/@EnvTest) for entity-backed golden tests; test-only, never shipped
68+
testImplementation("net.minestom:testing:$minestomVersion")
69+
testImplementation("org.tinylog:tinylog-api:2.8.0-M1")
70+
testImplementation("org.tinylog:tinylog-impl:2.8.0-M1")
71+
testImplementation("org.tinylog:slf4j-tinylog:2.8.0-M1")
72+
73+
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
74+
testImplementation("org.junit.jupiter:junit-jupiter-params:$junitVersion")
75+
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
76+
testRuntimeOnly("org.junit.platform:junit-platform-launcher:$junitVersion")
77+
}
78+
79+
tasks.test {
80+
useJUnitPlatform()
81+
// synchronous player spawns + relaxed thread asserts (like Minestom's Env); must be set before ServerFlag loads
82+
systemProperty("minestom.inside-test", "true")
83+
}

codegen/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
plugins {
2+
`java-library`
3+
}
4+
5+
java.toolchain.languageVersion = JavaLanguageVersion.of(25)

0 commit comments

Comments
 (0)