9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +00:00

改进一下模型阴影

This commit is contained in:
XiaoMoMi
2025-10-13 17:33:40 +08:00
parent 28d6640779
commit 5f2634caa2
6 changed files with 24 additions and 6 deletions

View File

@@ -120,6 +120,7 @@ import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.function.BiFunction;
public class BukkitNetworkManager implements NetworkManager, Listener, PluginMessageListener { public class BukkitNetworkManager implements NetworkManager, Listener, PluginMessageListener {
private static BukkitNetworkManager instance; private static BukkitNetworkManager instance;
@@ -1911,16 +1912,17 @@ public class BukkitNetworkManager implements NetworkManager, Listener, PluginMes
} }
public static class LevelChunkWithLightListener implements ByteBufferPacketListener { public static class LevelChunkWithLightListener implements ByteBufferPacketListener {
private static BiConsumer<NetWorkUser, PalettedContainer<Integer>> biomeRemapper = null; private static BiFunction<NetWorkUser, PalettedContainer<Integer>, Boolean> biomeRemapper = null;
public static void setBiomeRemapper(BiConsumer<NetWorkUser, PalettedContainer<Integer>> remapper) { public static void setBiomeRemapper(BiFunction<NetWorkUser, PalettedContainer<Integer>, Boolean> remapper) {
biomeRemapper = remapper; biomeRemapper = remapper;
} }
public static void remapBiomes(NetWorkUser user, PalettedContainer<Integer> biomes) { public static boolean remapBiomes(NetWorkUser user, PalettedContainer<Integer> biomes) {
if (biomeRemapper != null) { if (biomeRemapper != null) {
biomeRemapper.accept(user, biomes); return biomeRemapper.apply(user, biomes);
} }
return false;
} }
private final int[] blockStateMapper; private final int[] blockStateMapper;
@@ -1978,7 +1980,9 @@ public class BukkitNetworkManager implements NetworkManager, Listener, PluginMes
MCSection mcSection = new MCSection(user.clientBlockList(), this.blockList, this.biomeList); MCSection mcSection = new MCSection(user.clientBlockList(), this.blockList, this.biomeList);
mcSection.readPacket(chunkDataByteBuf); mcSection.readPacket(chunkDataByteBuf);
PalettedContainer<Integer> container = mcSection.blockStateContainer(); PalettedContainer<Integer> container = mcSection.blockStateContainer();
remapBiomes(user, mcSection.biomeContainer()); if (remapBiomes(user, mcSection.biomeContainer())) {
hasChangedAnyBlock = true;
}
Palette<Integer> palette = container.data().palette(); Palette<Integer> palette = container.data().palette();
if (palette.canRemap()) { if (palette.canRemap()) {
if (palette.remapAndCheck(s -> this.blockStateMapper[s])) { if (palette.remapAndCheck(s -> this.blockStateMapper[s])) {

View File

@@ -8,6 +8,7 @@
"from": [8, 0, 0], "from": [8, 0, 0],
"to": [8, 8, 16], "to": [8, 8, 16],
"rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]}, "rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [0, 0, 0, 4], "texture": "#0"}, "north": {"uv": [0, 0, 0, 4], "texture": "#0"},
"east": {"uv": [0, 4, 8, 8], "texture": "#0"}, "east": {"uv": [0, 4, 8, 8], "texture": "#0"},
@@ -21,6 +22,7 @@
"from": [8, 0, 0], "from": [8, 0, 0],
"to": [8, 8, 16], "to": [8, 8, 16],
"rotation": {"angle": -45, "axis": "y", "origin": [8, 8, 8]}, "rotation": {"angle": -45, "axis": "y", "origin": [8, 8, 8]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [0, 0, 0, 4], "texture": "#0"}, "north": {"uv": [0, 0, 0, 4], "texture": "#0"},
"east": {"uv": [0, 4, 8, 8], "texture": "#0"}, "east": {"uv": [0, 4, 8, 8], "texture": "#0"},

View File

@@ -8,6 +8,7 @@
"from": [8, 0, 0], "from": [8, 0, 0],
"to": [8, 16, 16], "to": [8, 16, 16],
"rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]}, "rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [0, 0, 0, 4], "texture": "#0"}, "north": {"uv": [0, 0, 0, 4], "texture": "#0"},
"east": {"uv": [16, 0, 8, 8], "texture": "#0"}, "east": {"uv": [16, 0, 8, 8], "texture": "#0"},
@@ -21,6 +22,7 @@
"from": [0, 0, 8], "from": [0, 0, 8],
"to": [16, 16, 8], "to": [16, 16, 8],
"rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]}, "rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [16, 0, 8, 8], "texture": "#0"}, "north": {"uv": [16, 0, 8, 8], "texture": "#0"},
"east": {"uv": [0, 0, 0, 4], "texture": "#0"}, "east": {"uv": [0, 0, 0, 4], "texture": "#0"},

View File

@@ -8,6 +8,7 @@
"from": [8, 0, 0], "from": [8, 0, 0],
"to": [8, 16, 16], "to": [8, 16, 16],
"rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]}, "rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [0, 0, 0, 4], "texture": "#0"}, "north": {"uv": [0, 0, 0, 4], "texture": "#0"},
"east": {"uv": [8, 8, 0, 16], "texture": "#0"}, "east": {"uv": [8, 8, 0, 16], "texture": "#0"},
@@ -21,6 +22,7 @@
"from": [8, 0, 0], "from": [8, 0, 0],
"to": [8, 16, 16], "to": [8, 16, 16],
"rotation": {"angle": -45, "axis": "y", "origin": [8, 8, 8]}, "rotation": {"angle": -45, "axis": "y", "origin": [8, 8, 8]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [0, 0, 0, 4], "texture": "#0"}, "north": {"uv": [0, 0, 0, 4], "texture": "#0"},
"east": {"uv": [8, 8, 0, 16], "texture": "#0"}, "east": {"uv": [8, 8, 0, 16], "texture": "#0"},

View File

@@ -8,6 +8,7 @@
"from": [6.1, 11.1, 6.1], "from": [6.1, 11.1, 6.1],
"to": [3.9, 8.9, 3.9], "to": [3.9, 8.9, 3.9],
"rotation": {"angle": 0, "axis": "y", "origin": [4, 9, 6]}, "rotation": {"angle": 0, "axis": "y", "origin": [4, 9, 6]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [1, 2, 0, 1], "texture": "#0"}, "north": {"uv": [1, 2, 0, 1], "texture": "#0"},
"east": {"uv": [1, 2, 0, 1], "texture": "#0"}, "east": {"uv": [1, 2, 0, 1], "texture": "#0"},
@@ -21,6 +22,7 @@
"from": [4, 9, 4], "from": [4, 9, 4],
"to": [6, 11, 6], "to": [6, 11, 6],
"rotation": {"angle": 0, "axis": "y", "origin": [4, 9, 6]}, "rotation": {"angle": 0, "axis": "y", "origin": [4, 9, 6]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [0, 0, 1, 1], "texture": "#0"}, "north": {"uv": [0, 0, 1, 1], "texture": "#0"},
"east": {"uv": [1, 0, 2, 1], "texture": "#0"}, "east": {"uv": [1, 0, 2, 1], "texture": "#0"},
@@ -34,6 +36,7 @@
"from": [11.1, 9.1, 11.1], "from": [11.1, 9.1, 11.1],
"to": [8.9, 6.9, 8.9], "to": [8.9, 6.9, 8.9],
"rotation": {"angle": 0, "axis": "y", "origin": [11, 7, 9]}, "rotation": {"angle": 0, "axis": "y", "origin": [11, 7, 9]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [0, 2, 1, 1], "texture": "#0"}, "north": {"uv": [0, 2, 1, 1], "texture": "#0"},
"east": {"uv": [0, 2, 1, 1], "texture": "#0"}, "east": {"uv": [0, 2, 1, 1], "texture": "#0"},
@@ -47,6 +50,7 @@
"from": [9, 7, 9], "from": [9, 7, 9],
"to": [11, 9, 11], "to": [11, 9, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [11, 7, 9]}, "rotation": {"angle": 0, "axis": "y", "origin": [11, 7, 9]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [2, 0, 1, 1], "texture": "#0"}, "north": {"uv": [2, 0, 1, 1], "texture": "#0"},
"east": {"uv": [1, 0, 0, 1], "texture": "#0"}, "east": {"uv": [1, 0, 0, 1], "texture": "#0"},
@@ -60,6 +64,7 @@
"from": [6.1, 13.1, 12.1], "from": [6.1, 13.1, 12.1],
"to": [3.9, 10.9, 9.9], "to": [3.9, 10.9, 9.9],
"rotation": {"angle": 0, "axis": "y", "origin": [4, 11, 10]}, "rotation": {"angle": 0, "axis": "y", "origin": [4, 11, 10]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [1, 2, 0, 1], "texture": "#0"}, "north": {"uv": [1, 2, 0, 1], "texture": "#0"},
"east": {"uv": [0, 2, 1, 1], "texture": "#0"}, "east": {"uv": [0, 2, 1, 1], "texture": "#0"},
@@ -73,6 +78,7 @@
"from": [4, 11, 10], "from": [4, 11, 10],
"to": [6, 13, 12], "to": [6, 13, 12],
"rotation": {"angle": 0, "axis": "y", "origin": [4, 11, 10]}, "rotation": {"angle": 0, "axis": "y", "origin": [4, 11, 10]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [1, 0, 2, 1], "texture": "#0"}, "north": {"uv": [1, 0, 2, 1], "texture": "#0"},
"east": {"uv": [2, 0, 1, 1], "texture": "#0"}, "east": {"uv": [2, 0, 1, 1], "texture": "#0"},
@@ -86,6 +92,7 @@
"from": [8, 0, 0], "from": [8, 0, 0],
"to": [8, 16, 16], "to": [8, 16, 16],
"rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]}, "rotation": {"angle": 45, "axis": "y", "origin": [8, 8, 8]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [12, 0, 12, 4], "texture": "#0"}, "north": {"uv": [12, 0, 12, 4], "texture": "#0"},
"east": {"uv": [16, 8, 8, 16], "texture": "#0"}, "east": {"uv": [16, 8, 8, 16], "texture": "#0"},
@@ -99,6 +106,7 @@
"from": [8, 0, 0], "from": [8, 0, 0],
"to": [8, 16, 16], "to": [8, 16, 16],
"rotation": {"angle": -45, "axis": "y", "origin": [8, 8, 8]}, "rotation": {"angle": -45, "axis": "y", "origin": [8, 8, 8]},
"shade": false,
"faces": { "faces": {
"north": {"uv": [12, 0, 12, 4], "texture": "#0"}, "north": {"uv": [12, 0, 12, 4], "texture": "#0"},
"east": {"uv": [16, 8, 8, 16], "texture": "#0"}, "east": {"uv": [16, 8, 8, 16], "texture": "#0"},

View File

@@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1G
# Project settings # Project settings
# Rule: [major update].[feature update].[bug fix] # Rule: [major update].[feature update].[bug fix]
project_version=0.0.64.8 project_version=0.0.64.9
config_version=49 config_version=49
lang_version=34 lang_version=34
project_group=net.momirealms project_group=net.momirealms