Skip to content

Commit 0414769

Browse files
author
LPMC Dev
committed
resolve conflicts
2 parents abcb506 + 4b70109 commit 0414769

File tree

197 files changed

+109726
-6694
lines changed

Some content is hidden

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

197 files changed

+109726
-6694
lines changed

.github/workflows/JavaDoc.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build & Deploy Javadoc
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pages: write
15+
id-token: write
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v5
20+
21+
- name: Make gradlew executable
22+
run: chmod +x ./gradlew
23+
24+
- name: Set up JDK 21
25+
uses: actions/setup-java@v3
26+
with:
27+
distribution: temurin
28+
java-version: '21'
29+
30+
- name: Build Javadoc
31+
run: ./gradlew javadoc
32+
33+
- name: Configure GitHub Pages
34+
uses: actions/configure-pages@v5
35+
36+
- name: Upload Javadoc artifact
37+
uses: actions/upload-pages-artifact@v4
38+
with:
39+
path: build/docs/javadoc
40+
41+
deploy:
42+
needs: build
43+
runs-on: ubuntu-latest
44+
permissions:
45+
contents: write
46+
pages: write
47+
id-token: write
48+
49+
environment:
50+
name: github-pages
51+
52+
steps:
53+
- name: Deploy to GitHub Pages
54+
uses: actions/deploy-pages@v4

README.md

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515

1616
<p align="center">
1717
<img alt="Version" src="https://img.shields.io/badge/version-2.0.0-blue.svg?cacheSeconds=2592000" />
18-
<a href="https://www.minecraft.net/en-us/article/minecraft-1-21-100-bedrock-changelog">
19-
<img alt="Minecraft" src="https://img.shields.io/badge/minecraft-v1.21.100%20(Bedrock)-56383E" />
18+
<a href="https://www.minecraft.net/en-us/article/the-copper-age---minecraft--bedrock-edition-1-21-111-changelog">
19+
<img alt="Minecraft" src="https://img.shields.io/badge/minecraft-v1.21.111%20(Bedrock)-56383E" />
2020
</a>
2121
<a href="https://github.com/Mojang/bedrock-protocol-docs">
22-
<img alt="Protocol" src="https://img.shields.io/badge/protocol-827-blue" />
22+
<img alt="Protocol" src="https://img.shields.io/badge/protocol-844-blue" />
2323
</a>
2424
<a href="https://github.com/PowerNukkitX/PowerNukkitX/actions?query=branch%3Amaster+is%3Asuccess" target="_blank">
2525
<img alt="Action" src="https://img.shields.io/badge/action-all%20builds-FF9B21" />
@@ -58,30 +58,18 @@
5858
- 🪴 **Terra Generator**
5959
- ✏️ **Full Vanilla Command Support**
6060
- 🗃️ **Full Item, Block and Container Support**
61+
- 💖 **Most vanilla like third party server software**
6162
- 🗿 **More features to discover...**
6263

6364
## Install
6465

