-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from xymb-endcrystalme/ver/1.19.4
Add option to drop contents of shulker items when destroyed.
- Loading branch information
Showing
3 changed files
with
71 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ Date: Fri, 10 Feb 2023 22:21:56 +0200 | |
Subject: [PATCH] Kaiiju RegionFormat Linear | ||
|
||
Documentation: https://github.com/xymb-endcrystalme/LinearRegionFileFormatTools | ||
Copyright [email protected] | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
diff --git a/build.gradle.kts b/build.gradle.kts | ||
index 6dd416f65755ca0542e6661b8716672264120d59..4686019a152114e63e997ee103fc8424b24b4581 100644 | ||
|
@@ -111,10 +109,10 @@ index 0000000000000000000000000000000000000000..dcfbabf54b19a4c29d5c95830242c5c2 | |
+} | ||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java | ||
new file mode 100644 | ||
index 0000000000000000000000000000000000000000..f05d6313012560c32a3ec574b7169ec8e8930282 | ||
index 0000000000000000000000000000000000000000..32213e1f2432a2ee0c27331e83a04696d4cdd0cc | ||
--- /dev/null | ||
+++ b/src/main/java/dev/kaiijumc/kaiiju/region/LinearRegionFile.java | ||
@@ -0,0 +1,334 @@ | ||
@@ -0,0 +1,336 @@ | ||
+package dev.kaiijumc.kaiiju.region; | ||
+ | ||
+import com.github.luben.zstd.ZstdInputStream; | ||
|
@@ -123,7 +121,6 @@ index 0000000000000000000000000000000000000000..f05d6313012560c32a3ec574b7169ec8 | |
+import net.jpountz.lz4.LZ4Compressor; | ||
+import net.jpountz.lz4.LZ4Factory; | ||
+import net.jpountz.lz4.LZ4FastDecompressor; | ||
+import net.jpountz.xxhash.XXHashFactory; | ||
+import net.minecraft.nbt.CompoundTag; | ||
+import net.minecraft.world.level.ChunkPos; | ||
+import net.minecraft.world.level.chunk.ChunkStatus; | ||
|
@@ -329,11 +326,14 @@ index 0000000000000000000000000000000000000000..f05d6313012560c32a3ec574b7169ec8 | |
+ byte[] compressed = zstdByteArray.toByteArray(); | ||
+ | ||
+ dataStream.writeInt(compressed.length); | ||
+ dataStream.writeLong(XXHashFactory.fastestInstance().hash64().hash(compressed, 0, compressed.length, 0)); // TODO: Hash the contents, not the whole thing | ||
+ dataStream.writeLong(0); | ||
+ | ||
+ dataStream.write(compressed, 0, compressed.length); | ||
+ dataStream.writeLong(SUPERBLOCK); | ||
+ | ||
+ dataStream.flush(); | ||
+ fileStream.getFD().sync(); | ||
+ fileStream.getChannel().force(true); // Ensure atomicity on Btrfs | ||
+ dataStream.close(); | ||
+ | ||
+ fileStream.close(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: "Sofiane H. Djerbi" <[email protected]> | ||
Date: Sat, 8 Apr 2023 23:32:34 +0300 | ||
Subject: [PATCH] Kaiiju Gameplay Configuration | ||
|
||
|
||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java | ||
index edaeba20d871925ae05f7f1cabb3ac8eb71b4655..e216139d08c52640396c07c19c5cfeff09031cdb 100644 | ||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java | ||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java | ||
@@ -206,4 +206,7 @@ public class KaiijuConfig { | ||
sendNullEntityPackets = getBoolean("network.send-null-entity-packets", sendNullEntityPackets); | ||
alternateKeepAlive = getBoolean("network.alternate-keepalive", sendNullEntityPackets); | ||
} | ||
+ | ||
+ private static void gameplaySettings() { | ||
+ } | ||
} | ||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java | ||
index b194f4dbebcbbf5bb4e026a0169e2d24806b46ec..73d79fe0077b28db2f9e7fa13a1ae6eff9abd6a9 100644 | ||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java | ||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java | ||
@@ -143,4 +143,7 @@ public class KaiijuWorldConfig { | ||
regionFormatLinearCompressionLevel = 1; | ||
} | ||
} | ||
+ | ||
+ private void gameplaySettings() { | ||
+ } | ||
} | ||
\ No newline at end of file |
34 changes: 34 additions & 0 deletions
34
patches/server/0009-Kaiiju-Gameplay-ShulkerDropContentsWhenDestroyed.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Xymb <[email protected]> | ||
Date: Sat, 8 Apr 2023 23:38:13 +0300 | ||
Subject: [PATCH] Kaiiju Gameplay ShulkerDropContentsWhenDestroyed | ||
|
||
|
||
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java | ||
index 73d79fe0077b28db2f9e7fa13a1ae6eff9abd6a9..1ebc47a266dd3202ac9654eebf1a6a74dead2e27 100644 | ||
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java | ||
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java | ||
@@ -144,6 +144,9 @@ public class KaiijuWorldConfig { | ||
} | ||
} | ||
|
||
+ public boolean shulkerBoxDropContentsWhenDestroyed = true; | ||
+ | ||
private void gameplaySettings() { | ||
+ shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed ); | ||
} | ||
} | ||
\ No newline at end of file | ||
diff --git a/src/main/java/net/minecraft/world/item/BlockItem.java b/src/main/java/net/minecraft/world/item/BlockItem.java | ||
index b0204af850ee182773ad458208cccd946ad148d5..a4dff10cf787b187ffc716b2278c2dc6999ecb00 100644 | ||
--- a/src/main/java/net/minecraft/world/item/BlockItem.java | ||
+++ b/src/main/java/net/minecraft/world/item/BlockItem.java | ||
@@ -288,7 +288,7 @@ public class BlockItem extends Item { | ||
|
||
@Override | ||
public void onDestroyed(ItemEntity entity) { | ||
- if (this.block instanceof ShulkerBoxBlock) { | ||
+ if (this.block instanceof ShulkerBoxBlock && entity.getLevel().kaiijuConfig.shulkerBoxDropContentsWhenDestroyed) { | ||
ItemStack itemstack = entity.getItem(); | ||
CompoundTag nbttagcompound = BlockItem.getBlockEntityData(itemstack); | ||
|