6566
1. Make sure you have `JDK21` installed, if not [download from here](https://www.graalvm.org/downloads)
66-
2. Download the [`PowerNukkitX-Run.zip`](https://github.com/PowerNukkitX/PowerNukkitX/releases/download/snapshot/powernukkitx-run.zip)
67-
3. Unzip `PowerNukkitX-Run.zip` to the directory you want.
68-
4. Set Java environment variables or unzip JDK to the same directory as the previous step.
67+
2. Download the [`powernukkitx.jar`](https://github.com/PowerNukkitX/PowerNukkitX/releases/download/snapshot/powernukkitx.jar)
68+
3. Start the server
6969

70-
You want to use PowerNukkitX without the CLI?
71-
72-
1. Make sure you have `JDK21` installed, if not [download from here](https://www.graalvm.org/downloads)
73-
2. Download the [`powernukkitx-shaded.jar`](https://github.com/PowerNukkitX/PowerNukkitX/releases/download/snapshot/powernukkitx-shaded.jar)
74-
75-
## Usage
76-
77-
Start PowerNukkitX when using the CLI
78-
```sh
79-
java -jar cli.jar
80-
```
81-
82-
Starting PowerNukkitX when using the shaded jar (Without CLI)
70+
Starting PowerNukkitX
8371
```sh
84-
java -jar --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED .\powernukkitx-shaded.jar
72+
java -Dfile.encoding=UTF-8 -Djansi.passthrough=true -Dterminal.ansi=true -XX:+UseZGC -XX:+ZGenerational -XX:+UseStringDeduplication --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED -jar .\powernukkitx-shaded.jar
8573
```
8674

8775
## Community & Support

build.gradle.kts

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
import java.nio.charset.StandardCharsets
2-
import java.nio.file.Files
3-
import java.nio.file.Path
4-
import java.nio.file.StandardCopyOption
2+
// Explicit Gradle API imports to fix Kotlin DSL unresolved references
3+
import org.gradle.external.javadoc.CoreJavadocOptions
4+
import org.gradle.api.tasks.AbstractCopyTask
5+
import org.gradle.api.tasks.bundling.AbstractArchiveTask
6+
import org.gradle.api.tasks.compile.JavaCompile
7+
import org.gradle.api.tasks.javadoc.Javadoc
8+
import org.gradle.api.file.DuplicatesStrategy
9+
import org.gradle.api.DefaultTask
10+
import org.gradle.api.tasks.Copy
11+
import org.gradle.api.publish.maven.MavenPublication
12+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
13+
import org.gradle.testing.jacoco.tasks.JacocoReport
514

615
plugins {
716
`java-library`
817
`maven-publish`
18+
java
919
idea
1020
jacoco
1121
id("io.github.goooler.shadow") version "8.1.7"
@@ -17,15 +27,8 @@ group = "org.powernukkitx"
1727
version = "2.0.0-SNAPSHOT"
1828
description = "PNX Server"
1929
java.sourceCompatibility = JavaVersion.VERSION_21
30+
java.targetCompatibility = JavaVersion.VERSION_21
2031

21-
repositories {
22-
mavenLocal()
23-
mavenCentral()
24-
maven("https://repo.maven.apache.org/maven2/")
25-
maven("https://jitpack.io")
26-
maven("https://repo.opencollab.dev/maven-releases/")
27-
maven("https://repo.opencollab.dev/maven-snapshots/")
28-
}
2932

3033
dependencies {
3134
api(libs.bundles.netty)
@@ -127,7 +130,7 @@ tasks.register<DefaultTask>("buildForGithubAction") {
127130
}
128131

129132
tasks.build {
130-
dependsOn(tasks.shadowJar)
133+
dependsOn("shadowJar")
131134
group = "alpha build"
132135
}
133136

@@ -147,36 +150,38 @@ tasks.test {
147150
useJUnitPlatform()
148151
jvmArgs(listOf("--add-opens", "java.base/java.lang=ALL-UNNAMED"))
149152
jvmArgs(listOf("--add-opens", "java.base/java.io=ALL-UNNAMED"))
150-
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
153+
finalizedBy("jacocoTestReport") // report is always generated after tests run
151154
}
152155

153-
tasks.jacocoTestReport {
156+
tasks.named<JacocoReport>("jacocoTestReport") {
154157
reports {
155158
csv.required = false
156159
xml.required = true
157160
html.required = false
158161
}
159-
dependsOn(tasks.test) // tests are required to run before generating the report
162+
dependsOn("test") // tests are required to run before generating the report
160163
}
161164

162165
tasks.withType<AbstractCopyTask>() {
163166
duplicatesStrategy = DuplicatesStrategy.INCLUDE
164167
}
165168

166169
tasks.named<AbstractArchiveTask>("sourcesJar") {
167-
destinationDirectory = layout.buildDirectory
170+
destinationDirectory.set(layout.buildDirectory)
168171
}
169172

170-
tasks.jar {
171-
destinationDirectory = layout.buildDirectory
172-
doLast {//execution phase
173-
val f: RegularFile = archiveFile.get()
174-
val tf: RegularFile = layout.buildDirectory.file("${project.description}.jar").get()
175-
Files.copy(Path.of(f.asFile.absolutePath), Path.of(tf.asFile.absolutePath), StandardCopyOption.REPLACE_EXISTING)
176-
}
173+
// Improve build reproducibility for better caching
174+
tasks.withType<AbstractArchiveTask> {
175+
isPreserveFileTimestamps = false
176+
isReproducibleFileOrder = true
177177
}
178178

179-
tasks.shadowJar {
179+
tasks.named<org.gradle.jvm.tasks.Jar>("jar") {
180+
destinationDirectory.set(layout.buildDirectory)
181+
archiveFileName.set("${project.description}.jar")
182+
}
183+
184+
tasks.named<ShadowJar>("shadowJar") {
180185
dependsOn("copyDependencies")
181186
manifest {
182187
attributes(
@@ -186,7 +191,7 @@ tasks.shadowJar {
186191

187192
transform(com.github.jengelman.gradle.plugins.shadow.transformers.Log4j2PluginsCacheFileTransformer::class.java) //required to fix shadowJar log4j2 issue
188193

189-
destinationDirectory = layout.buildDirectory
194+
destinationDirectory.set(layout.buildDirectory)
190195
}
191196

192197
tasks.register<Copy>("copyDependencies") {
@@ -247,4 +252,4 @@ tasks.withType<JavaCompile> {
247252

248253
tasks.withType<Javadoc> {
249254
options.encoding = "UTF-8"
250-
}
255+
}

gradle.properties

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
org.gradle.parallel=true
22
org.gradle.daemon=true
33
org.gradle.caching=true
4-
org.gradle.jvmargs=-Djava.net.preferIPv4Stack=true
4+
org.gradle.configuration-cache=true
5+
org.gradle.configuration-cache.problems=warn
6+
org.gradle.vfs.watch=true
7+
org.gradle.warning.mode=summary
8+
org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError
9+
systemProp.file.encoding=UTF-8
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
4-
networkTimeout=10000
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
4+
networkTimeout=15000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME
77
zipStorePath=wrapper/dists

scripts/kaooot-fetch-all.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
cd ../src/main/resources/gamedata/kaooot/
2+
3+
BASE_URL="https://github.com/Kaooot/bedrock-network-data/raw/refs/heads/master/preview/1.21.110.26/"
4+
5+
FILES=(
6+
"biome_definitions.nbt"
7+
"biomes.json"
8+
"block_tags.json"
9+
"creative_items.json"
10+
"entity_identifiers.nbt"
11+
"item_components.nbt"
12+
"item_tags.json"
13+
"recipes.json"
14+
"trim_data.json"
15+
)
16+
17+
for FILE in "${FILES[@]}"; do
18+
echo "Fetching $FILE..."
19+
wget -O $FILE "$BASE_URL$FILE" > /dev/null 2>&1
20+
if [ $? -ne 0 ]; then
21+
echo "Failed to fetch $FILE"
22+
else
23+
echo "Successfully fetched $FILE"
24+
fi
25+
done

settings.gradle.kts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
1-
rootProject.name = "powernukkitx"
1+
pluginManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
mavenCentral()
5+
mavenLocal()
6+
maven("https://jitpack.io")
7+
maven("https://repo.opencollab.dev/maven-releases/")
8+
maven("https://repo.opencollab.dev/maven-snapshots/")
9+
}
10+
}
11+
12+
dependencyResolutionManagement {
13+
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
14+
repositories {
15+
mavenLocal()
16+
mavenCentral()
17+
maven("https://repo.maven.apache.org/maven2/")
18+
maven("https://jitpack.io")
19+
maven("https://repo.opencollab.dev/maven-releases/")
20+
maven("https://repo.opencollab.dev/maven-snapshots/")
21+
}
22+
}
23+
24+
rootProject.name = "powernukkitx"

src/main/java/cn/nukkit/Player.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import cn.nukkit.entity.EntityInteractable;
2727
import cn.nukkit.entity.EntityLiving;
2828
import cn.nukkit.entity.EntityRideable;
29-
import cn.nukkit.entity.data.EntityDataTypes;
29+
import cn.nukkit.entity.custom.CustomEntityComponents;
3030
import cn.nukkit.entity.data.EntityFlag;
3131
import cn.nukkit.entity.data.PlayerFlag;
3232
import cn.nukkit.entity.data.Skin;
@@ -1501,11 +1501,6 @@ protected void onBlock(Entity entity, EntityDamageEvent e, boolean animate) {
15011501
}
15021502
}
15031503

1504-
@Override
1505-
public double getStepHeight() {
1506-
return 0.6f;
1507-
}
1508-
15091504
/**
15101505
* @return {@link #lastAttackEntity}
15111506
*/
@@ -2641,6 +2636,16 @@ public void sendCameraPresets() {
26412636
dataPacket(pk);
26422637
}
26432638

2639+
@Override
2640+
public Set<String> typeFamily() {
2641+
return Set.of("player");
2642+
}
2643+
2644+
@Override
2645+
public boolean isPersistent() {
2646+
return true;
2647+
}
2648+
26442649
@Override
26452650
public float getHeight() {
26462651
if (this.riding instanceof EntityHorse) {
@@ -5069,7 +5074,7 @@ public boolean pickupEntity(Entity entity, boolean near) {
50695074
entity.close();
50705075
return true;
50715076
} else if (entity instanceof EntityItem entityItem) {
5072-
if (entityItem.getPickupDelay() <= 0) {
5077+
if (entityItem.getPickupDelay() <= 0 && !entityItem.isDisplayOnly()) {
50735078
Item item = entityItem.getItem();
50745079

50755080
if (item != null) {

src/main/java/cn/nukkit/block/Block.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
@Slf4j
4848
public abstract class Block extends Position implements Metadatable, AxisAlignedBB, BlockID {
4949
public static final Block[] EMPTY_ARRAY = new Block[0];
50-
public static final double DEFAULT_FRICTION_FACTOR = 0.6;
50+
public static final double DEFAULT_FRICTION_FACTOR = 0.4;
5151
public static final double DEFAULT_AIR_FLUID_FRICTION = 0.95;
5252
public static final Long2ObjectOpenHashMap<BlockColor> VANILLA_BLOCK_COLOR_MAP = new Long2ObjectOpenHashMap<>();
5353
protected BlockState blockstate;

src/main/java/cn/nukkit/block/BlockBell.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cn.nukkit.block;
22

33
import cn.nukkit.Player;
4+
import cn.nukkit.block.copper.chain.AbstractBlockCopperChain;
45
import cn.nukkit.block.property.CommonBlockProperties;
56
import cn.nukkit.block.property.enums.Attachment;
67
import cn.nukkit.blockentity.BlockEntity;
@@ -280,8 +281,8 @@ private boolean checkSupport(Block support, BlockFace attachmentFace) {
280281

281282
if (attachmentFace == BlockFace.DOWN) {
282283
return switch (support.getId()) {
283-
case CHAIN, HOPPER, IRON_BARS -> true;
284-
default -> support instanceof BlockFence || support instanceof BlockWallBase;
284+
case IRON_CHAIN, HOPPER, IRON_BARS -> true;
285+
default -> support instanceof BlockFence || support instanceof BlockWallBase || support instanceof AbstractBlockCopperChain;
285286
};
286287
}
287288

0 commit comments

Comments
 (0)