mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
fix compile errors
This commit is contained in:
@@ -2226,7 +2226,7 @@ index ea7666cc10aee49e13dbdd6e3367fabaa0dcbc17..9e0fe52c81f764843580ebb5fe6a5bd6
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||||
index 8502205994ecf28b1b791195088d183d7574760f..4bf6144e822e201d9c2e009c1ac8d332ae02518b 100644
|
index 8502205994ecf28b1b791195088d183d7574760f..0715301d83ac1b625ce45045b7614bfe10a3fc51 100644
|
||||||
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||||
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||||
@@ -21,8 +21,6 @@ import net.minecraft.util.ByIdMap;
|
@@ -21,8 +21,6 @@ import net.minecraft.util.ByIdMap;
|
||||||
@@ -2238,7 +2238,7 @@ index 8502205994ecf28b1b791195088d183d7574760f..4bf6144e822e201d9c2e009c1ac8d332
|
|||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
@@ -161,11 +159,7 @@ public class Armadillo extends Animal {
|
@@ -161,13 +159,8 @@ public class Armadillo extends Animal {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void customServerAiStep(ServerLevel level) {
|
protected void customServerAiStep(ServerLevel level) {
|
||||||
@@ -2248,8 +2248,10 @@ index 8502205994ecf28b1b791195088d183d7574760f..4bf6144e822e201d9c2e009c1ac8d332
|
|||||||
- profilerFiller.pop();
|
- profilerFiller.pop();
|
||||||
- profilerFiller.push("armadilloActivityUpdate");
|
- profilerFiller.push("armadilloActivityUpdate");
|
||||||
ArmadilloAi.updateActivity(this);
|
ArmadilloAi.updateActivity(this);
|
||||||
profilerFiller.pop();
|
- profilerFiller.pop();
|
||||||
if (this.isAlive() && --this.scuteTime <= 0 && this.shouldDropLoot(level)) {
|
if (this.isAlive() && --this.scuteTime <= 0 && this.shouldDropLoot(level)) {
|
||||||
|
this.forceDrops = true; // CraftBukkit
|
||||||
|
if (this.dropFromGiftLootTable(level, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) {
|
||||||
diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||||
index e5ac43bf5631254c31d91abb1c5de408807429dd..73ff138007002a6203b6a0df88d34d26f025a827 100644
|
index e5ac43bf5631254c31d91abb1c5de408807429dd..73ff138007002a6203b6a0df88d34d26f025a827 100644
|
||||||
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||||
|
|||||||
@@ -715,18 +715,27 @@ index 5959e1b1772ffbdfb108365171fe37cbf56ef825..92669a529316d76563a110f5770ba06a
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/net/minecraft/world/level/pathfinder/PathFinder.java b/net/minecraft/world/level/pathfinder/PathFinder.java
|
diff --git a/net/minecraft/world/level/pathfinder/PathFinder.java b/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||||
index 919769ae40efea904be6adbbb13542bd39bf0291..42a82354377ea9ee90064678851d3e41051650fc 100644
|
index 919769ae40efea904be6adbbb13542bd39bf0291..0d45c9378a23f89babbe9b542bddb0ac109beddd 100644
|
||||||
--- a/net/minecraft/world/level/pathfinder/PathFinder.java
|
--- a/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||||
+++ b/net/minecraft/world/level/pathfinder/PathFinder.java
|
+++ b/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||||
@@ -23,11 +23,19 @@ public class PathFinder {
|
@@ -16,6 +16,8 @@ import net.minecraft.world.entity.Mob;
|
||||||
|
import net.minecraft.world.level.PathNavigationRegion;
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
|
|
||||||
|
+import org.bxteam.divinemc.async.pathfinding.NodeEvaluatorGenerator; // DivineMC - Petal: Async Pathfinding
|
||||||
|
+
|
||||||
|
public class PathFinder {
|
||||||
|
private static final float FUDGING = 1.5F;
|
||||||
|
private final Node[] neighbors = new Node[32];
|
||||||
|
@@ -23,11 +25,19 @@ public class PathFinder {
|
||||||
public final NodeEvaluator nodeEvaluator;
|
public final NodeEvaluator nodeEvaluator;
|
||||||
private final BinaryHeap openSet = new BinaryHeap();
|
private final BinaryHeap openSet = new BinaryHeap();
|
||||||
private BooleanSupplier captureDebug = () -> false;
|
private BooleanSupplier captureDebug = () -> false;
|
||||||
+ private final @Nullable org.bxteam.divinemc.async.pathfinding.NodeEvaluatorGenerator nodeEvaluatorGenerator; // DivineMC - we use this later to generate an evaluator
|
+ private final @Nullable NodeEvaluatorGenerator nodeEvaluatorGenerator; // DivineMC - we use this later to generate an evaluator
|
||||||
|
|
||||||
- public PathFinder(NodeEvaluator nodeEvaluator, int maxVisitedNodes) {
|
- public PathFinder(NodeEvaluator nodeEvaluator, int maxVisitedNodes) {
|
||||||
+ // DivineMC start - support nodeEvaluatorgenerators
|
+ // DivineMC start - support nodeEvaluatorgenerators
|
||||||
+ public PathFinder(NodeEvaluator nodeEvaluator, int maxVisitedNodes, @Nullable org.bxteam.divinemc.async.pathfinding.NodeEvaluatorGenerator nodeEvaluatorGenerator) { // DivineMC - add nodeEvaluatorGenerator
|
+ public PathFinder(NodeEvaluator nodeEvaluator, int maxVisitedNodes, @Nullable NodeEvaluatorGenerator nodeEvaluatorGenerator) { // DivineMC - add nodeEvaluatorGenerator
|
||||||
this.nodeEvaluator = nodeEvaluator;
|
this.nodeEvaluator = nodeEvaluator;
|
||||||
this.maxVisitedNodes = maxVisitedNodes;
|
this.maxVisitedNodes = maxVisitedNodes;
|
||||||
+ this.nodeEvaluatorGenerator = nodeEvaluatorGenerator;
|
+ this.nodeEvaluatorGenerator = nodeEvaluatorGenerator;
|
||||||
@@ -739,7 +748,7 @@ index 919769ae40efea904be6adbbb13542bd39bf0291..42a82354377ea9ee90064678851d3e41
|
|||||||
|
|
||||||
public void setCaptureDebug(BooleanSupplier captureDebug) {
|
public void setCaptureDebug(BooleanSupplier captureDebug) {
|
||||||
this.captureDebug = captureDebug;
|
this.captureDebug = captureDebug;
|
||||||
@@ -38,25 +46,61 @@ public class PathFinder {
|
@@ -38,25 +48,61 @@ public class PathFinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public @Nullable Path findPath(PathNavigationRegion region, Mob mob, Set<BlockPos> targets, float maxRange, int reachRange, float maxVisitedNodesMultiplier) {
|
public @Nullable Path findPath(PathNavigationRegion region, Mob mob, Set<BlockPos> targets, float maxRange, int reachRange, float maxVisitedNodesMultiplier) {
|
||||||
@@ -808,7 +817,7 @@ index 919769ae40efea904be6adbbb13542bd39bf0291..42a82354377ea9ee90064678851d3e41
|
|||||||
// Set<Target> set = targetPositions.keySet(); // Paper - unused
|
// Set<Target> set = targetPositions.keySet(); // Paper - unused
|
||||||
node.g = 0.0F;
|
node.g = 0.0F;
|
||||||
node.h = this.getBestH(node, positions); // Paper - optimize collection
|
node.h = this.getBestH(node, positions); // Paper - optimize collection
|
||||||
@@ -97,7 +141,7 @@ public class PathFinder {
|
@@ -97,7 +143,7 @@ public class PathFinder {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(node1.distanceTo(node) >= maxRange)) {
|
if (!(node1.distanceTo(node) >= maxRange)) {
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ index 2488fc0ae21b8e10895b0ef6397d8e0e5bc843a8..b2d66e2f24e64fce0f260e6c807fc189
|
|||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
diff --git a/net/minecraft/server/PlayerAdvancements.java b/net/minecraft/server/PlayerAdvancements.java
|
diff --git a/net/minecraft/server/PlayerAdvancements.java b/net/minecraft/server/PlayerAdvancements.java
|
||||||
index afa99de0800d1ac15fe496e6af62969764fcb865..da94b8419dad718e25057f2efc839d3c00ba9f47 100644
|
index 6dddfdb97916165b717f68ae2afbb8d89b1283d6..daabbc5f4890c3683afb0531315e7466701a9111 100644
|
||||||
--- a/net/minecraft/server/PlayerAdvancements.java
|
--- a/net/minecraft/server/PlayerAdvancements.java
|
||||||
+++ b/net/minecraft/server/PlayerAdvancements.java
|
+++ b/net/minecraft/server/PlayerAdvancements.java
|
||||||
@@ -53,7 +53,7 @@ public class PlayerAdvancements {
|
@@ -53,7 +53,7 @@ public class PlayerAdvancements {
|
||||||
@@ -1353,22 +1353,28 @@ index 63e391441f655138ddfd303270f33c7a35655ca5..482029bc19a3a05aff8924257128ee9c
|
|||||||
LevelChunkSection section = this.getSection(this.getSectionIndex(y));
|
LevelChunkSection section = this.getSection(this.getSectionIndex(y));
|
||||||
boolean hasOnlyAir = section.hasOnlyAir();
|
boolean hasOnlyAir = section.hasOnlyAir();
|
||||||
diff --git a/net/minecraft/world/level/entity/EntityTickList.java b/net/minecraft/world/level/entity/EntityTickList.java
|
diff --git a/net/minecraft/world/level/entity/EntityTickList.java b/net/minecraft/world/level/entity/EntityTickList.java
|
||||||
index a8a5017de2ee0c00bed9b56f2f3c85d23e4056e9..608c70a8247f75f1367ca1e875b0b9c92030dab1 100644
|
index a8a5017de2ee0c00bed9b56f2f3c85d23e4056e9..2073ba07ad4f2cc4b1dd734e048a76cf3ea210d4 100644
|
||||||
--- a/net/minecraft/world/level/entity/EntityTickList.java
|
--- a/net/minecraft/world/level/entity/EntityTickList.java
|
||||||
+++ b/net/minecraft/world/level/entity/EntityTickList.java
|
+++ b/net/minecraft/world/level/entity/EntityTickList.java
|
||||||
@@ -11,25 +11,67 @@ import org.jspecify.annotations.Nullable;
|
@@ -6,30 +6,73 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMaps;
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
+import net.minecraft.server.level.ServerLevel; // DivineMC - Parallel world ticking
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
|
|
||||||
public class EntityTickList {
|
public class EntityTickList {
|
||||||
public final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<net.minecraft.world.entity.Entity> entities = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>(); // Paper - rewrite chunk system
|
public final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<net.minecraft.world.entity.Entity> entities = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>(); // Paper - rewrite chunk system
|
||||||
|
|
||||||
+ // DivineMC start - Parallel world ticking
|
+ // DivineMC start - Parallel world ticking
|
||||||
+ @Nullable
|
+ @Nullable
|
||||||
+ private final net.minecraft.server.level.ServerLevel serverLevel;
|
+ private final ServerLevel serverLevel;
|
||||||
+
|
+
|
||||||
+ public EntityTickList() {
|
+ public EntityTickList() {
|
||||||
+ this(null);
|
+ this(null);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ public EntityTickList(@Nullable net.minecraft.server.level.ServerLevel serverLevel) {
|
+ public EntityTickList(@Nullable ServerLevel serverLevel) {
|
||||||
+ this.serverLevel = serverLevel;
|
+ this.serverLevel = serverLevel;
|
||||||
+ }
|
+ }
|
||||||
+ // DivineMC end - Parallel world ticking
|
+ // DivineMC end - Parallel world ticking
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ index 354e6792cd93a77870d4a061a5b3d9fe4bed2458..580746b5c66a60949281f4a0f814b2e8
|
|||||||
runnable.run();
|
runnable.run();
|
||||||
}
|
}
|
||||||
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
index 28c61ccce5a71b8a3c3e87617907ced1fc45b68c..b0dc1559be498445410803aaa660a4e6a99da67c 100644
|
index 28c61ccce5a71b8a3c3e87617907ced1fc45b68c..add49a402be6a1989506bc25bf0a4e7660a3f17a 100644
|
||||||
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||||
@@ -62,6 +62,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
@@ -62,6 +62,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||||
@@ -76,7 +76,7 @@ index 28c61ccce5a71b8a3c3e87617907ced1fc45b68c..b0dc1559be498445410803aaa660a4e6
|
|||||||
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePayload(org.leavesmc.leaves.protocol.core.ProtocolUtils.createSelector(this), leavesPayload);
|
+ org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePayload(org.leavesmc.leaves.protocol.core.ProtocolUtils.createSelector(this), leavesPayload);
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.DiscardedPayload(net.minecraft.resources.ResourceLocation id, byte[] data)) {
|
+ if (packet.payload() instanceof net.minecraft.network.protocol.common.custom.DiscardedPayload(net.minecraft.resources.Identifier id, byte[] data)) {
|
||||||
+ if (org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleBytebuf(org.leavesmc.leaves.protocol.core.ProtocolUtils.createSelector(this), id, io.netty.buffer.Unpooled.wrappedBuffer(data))) {
|
+ if (org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleBytebuf(org.leavesmc.leaves.protocol.core.ProtocolUtils.createSelector(this), id, io.netty.buffer.Unpooled.wrappedBuffer(data))) {
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -148,10 +148,16 @@ index e4cbe8d6176c2174ed5fffb9ea28f69c12dc9f1e..70e9c7a649a7c5145ecdb679f5fe54f3
|
|||||||
}
|
}
|
||||||
// Paper end - rewrite chunk system
|
// Paper end - rewrite chunk system
|
||||||
diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d5e4ee795 100644
|
index dbea0449cebd448f5b165097aee8633e4d8bac67..9d73b706167d5d997b1af018c7ceaf0d200c7ff1 100644
|
||||||
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
|
||||||
@@ -19,7 +19,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -15,11 +15,13 @@ import net.minecraft.util.FileUtil;
|
||||||
|
import net.minecraft.world.level.ChunkPos;
|
||||||
|
import org.jspecify.annotations.Nullable;
|
||||||
|
|
||||||
|
+import org.bxteam.divinemc.region.IRegionFile; // DivineMC - Linear region file format
|
||||||
|
+
|
||||||
|
public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.io.ChunkSystemRegionFileStorage { // Paper - rewrite chunk system
|
||||||
private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); // Paper
|
private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); // Paper
|
||||||
public static final String ANVIL_EXTENSION = ".mca";
|
public static final String ANVIL_EXTENSION = ".mca";
|
||||||
private static final int MAX_CACHE_SIZE = 256;
|
private static final int MAX_CACHE_SIZE = 256;
|
||||||
@@ -160,14 +166,14 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
private final RegionStorageInfo info;
|
private final RegionStorageInfo info;
|
||||||
private final Path folder;
|
private final Path folder;
|
||||||
private final boolean sync;
|
private final boolean sync;
|
||||||
@@ -59,9 +59,29 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -59,8 +61,28 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
private static final int MAX_NON_EXISTING_CACHE = 1024 * 4;
|
private static final int MAX_NON_EXISTING_CACHE = 1024 * 4;
|
||||||
private final it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet nonExistingRegionFiles = new it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet();
|
private final it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet nonExistingRegionFiles = new it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet();
|
||||||
private static String getRegionFileName(final int chunkX, final int chunkZ) {
|
private static String getRegionFileName(final int chunkX, final int chunkZ) {
|
||||||
- return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + ".mca";
|
- return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + ".mca";
|
||||||
+ return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + getExtensionName(); // DivineMC - Buffered Linear region format
|
+ return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + getExtensionName(); // DivineMC - Buffered Linear region format
|
||||||
}
|
+ }
|
||||||
|
+
|
||||||
+ // DivineMC start - Buffered Linear region format
|
+ // DivineMC start - Buffered Linear region format
|
||||||
+ public static org.bxteam.divinemc.region.IRegionFile createNew(RegionStorageInfo info, Path filePath, Path folder, boolean sync) throws IOException{
|
+ public static org.bxteam.divinemc.region.IRegionFile createNew(RegionStorageInfo info, Path filePath, Path folder, boolean sync) throws IOException{
|
||||||
+ final org.bxteam.divinemc.region.EnumRegionFileExtension regionFormat = org.bxteam.divinemc.config.DivineConfig.MiscCategory.regionFileType;
|
+ final org.bxteam.divinemc.region.EnumRegionFileExtension regionFormat = org.bxteam.divinemc.config.DivineConfig.MiscCategory.regionFileType;
|
||||||
@@ -185,13 +191,12 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
+
|
+
|
||||||
+ public static String getExtensionName() {
|
+ public static String getExtensionName() {
|
||||||
+ return "." + org.bxteam.divinemc.config.DivineConfig.MiscCategory.regionFileType.getArgument();
|
+ return "." + org.bxteam.divinemc.config.DivineConfig.MiscCategory.regionFileType.getArgument();
|
||||||
+ }
|
}
|
||||||
+ // DivineMC end - Buffered Linear region format
|
+ // DivineMC end - Buffered Linear region format
|
||||||
+
|
|
||||||
private boolean doesRegionFilePossiblyExist(final long position) {
|
private boolean doesRegionFilePossiblyExist(final long position) {
|
||||||
synchronized (this.nonExistingRegionFiles) {
|
synchronized (this.nonExistingRegionFiles) {
|
||||||
if (this.nonExistingRegionFiles.contains(position)) {
|
@@ -94,15 +116,15 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
@@ -94,15 +114,15 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -210,7 +215,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
if (ret != null) {
|
if (ret != null) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -126,7 +146,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -126,7 +148,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
|
|
||||||
FileUtil.createDirectoriesSafe(this.folder);
|
FileUtil.createDirectoriesSafe(this.folder);
|
||||||
|
|
||||||
@@ -219,7 +224,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
|
|
||||||
this.regionCache.putAndMoveToFirst(key, ret);
|
this.regionCache.putAndMoveToFirst(key, ret);
|
||||||
|
|
||||||
@@ -145,7 +165,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -145,7 +167,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
}
|
}
|
||||||
|
|
||||||
final ChunkPos pos = new ChunkPos(chunkX, chunkZ);
|
final ChunkPos pos = new ChunkPos(chunkX, chunkZ);
|
||||||
@@ -228,7 +233,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
|
|
||||||
// note: not required to keep regionfile loaded after this call, as the write param takes a regionfile as input
|
// note: not required to keep regionfile loaded after this call, as the write param takes a regionfile as input
|
||||||
// (and, the regionfile parameter is unused for writing until the write call)
|
// (and, the regionfile parameter is unused for writing until the write call)
|
||||||
@@ -179,7 +199,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -179,7 +201,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
final ChunkPos pos = new ChunkPos(chunkX, chunkZ);
|
final ChunkPos pos = new ChunkPos(chunkX, chunkZ);
|
||||||
if (writeData.result() == ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.WriteData.WriteResult.DELETE) {
|
if (writeData.result() == ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.WriteData.WriteResult.DELETE) {
|
||||||
@@ -237,7 +242,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
if (regionFile != null) {
|
if (regionFile != null) {
|
||||||
regionFile.clear(pos);
|
regionFile.clear(pos);
|
||||||
} // else: didn't exist
|
} // else: didn't exist
|
||||||
@@ -194,7 +214,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -194,7 +216,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
public final ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.ReadData moonrise$readData(
|
public final ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.ReadData moonrise$readData(
|
||||||
final int chunkX, final int chunkZ
|
final int chunkX, final int chunkZ
|
||||||
) throws IOException {
|
) throws IOException {
|
||||||
@@ -246,7 +251,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
|
|
||||||
final DataInputStream input = regionFile == null ? null : regionFile.getChunkDataInputStream(new ChunkPos(chunkX, chunkZ));
|
final DataInputStream input = regionFile == null ? null : regionFile.getChunkDataInputStream(new ChunkPos(chunkX, chunkZ));
|
||||||
|
|
||||||
@@ -239,7 +259,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -239,7 +261,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
|
|
||||||
final ChunkPos pos = new ChunkPos(chunkX, chunkZ);
|
final ChunkPos pos = new ChunkPos(chunkX, chunkZ);
|
||||||
final ChunkPos headerChunkPos = SerializableChunkData.getChunkCoordinate(ret);
|
final ChunkPos headerChunkPos = SerializableChunkData.getChunkCoordinate(ret);
|
||||||
@@ -255,7 +260,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
|
|
||||||
if (regionFile.getRecalculateCount() != readData.recalculateCount()) {
|
if (regionFile.getRecalculateCount() != readData.recalculateCount()) {
|
||||||
return null;
|
return null;
|
||||||
@@ -263,7 +283,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -263,7 +285,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
}
|
}
|
||||||
// Paper end - rewrite chunk system
|
// Paper end - rewrite chunk system
|
||||||
// Paper start - rewrite chunk system
|
// Paper start - rewrite chunk system
|
||||||
@@ -264,16 +269,16 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
return this.getRegionFile(chunkcoordintpair, false);
|
return this.getRegionFile(chunkcoordintpair, false);
|
||||||
}
|
}
|
||||||
// Paper end - rewrite chunk system
|
// Paper end - rewrite chunk system
|
||||||
@@ -275,7 +295,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -275,7 +297,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
this.isChunkData = isChunkDataFolder(this.folder); // Paper - recalculate region file headers
|
this.isChunkData = isChunkDataFolder(this.folder); // Paper - recalculate region file headers
|
||||||
}
|
}
|
||||||
|
|
||||||
- @org.jetbrains.annotations.Contract("_, false -> !null") @Nullable private RegionFile getRegionFile(ChunkPos chunkPos, boolean existingOnly) throws IOException { // CraftBukkit
|
- @org.jetbrains.annotations.Contract("_, false -> !null") @Nullable private RegionFile getRegionFile(ChunkPos chunkPos, boolean existingOnly) throws IOException { // CraftBukkit
|
||||||
+ @org.jetbrains.annotations.Contract("_, false -> !null") @Nullable private org.bxteam.divinemc.region.IRegionFile getRegionFile(ChunkPos chunkPos, boolean existingOnly) throws IOException { // CraftBukkit // DivineMC - Buffered Linear region format
|
+ @org.jetbrains.annotations.Contract("_, false -> !null") @Nullable private IRegionFile getRegionFile(ChunkPos chunkPos, boolean existingOnly) throws IOException { // CraftBukkit // DivineMC - Buffered Linear region format
|
||||||
// Paper start - rewrite chunk system
|
// Paper start - rewrite chunk system
|
||||||
if (existingOnly) {
|
if (existingOnly) {
|
||||||
return this.moonrise$getRegionFileIfExists(chunkPos.x, chunkPos.z);
|
return this.moonrise$getRegionFileIfExists(chunkPos.x, chunkPos.z);
|
||||||
@@ -283,7 +303,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -283,7 +305,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
final long key = ChunkPos.asLong(chunkPos.x >> REGION_SHIFT, chunkPos.z >> REGION_SHIFT);
|
final long key = ChunkPos.asLong(chunkPos.x >> REGION_SHIFT, chunkPos.z >> REGION_SHIFT);
|
||||||
|
|
||||||
@@ -282,7 +287,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
if (ret != null) {
|
if (ret != null) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -298,7 +318,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -298,7 +320,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
|
|
||||||
FileUtil.createDirectoriesSafe(this.folder);
|
FileUtil.createDirectoriesSafe(this.folder);
|
||||||
|
|
||||||
@@ -291,7 +296,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
|
|
||||||
this.regionCache.putAndMoveToFirst(key, ret);
|
this.regionCache.putAndMoveToFirst(key, ret);
|
||||||
|
|
||||||
@@ -312,7 +332,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -312,7 +334,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO DIVINEMC - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // DivineMC - Rebrand
|
org.apache.logging.log4j.LogManager.getLogger().fatal(msg + " (" + file.toString().replaceAll(".+[\\\\/]", "") + " - " + x + "," + z + ") Go clean it up to remove this message. /minecraft:tp " + (x<<4)+" 128 "+(z<<4) + " - DO NOT REPORT THIS TO DIVINEMC - You may ask for help on Discord, but do not file an issue. These error messages can not be removed."); // DivineMC - Rebrand
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,7 +305,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
synchronized (regionfile) {
|
synchronized (regionfile) {
|
||||||
try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
|
try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
|
||||||
CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z);
|
CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z);
|
||||||
@@ -346,7 +366,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -346,7 +368,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
|
|
||||||
public @Nullable CompoundTag read(ChunkPos chunkPos) throws IOException {
|
public @Nullable CompoundTag read(ChunkPos chunkPos) throws IOException {
|
||||||
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
|
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
|
||||||
@@ -309,7 +314,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
if (regionFile == null) {
|
if (regionFile == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -385,7 +405,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -385,7 +407,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
|
|
||||||
public void scanChunk(ChunkPos chunkPos, StreamTagVisitor visitor) throws IOException {
|
public void scanChunk(ChunkPos chunkPos, StreamTagVisitor visitor) throws IOException {
|
||||||
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
|
// CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing
|
||||||
@@ -318,7 +323,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
if (regionFile == null) {
|
if (regionFile == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -400,7 +420,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -400,7 +422,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
|
|
||||||
public void write(ChunkPos chunkPos, @Nullable CompoundTag chunkData) throws IOException { // Paper - rewrite chunk system - public
|
public void write(ChunkPos chunkPos, @Nullable CompoundTag chunkData) throws IOException { // Paper - rewrite chunk system - public
|
||||||
if (!SharedConstants.DEBUG_DONT_SAVE_WORLD) {
|
if (!SharedConstants.DEBUG_DONT_SAVE_WORLD) {
|
||||||
@@ -327,7 +332,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
// Paper start - rewrite chunk system
|
// Paper start - rewrite chunk system
|
||||||
if (regionFile == null) {
|
if (regionFile == null) {
|
||||||
// if the RegionFile doesn't exist, no point in deleting from it
|
// if the RegionFile doesn't exist, no point in deleting from it
|
||||||
@@ -431,7 +451,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -431,7 +453,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
// Paper start - rewrite chunk system
|
// Paper start - rewrite chunk system
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
final ExceptionCollector<IOException> exceptionCollector = new ExceptionCollector<>();
|
final ExceptionCollector<IOException> exceptionCollector = new ExceptionCollector<>();
|
||||||
@@ -336,7 +341,7 @@ index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d
|
|||||||
try {
|
try {
|
||||||
regionFile.close();
|
regionFile.close();
|
||||||
} catch (final IOException ex) {
|
} catch (final IOException ex) {
|
||||||
@@ -447,7 +467,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
@@ -447,7 +469,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise
|
||||||
// Paper start - rewrite chunk system
|
// Paper start - rewrite chunk system
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
final ExceptionCollector<IOException> exceptionCollector = new ExceptionCollector<>();
|
final ExceptionCollector<IOException> exceptionCollector = new ExceptionCollector<>();
|
||||||
|
|||||||
@@ -1378,19 +1378,25 @@ index 775928cfe700202a70b19589ca72afd9768b62f1..2eda08301a3e3888c55a21390d1a718b
|
|||||||
+ // DivineMC end - lithium: sleeping_block_entity
|
+ // DivineMC end - lithium: sleeping_block_entity
|
||||||
}
|
}
|
||||||
diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a29720c2e 100644
|
index 4eb65b8df8069aa678c82092248e6ac3dde04160..050432808c8eeae659cd372641b8ff4d49f58da5 100644
|
||||||
--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
+++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
+++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
|
||||||
@@ -28,7 +28,7 @@ import net.minecraft.world.level.storage.ValueOutput;
|
@@ -28,7 +28,13 @@ import net.minecraft.world.level.storage.ValueOutput;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import org.jspecify.annotations.Nullable;
|
import org.jspecify.annotations.Nullable;
|
||||||
|
|
||||||
-public class HopperBlockEntity extends RandomizableContainerBlockEntity implements Hopper {
|
-public class HopperBlockEntity extends RandomizableContainerBlockEntity implements Hopper {
|
||||||
|
+// DivineMC start - lithium: sleeping_block_entity
|
||||||
|
+import net.minecraft.world.level.chunk.LevelChunk.RebindableTickingBlockEntityWrapper;
|
||||||
|
+import net.caffeinemc.mods.lithium.common.hopper.LithiumStackList;
|
||||||
|
+import net.caffeinemc.mods.lithium.api.inventory.LithiumInventory;
|
||||||
|
+// DivineMC end - lithium: sleeping_block_entity
|
||||||
|
+
|
||||||
+public class HopperBlockEntity extends RandomizableContainerBlockEntity implements Hopper, net.caffeinemc.mods.lithium.common.block.entity.SleepingBlockEntity, net.caffeinemc.mods.lithium.common.tracking.entity.ChunkSectionEntityMovementListener, net.caffeinemc.mods.lithium.api.inventory.LithiumInventory, net.caffeinemc.mods.lithium.common.block.entity.inventory_change_tracking.InventoryChangeListener, net.caffeinemc.mods.lithium.common.hopper.UpdateReceiver, net.caffeinemc.mods.lithium.common.block.entity.inventory_change_tracking.InventoryChangeTracker { // DivineMC - lithium: sleeping_block_entity
|
+public class HopperBlockEntity extends RandomizableContainerBlockEntity implements Hopper, net.caffeinemc.mods.lithium.common.block.entity.SleepingBlockEntity, net.caffeinemc.mods.lithium.common.tracking.entity.ChunkSectionEntityMovementListener, net.caffeinemc.mods.lithium.api.inventory.LithiumInventory, net.caffeinemc.mods.lithium.common.block.entity.inventory_change_tracking.InventoryChangeListener, net.caffeinemc.mods.lithium.common.hopper.UpdateReceiver, net.caffeinemc.mods.lithium.common.block.entity.inventory_change_tracking.InventoryChangeTracker { // DivineMC - lithium: sleeping_block_entity
|
||||||
public static final int MOVE_ITEM_SPEED = 8;
|
public static final int MOVE_ITEM_SPEED = 8;
|
||||||
public static final int HOPPER_CONTAINER_SIZE = 5;
|
public static final int HOPPER_CONTAINER_SIZE = 5;
|
||||||
private static final int[][] CACHED_SLOTS = new int[54][];
|
private static final int[][] CACHED_SLOTS = new int[54][];
|
||||||
@@ -119,6 +119,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -119,6 +125,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockState(BlockState blockState) {
|
public void setBlockState(BlockState blockState) {
|
||||||
@@ -1398,7 +1404,7 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
super.setBlockState(blockState);
|
super.setBlockState(blockState);
|
||||||
this.facing = blockState.getValue(HopperBlock.FACING);
|
this.facing = blockState.getValue(HopperBlock.FACING);
|
||||||
}
|
}
|
||||||
@@ -137,6 +138,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -137,6 +144,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
boolean result = tryMoveItems(level, pos, state, blockEntity, () -> {
|
boolean result = tryMoveItems(level, pos, state, blockEntity, () -> {
|
||||||
return suckInItems(level, blockEntity);
|
return suckInItems(level, blockEntity);
|
||||||
});
|
});
|
||||||
@@ -1406,7 +1412,7 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
if (!result && blockEntity.level.spigotConfig.hopperCheck > 1) {
|
if (!result && blockEntity.level.spigotConfig.hopperCheck > 1) {
|
||||||
blockEntity.setCooldown(blockEntity.level.spigotConfig.hopperCheck);
|
blockEntity.setCooldown(blockEntity.level.spigotConfig.hopperCheck);
|
||||||
}
|
}
|
||||||
@@ -199,6 +201,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -199,6 +207,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
if (flag) {
|
if (flag) {
|
||||||
blockEntity.setCooldown(level.spigotConfig.hopperTransfer); // Spigot
|
blockEntity.setCooldown(level.spigotConfig.hopperTransfer); // Spigot
|
||||||
setChanged(level, pos, state);
|
setChanged(level, pos, state);
|
||||||
@@ -1414,7 +1420,7 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -375,6 +378,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -375,6 +384,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
private static void applyCooldown(final Hopper hopper) {
|
private static void applyCooldown(final Hopper hopper) {
|
||||||
if (hopper instanceof HopperBlockEntity blockEntity && blockEntity.getLevel() != null) {
|
if (hopper instanceof HopperBlockEntity blockEntity && blockEntity.getLevel() != null) {
|
||||||
blockEntity.setCooldown(blockEntity.getLevel().spigotConfig.hopperTransfer);
|
blockEntity.setCooldown(blockEntity.getLevel().spigotConfig.hopperTransfer);
|
||||||
@@ -1422,7 +1428,7 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,11 +422,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -418,11 +428,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
// Paper end - Perf: Optimize Hoppers
|
// Paper end - Perf: Optimize Hoppers
|
||||||
|
|
||||||
private static boolean ejectItems(Level level, BlockPos pos, HopperBlockEntity blockEntity) {
|
private static boolean ejectItems(Level level, BlockPos pos, HopperBlockEntity blockEntity) {
|
||||||
@@ -1443,7 +1449,7 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
if (isFullContainer(attachedContainer, opposite)) {
|
if (isFullContainer(attachedContainer, opposite)) {
|
||||||
// DivineMC start - SparklyPaper: Allow throttling hopper checks if the target container is full
|
// DivineMC start - SparklyPaper: Allow throttling hopper checks if the target container is full
|
||||||
if (org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.hopperThrottleWhenFull && org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.hopperThrottleSkipTicks > 0) {
|
if (org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.hopperThrottleWhenFull && org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.hopperThrottleSkipTicks > 0) {
|
||||||
@@ -536,10 +548,18 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -536,10 +554,18 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
public static boolean suckInItems(Level level, Hopper hopper) {
|
public static boolean suckInItems(Level level, Hopper hopper) {
|
||||||
BlockPos blockPos = BlockPos.containing(hopper.getLevelX(), hopper.getLevelY() + 1.0, hopper.getLevelZ());
|
BlockPos blockPos = BlockPos.containing(hopper.getLevelX(), hopper.getLevelY() + 1.0, hopper.getLevelZ());
|
||||||
BlockState blockState = level.getBlockState(blockPos);
|
BlockState blockState = level.getBlockState(blockPos);
|
||||||
@@ -1463,7 +1469,7 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
|
|
||||||
for (int i : getSlots(sourceContainer, direction)) {
|
for (int i : getSlots(sourceContainer, direction)) {
|
||||||
if (tryTakeInItemFromSlot(hopper, sourceContainer, i, direction, level)) { // Spigot
|
if (tryTakeInItemFromSlot(hopper, sourceContainer, i, direction, level)) { // Spigot
|
||||||
@@ -551,7 +571,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -551,7 +577,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
} else {
|
} else {
|
||||||
boolean flag = hopper.isGridAligned() && blockState.isCollisionShapeFullBlock(level, blockPos) && !blockState.is(BlockTags.DOES_NOT_BLOCK_HOPPERS);
|
boolean flag = hopper.isGridAligned() && blockState.isCollisionShapeFullBlock(level, blockPos) && !blockState.is(BlockTags.DOES_NOT_BLOCK_HOPPERS);
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
@@ -1472,7 +1478,7 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
if (addItem(hopper, itemEntity)) {
|
if (addItem(hopper, itemEntity)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -720,7 +740,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -720,7 +746,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
private static @Nullable Container runHopperInventorySearchEvent(
|
private static @Nullable Container runHopperInventorySearchEvent(
|
||||||
@@ -1481,7 +1487,7 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
org.bukkit.craftbukkit.block.CraftBlock hopper,
|
org.bukkit.craftbukkit.block.CraftBlock hopper,
|
||||||
org.bukkit.craftbukkit.block.CraftBlock searchLocation,
|
org.bukkit.craftbukkit.block.CraftBlock searchLocation,
|
||||||
org.bukkit.event.inventory.HopperInventorySearchEvent.ContainerType containerType
|
org.bukkit.event.inventory.HopperInventorySearchEvent.ContainerType containerType
|
||||||
@@ -841,6 +861,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -841,6 +867,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCooldown(int cooldownTime) {
|
public void setCooldown(int cooldownTime) {
|
||||||
@@ -1501,7 +1507,7 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
this.cooldownTime = cooldownTime;
|
this.cooldownTime = cooldownTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -860,6 +893,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -860,6 +899,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
@Override
|
@Override
|
||||||
protected void setItems(NonNullList<ItemStack> items) {
|
protected void setItems(NonNullList<ItemStack> items) {
|
||||||
this.items = items;
|
this.items = items;
|
||||||
@@ -1509,13 +1515,13 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void entityInside(Level level, BlockPos pos, BlockState state, Entity entity, HopperBlockEntity blockEntity) {
|
public static void entityInside(Level level, BlockPos pos, BlockState state, Entity entity, HopperBlockEntity blockEntity) {
|
||||||
@@ -874,4 +908,749 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
@@ -874,4 +914,750 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
|
||||||
protected AbstractContainerMenu createMenu(int id, Inventory player) {
|
protected AbstractContainerMenu createMenu(int id, Inventory player) {
|
||||||
return new HopperMenu(id, player, this);
|
return new HopperMenu(id, player, this);
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // DivineMC start - lithium: sleeping_block_entity
|
+ // DivineMC start - lithium: sleeping_block_entity
|
||||||
+ @Nullable private net.minecraft.world.level.chunk.LevelChunk.RebindableTickingBlockEntityWrapper tickWrapper = null;
|
+ @Nullable private RebindableTickingBlockEntityWrapper tickWrapper = null;
|
||||||
+ @Nullable private TickingBlockEntity sleepingTicker = null;
|
+ @Nullable private TickingBlockEntity sleepingTicker = null;
|
||||||
+ private long myModCountAtLastInsert, myModCountAtLastExtract, myModCountAtLastItemCollect;
|
+ private long myModCountAtLastInsert, myModCountAtLastExtract, myModCountAtLastItemCollect;
|
||||||
+ private boolean skipNextSleepCheckAfterCooldown = false;
|
+ private boolean skipNextSleepCheckAfterCooldown = false;
|
||||||
@@ -1527,9 +1533,9 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
+ private Container insertBlockInventory, extractBlockInventory;
|
+ private Container insertBlockInventory, extractBlockInventory;
|
||||||
+
|
+
|
||||||
+ @Nullable
|
+ @Nullable
|
||||||
+ private net.caffeinemc.mods.lithium.api.inventory.LithiumInventory insertInventory, extractInventory;
|
+ private LithiumInventory insertInventory, extractInventory;
|
||||||
+ @Nullable
|
+ @Nullable
|
||||||
+ private net.caffeinemc.mods.lithium.common.hopper.LithiumStackList insertStackList, extractStackList;
|
+ private LithiumStackList insertStackList, extractStackList;
|
||||||
+ private long insertStackListModCount, extractStackListModCount;
|
+ private long insertStackListModCount, extractStackListModCount;
|
||||||
+
|
+
|
||||||
+ @Nullable
|
+ @Nullable
|
||||||
@@ -1660,7 +1666,7 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public @Nullable net.minecraft.world.level.chunk.LevelChunk.RebindableTickingBlockEntityWrapper lithium$getTickWrapper() {
|
+ public @Nullable RebindableTickingBlockEntityWrapper lithium$getTickWrapper() {
|
||||||
+ return tickWrapper;
|
+ return tickWrapper;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
@@ -2258,6 +2264,7 @@ index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a
|
|||||||
+ }
|
+ }
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
|
+ // DivineMC end - lithium: sleeping_block_entity
|
||||||
}
|
}
|
||||||
diff --git a/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
diff --git a/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java
|
||||||
index 61b99c895c0e248f0e7c4c634644dcff54a964d9..f07fd97545fa31b47b7dad32a2ab4ee5214e0d3e 100644
|
index 61b99c895c0e248f0e7c4c634644dcff54a964d9..f07fd97545fa31b47b7dad32a2ab4ee5214e0d3e 100644
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
private boolean isFirstPacket = true;
|
private boolean isFirstPacket = true;
|
||||||
private final Codec<PlayerAdvancements.Data> codec;
|
private final Codec<PlayerAdvancements.Data> codec;
|
||||||
- public final Map<net.minecraft.advancements.criterion.SimpleCriterionTrigger<?>, Set<CriterionTrigger.Listener<?>>> criterionData = new java.util.IdentityHashMap<>(); // Paper - fix advancement data player leakage
|
- public final Map<net.minecraft.advancements.criterion.SimpleCriterionTrigger<?>, Set<CriterionTrigger.Listener<?>>> criterionData = new java.util.IdentityHashMap<>(); // Paper - fix advancement data player leakage
|
||||||
+ public final Map<net.minecraft.advancements.critereon.SimpleCriterionTrigger<?>, Set<CriterionTrigger.Listener<?>>> criterionData = new it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap<>(); // Paper - fix advancement data player leakage // DivineMC - Use fastutil for criterion data
|
+ public final Map<net.minecraft.advancements.criterion.SimpleCriterionTrigger<?>, Set<CriterionTrigger.Listener<?>>> criterionData = new it.unimi.dsi.fastutil.objects.Reference2ReferenceOpenHashMap<>(); // Paper - fix advancement data player leakage // DivineMC - Use fastutil for criterion data
|
||||||
|
|
||||||
public PlayerAdvancements(DataFixer dataFixer, PlayerList playerList, ServerAdvancementManager manager, Path playerSavePath, ServerPlayer player) {
|
public PlayerAdvancements(DataFixer dataFixer, PlayerList playerList, ServerAdvancementManager manager, Path playerSavePath, ServerPlayer player) {
|
||||||
this.playerList = playerList;
|
this.playerList = playerList;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // DivineMC start - Fix MC-200418
|
+ // DivineMC start - Fix MC-200418
|
||||||
+ if (org.bxteam.divinemc.config.DivineConfig.FixesCategory.fixMc200418 && mob.isPassenger() && mob.getVehicle() instanceof net.minecraft.world.entity.animal.Chicken && mob.isBaby()) {
|
+ if (org.bxteam.divinemc.config.DivineConfig.FixesCategory.fixMc200418 && mob.isPassenger() && mob.getVehicle() instanceof net.minecraft.world.entity.animal.chicken.Chicken && mob.isBaby()) {
|
||||||
+ mob.removeVehicle();
|
+ mob.removeVehicle();
|
||||||
+ }
|
+ }
|
||||||
+ // DivineMC end - Fix MC-200418
|
+ // DivineMC end - Fix MC-200418
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Configuration
|
|||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 7e11dae67841cedde4a86e4d17000fc8dc1b32fb..f90beb922e041d3af8aad55e2656f424af14797b 100644
|
index 7e11dae67841cedde4a86e4d17000fc8dc1b32fb..9ed990da630c6385110dfdf5165a813bc39f9096 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
@@ -1007,6 +1007,7 @@ public final class CraftServer implements Server {
|
@@ -1007,6 +1007,7 @@ public final class CraftServer implements Server {
|
||||||
@@ -24,7 +24,7 @@ index 7e11dae67841cedde4a86e4d17000fc8dc1b32fb..f90beb922e041d3af8aad55e2656f424
|
|||||||
+ try {
|
+ try {
|
||||||
+ world.divineConfig.init();
|
+ world.divineConfig.init();
|
||||||
+ } catch (IOException e) {
|
+ } catch (IOException e) {
|
||||||
+ this.logger.log(Level.WARNING, "Failed to reload DivineMC configuration for world " + world.dimension().location(), e);
|
+ this.logger.log(Level.WARNING, "Failed to reload DivineMC configuration for world " + world.dimension().identifier(), e);
|
||||||
+ }
|
+ }
|
||||||
+ // DivineMC end - Configuration
|
+ // DivineMC end - Configuration
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public final class ReloadCommand extends DivineSubCommandPermission {
|
|||||||
try {
|
try {
|
||||||
level.divineConfig.init();
|
level.divineConfig.init();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
MinecraftServer.LOGGER.error("Failed to reload DivineMC world config for level {}", level.dimension().location(), e);
|
MinecraftServer.LOGGER.error("Failed to reload DivineMC world config for level {}", level.dimension().identifier(), e);
|
||||||
}
|
}
|
||||||
level.resetBreedingCooldowns();
|
level.resetBreedingCooldowns();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.bxteam.divinemc.util;
|
package org.bxteam.divinemc.util;
|
||||||
|
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import net.minecraft.Util;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.ByteBufCodecs;
|
import net.minecraft.network.codec.ByteBufCodecs;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.leavesmc.leaves.protocol.core.LeavesCustomPayload;
|
import org.leavesmc.leaves.protocol.core.LeavesCustomPayload;
|
||||||
import org.leavesmc.leaves.protocol.jade.JadeProtocol;
|
import org.leavesmc.leaves.protocol.jade.JadeProtocol;
|
||||||
@@ -20,7 +20,7 @@ import static org.leavesmc.leaves.protocol.jade.JadeProtocol.entityDataProviders
|
|||||||
public record RequestEntityPayload(EntityAccessorImpl.SyncData data, List<@Nullable IServerDataProvider<EntityAccessor>> dataProviders) implements LeavesCustomPayload {
|
public record RequestEntityPayload(EntityAccessorImpl.SyncData data, List<@Nullable IServerDataProvider<EntityAccessor>> dataProviders) implements LeavesCustomPayload {
|
||||||
|
|
||||||
@ID
|
@ID
|
||||||
private static final ResourceLocation PACKET_REQUEST_ENTITY = JadeProtocol.id("request_entity");
|
private static final Identifier PACKET_REQUEST_ENTITY = JadeProtocol.id("request_entity");
|
||||||
|
|
||||||
@Codec
|
@Codec
|
||||||
private static final StreamCodec<RegistryFriendlyByteBuf, RequestEntityPayload> CODEC = StreamCodec.composite(
|
private static final StreamCodec<RegistryFriendlyByteBuf, RequestEntityPayload> CODEC = StreamCodec.composite(
|
||||||
@@ -33,4 +33,4 @@ public record RequestEntityPayload(EntityAccessorImpl.SyncData data, List<@Nulla
|
|||||||
)),
|
)),
|
||||||
RequestEntityPayload::dataProviders,
|
RequestEntityPayload::dataProviders,
|
||||||
RequestEntityPayload::new);
|
RequestEntityPayload::new);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package org.leavesmc.leaves.protocol.jade.payload;
|
package org.leavesmc.leaves.protocol.jade.payload;
|
||||||
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.ByteBufCodecs;
|
import net.minecraft.network.codec.ByteBufCodecs;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import org.leavesmc.leaves.protocol.core.LeavesCustomPayload;
|
import org.leavesmc.leaves.protocol.core.LeavesCustomPayload;
|
||||||
import org.leavesmc.leaves.protocol.jade.JadeProtocol;
|
import org.leavesmc.leaves.protocol.jade.JadeProtocol;
|
||||||
@@ -18,25 +17,25 @@ import java.util.Map;
|
|||||||
import static org.leavesmc.leaves.protocol.jade.util.JadeCodec.PRIMITIVE_STREAM_CODEC;
|
import static org.leavesmc.leaves.protocol.jade.util.JadeCodec.PRIMITIVE_STREAM_CODEC;
|
||||||
|
|
||||||
public record ServerHandshakePayload(
|
public record ServerHandshakePayload(
|
||||||
Map<ResourceLocation, Object> serverConfig,
|
Map<Identifier, Object> serverConfig,
|
||||||
List<Block> shearableBlocks,
|
List<Block> shearableBlocks,
|
||||||
List<ResourceLocation> blockProviderIds,
|
List<Identifier> blockProviderIds,
|
||||||
List<ResourceLocation> entityProviderIds
|
List<Identifier> entityProviderIds
|
||||||
) implements LeavesCustomPayload {
|
) implements LeavesCustomPayload {
|
||||||
|
|
||||||
@ID
|
@ID
|
||||||
private static final ResourceLocation PACKET_SERVER_HANDSHAKE = JadeProtocol.id("server_handshake");
|
private static final Identifier PACKET_SERVER_HANDSHAKE = JadeProtocol.id("server_handshake");
|
||||||
|
|
||||||
@Codec
|
@Codec
|
||||||
private static final StreamCodec<RegistryFriendlyByteBuf, ServerHandshakePayload> CODEC = StreamCodec.composite(
|
private static final StreamCodec<RegistryFriendlyByteBuf, ServerHandshakePayload> CODEC = StreamCodec.composite(
|
||||||
ByteBufCodecs.map(Maps::newHashMapWithExpectedSize, ResourceLocation.STREAM_CODEC, PRIMITIVE_STREAM_CODEC),
|
ByteBufCodecs.map(Maps::newHashMapWithExpectedSize, Identifier.STREAM_CODEC, PRIMITIVE_STREAM_CODEC),
|
||||||
ServerHandshakePayload::serverConfig,
|
ServerHandshakePayload::serverConfig,
|
||||||
ByteBufCodecs.registry(Registries.BLOCK).apply(ByteBufCodecs.list()),
|
ByteBufCodecs.registry(Registries.BLOCK).apply(ByteBufCodecs.list()),
|
||||||
ServerHandshakePayload::shearableBlocks,
|
ServerHandshakePayload::shearableBlocks,
|
||||||
ByteBufCodecs.<ByteBuf, ResourceLocation>list().apply(ResourceLocation.STREAM_CODEC),
|
ByteBufCodecs.<ByteBuf, Identifier>list().apply(Identifier.STREAM_CODEC),
|
||||||
ServerHandshakePayload::blockProviderIds,
|
ServerHandshakePayload::blockProviderIds,
|
||||||
ByteBufCodecs.<ByteBuf, ResourceLocation>list().apply(ResourceLocation.STREAM_CODEC),
|
ByteBufCodecs.<ByteBuf, Identifier>list().apply(Identifier.STREAM_CODEC),
|
||||||
ServerHandshakePayload::entityProviderIds,
|
ServerHandshakePayload::entityProviderIds,
|
||||||
ServerHandshakePayload::new
|
ServerHandshakePayload::new
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ package org.leavesmc.leaves.protocol.jade.provider;
|
|||||||
|
|
||||||
import com.google.common.cache.Cache;
|
import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.LockCode;
|
import net.minecraft.world.LockCode;
|
||||||
import net.minecraft.world.RandomizableContainer;
|
import net.minecraft.world.RandomizableContainer;
|
||||||
import net.minecraft.world.WorldlyContainerHolder;
|
import net.minecraft.world.WorldlyContainerHolder;
|
||||||
import net.minecraft.world.entity.animal.horse.AbstractHorse;
|
import net.minecraft.world.entity.animal.equine.AbstractHorse;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.entity.vehicle.ContainerEntity;
|
import net.minecraft.world.entity.vehicle.ContainerEntity;
|
||||||
import net.minecraft.world.inventory.PlayerEnderChestContainer;
|
import net.minecraft.world.inventory.PlayerEnderChestContainer;
|
||||||
@@ -35,7 +35,7 @@ public enum ItemStorageExtensionProvider implements IServerExtensionProvider<Ite
|
|||||||
|
|
||||||
public static final Cache<Object, ItemCollector<?>> targetCache = CacheBuilder.newBuilder().weakKeys().expireAfterAccess(60, TimeUnit.SECONDS).build();
|
public static final Cache<Object, ItemCollector<?>> targetCache = CacheBuilder.newBuilder().weakKeys().expireAfterAccess(60, TimeUnit.SECONDS).build();
|
||||||
|
|
||||||
private static final ResourceLocation UNIVERSAL_ITEM_STORAGE = JadeProtocol.mc_id("item_storage.default");
|
private static final Identifier UNIVERSAL_ITEM_STORAGE = JadeProtocol.mc_id("item_storage.default");
|
||||||
|
|
||||||
public static ItemCollector<?> createItemCollector(Accessor<?> request) {
|
public static ItemCollector<?> createItemCollector(Accessor<?> request) {
|
||||||
if (request.getTarget() instanceof AbstractHorse) {
|
if (request.getTarget() instanceof AbstractHorse) {
|
||||||
@@ -134,7 +134,7 @@ public enum ItemStorageExtensionProvider implements IServerExtensionProvider<Ite
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getUid() {
|
public Identifier getUid() {
|
||||||
return UNIVERSAL_ITEM_STORAGE;
|
return UNIVERSAL_ITEM_STORAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.leavesmc.leaves.protocol.jade.provider.block;
|
|||||||
|
|
||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.block.ChiseledBookShelfBlock;
|
import net.minecraft.world.level.block.ChiseledBookShelfBlock;
|
||||||
import net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity;
|
import net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity;
|
||||||
@@ -18,7 +18,7 @@ import static net.minecraft.world.level.block.CampfireBlock.FACING;
|
|||||||
public enum ChiseledBookshelfProvider implements StreamServerDataProvider<BlockAccessor, ItemStack> {
|
public enum ChiseledBookshelfProvider implements StreamServerDataProvider<BlockAccessor, ItemStack> {
|
||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
private static final ResourceLocation MC_CHISELED_BOOKSHELF = JadeProtocol.mc_id("chiseled_bookshelf");
|
private static final Identifier MC_CHISELED_BOOKSHELF = JadeProtocol.mc_id("chiseled_bookshelf");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable ItemStack streamData(@NotNull BlockAccessor accessor) {
|
public @Nullable ItemStack streamData(@NotNull BlockAccessor accessor) {
|
||||||
@@ -35,7 +35,7 @@ public enum ChiseledBookshelfProvider implements StreamServerDataProvider<BlockA
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getUid() {
|
public Identifier getUid() {
|
||||||
return MC_CHISELED_BOOKSHELF;
|
return MC_CHISELED_BOOKSHELF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package org.leavesmc.leaves.protocol.jade.provider.entity;
|
|||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.resources.Identifier;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||||
import net.minecraft.world.entity.animal.Chicken;
|
import net.minecraft.world.entity.animal.chicken.Chicken;
|
||||||
import net.minecraft.world.entity.animal.armadillo.Armadillo;
|
import net.minecraft.world.entity.animal.armadillo.Armadillo;
|
||||||
import net.minecraft.world.entity.animal.sniffer.Sniffer;
|
import net.minecraft.world.entity.animal.sniffer.Sniffer;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package org.leavesmc.leaves.protocol.jade.provider.entity;
|
|||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.ByteBufCodecs;
|
import net.minecraft.network.codec.ByteBufCodecs;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -20,7 +20,7 @@ public enum StatusEffectsProvider implements StreamServerDataProvider<EntityAcce
|
|||||||
|
|
||||||
private static final StreamCodec<RegistryFriendlyByteBuf, List<MobEffectInstance>> STREAM_CODEC = ByteBufCodecs.<RegistryFriendlyByteBuf, MobEffectInstance>list()
|
private static final StreamCodec<RegistryFriendlyByteBuf, List<MobEffectInstance>> STREAM_CODEC = ByteBufCodecs.<RegistryFriendlyByteBuf, MobEffectInstance>list()
|
||||||
.apply(MobEffectInstance.STREAM_CODEC);
|
.apply(MobEffectInstance.STREAM_CODEC);
|
||||||
private static final ResourceLocation MC_POTION_EFFECTS = JadeProtocol.mc_id("potion_effects");
|
private static final Identifier MC_POTION_EFFECTS = JadeProtocol.mc_id("potion_effects");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -39,7 +39,7 @@ public enum StatusEffectsProvider implements StreamServerDataProvider<EntityAcce
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getUid() {
|
public Identifier getUid() {
|
||||||
return MC_POTION_EFFECTS;
|
return MC_POTION_EFFECTS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package org.leavesmc.leaves.protocol.jade.provider.entity;
|
|||||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.ByteBufCodecs;
|
import net.minecraft.network.codec.ByteBufCodecs;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.world.entity.monster.zombie.ZombieVillager;
|
import net.minecraft.world.entity.monster.zombie.ZombieVillager;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@@ -14,7 +14,7 @@ import org.leavesmc.leaves.protocol.jade.provider.StreamServerDataProvider;
|
|||||||
public enum ZombieVillagerProvider implements StreamServerDataProvider<EntityAccessor, Integer> {
|
public enum ZombieVillagerProvider implements StreamServerDataProvider<EntityAccessor, Integer> {
|
||||||
INSTANCE;
|
INSTANCE;
|
||||||
|
|
||||||
private static final ResourceLocation MC_ZOMBIE_VILLAGER = JadeProtocol.mc_id("zombie_villager");
|
private static final Identifier MC_ZOMBIE_VILLAGER = JadeProtocol.mc_id("zombie_villager");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable Integer streamData(@NotNull EntityAccessor accessor) {
|
public @Nullable Integer streamData(@NotNull EntityAccessor accessor) {
|
||||||
@@ -28,7 +28,7 @@ public enum ZombieVillagerProvider implements StreamServerDataProvider<EntityAcc
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getUid() {
|
public Identifier getUid() {
|
||||||
return MC_ZOMBIE_VILLAGER;
|
return MC_ZOMBIE_VILLAGER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.leavesmc.leaves.protocol.jade.util;
|
package org.leavesmc.leaves.protocol.jade.util;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.boss.EnderDragonPart;
|
|
||||||
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||||
|
import net.minecraft.world.entity.boss.enderdragon.EnderDragonPart;
|
||||||
import org.leavesmc.leaves.LeavesLogger;
|
import org.leavesmc.leaves.LeavesLogger;
|
||||||
import org.leavesmc.leaves.protocol.jade.accessor.Accessor;
|
import org.leavesmc.leaves.protocol.jade.accessor.Accessor;
|
||||||
import org.leavesmc.leaves.protocol.jade.provider.IServerExtensionProvider;
|
import org.leavesmc.leaves.protocol.jade.provider.IServerExtensionProvider;
|
||||||
@@ -37,7 +37,7 @@ public class CommonUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static <T> Map.Entry<ResourceLocation, List<ViewGroup<T>>> getServerExtensionData(
|
public static <T> Map.Entry<Identifier, List<ViewGroup<T>>> getServerExtensionData(
|
||||||
Accessor<?> accessor,
|
Accessor<?> accessor,
|
||||||
WrappedHierarchyLookup<IServerExtensionProvider<T>> lookup) {
|
WrappedHierarchyLookup<IServerExtensionProvider<T>> lookup) {
|
||||||
for (var provider : lookup.wrappedGet(accessor)) {
|
for (var provider : lookup.wrappedGet(accessor)) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.leavesmc.leaves.protocol.jade.util;
|
package org.leavesmc.leaves.protocol.jade.util;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import net.minecraft.advancements.critereon.ItemPredicate;
|
import net.minecraft.advancements.criterion.ItemPredicate;
|
||||||
import net.minecraft.core.Holder;
|
import net.minecraft.core.Holder;
|
||||||
import net.minecraft.core.HolderGetter;
|
import net.minecraft.core.HolderGetter;
|
||||||
import net.minecraft.core.registries.BuiltInRegistries;
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import io.netty.buffer.ByteBuf;
|
|||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.codec.ByteBufCodecs;
|
import net.minecraft.network.codec.ByteBufCodecs;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -40,9 +40,9 @@ public class ViewGroup<T> {
|
|||||||
ViewGroup::new);
|
ViewGroup::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <B extends ByteBuf, T> StreamCodec<B, Map.Entry<ResourceLocation, List<ViewGroup<T>>>> listCodec(StreamCodec<B, T> viewCodec) {
|
public static <B extends ByteBuf, T> StreamCodec<B, Map.Entry<Identifier, List<ViewGroup<T>>>> listCodec(StreamCodec<B, T> viewCodec) {
|
||||||
return StreamCodec.composite(
|
return StreamCodec.composite(
|
||||||
ResourceLocation.STREAM_CODEC,
|
Identifier.STREAM_CODEC,
|
||||||
Map.Entry::getKey,
|
Map.Entry::getKey,
|
||||||
ByteBufCodecs.<B, ViewGroup<T>>list().apply(codec(viewCodec)),
|
ByteBufCodecs.<B, ViewGroup<T>>list().apply(codec(viewCodec)),
|
||||||
Map.Entry::getValue,
|
Map.Entry::getValue,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package org.leavesmc.leaves.protocol.jade.util;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -84,7 +84,7 @@ public class WrappedHierarchyLookup<T extends IJadeProvider> extends HierarchyLo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadComplete(PriorityStore<ResourceLocation, IJadeProvider> priorityStore) {
|
public void loadComplete(PriorityStore<Identifier, IJadeProvider> priorityStore) {
|
||||||
for (var override : overrides) {
|
for (var override : overrides) {
|
||||||
override.getLeft().loadComplete(priorityStore);
|
override.getLeft().loadComplete(priorityStore);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.world.level.block.Mirror;
|
import net.minecraft.world.level.block.Mirror;
|
||||||
import net.minecraft.world.level.block.Rotation;
|
import net.minecraft.world.level.block.Rotation;
|
||||||
@@ -78,7 +78,7 @@ public class CommunicationManager implements LeavesProtocol {
|
|||||||
onPacket(player.connection.exchangeTarget, payload.packetType(), payload.data());
|
onPacket(player.connection.exchangeTarget, payload.packetType(), payload.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onPacket(final @NotNull ExchangeTarget source, final ResourceLocation id, final FriendlyByteBuf packetBuf) {
|
public static void onPacket(final @NotNull ExchangeTarget source, final Identifier id, final FriendlyByteBuf packetBuf) {
|
||||||
Exchange handler = null;
|
Exchange handler = null;
|
||||||
final Collection<Exchange> potentialMessageTarget = source.getExchanges();
|
final Collection<Exchange> potentialMessageTarget = source.getExchanges();
|
||||||
if (potentialMessageTarget != null) {
|
if (potentialMessageTarget != null) {
|
||||||
@@ -97,7 +97,7 @@ public class CommunicationManager implements LeavesProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static void handle(ExchangeTarget source, @NotNull ResourceLocation id, FriendlyByteBuf packetBuf) {
|
protected static void handle(ExchangeTarget source, @NotNull Identifier id, FriendlyByteBuf packetBuf) {
|
||||||
if (id.equals(PacketType.REQUEST_LITEMATIC.identifier)) {
|
if (id.equals(PacketType.REQUEST_LITEMATIC.identifier)) {
|
||||||
final UUID syncmaticaId = packetBuf.readUUID();
|
final UUID syncmaticaId = packetBuf.readUUID();
|
||||||
final ServerPlacement placement = SyncmaticaProtocol.getSyncmaticManager().getPlacement(syncmaticaId);
|
final ServerPlacement placement = SyncmaticaProtocol.getSyncmaticManager().getPlacement(syncmaticaId);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.leavesmc.leaves.protocol.syncmatica;
|
package org.leavesmc.leaves.protocol.syncmatica;
|
||||||
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
|
|
||||||
public enum PacketType {
|
public enum PacketType {
|
||||||
REGISTER_METADATA("register_metadata"),
|
REGISTER_METADATA("register_metadata"),
|
||||||
@@ -22,9 +22,9 @@ public enum PacketType {
|
|||||||
MODIFY_FINISH("modify_finish"),
|
MODIFY_FINISH("modify_finish"),
|
||||||
MESSAGE("mesage");
|
MESSAGE("mesage");
|
||||||
|
|
||||||
public final ResourceLocation identifier;
|
public final Identifier identifier;
|
||||||
|
|
||||||
PacketType(final String id) {
|
PacketType(final String id) {
|
||||||
identifier = ResourceLocation.tryBuild(SyncmaticaProtocol.PROTOCOL_ID, id);
|
identifier = Identifier.tryBuild(SyncmaticaProtocol.PROTOCOL_ID, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,17 +2,17 @@ package org.leavesmc.leaves.protocol.syncmatica;
|
|||||||
|
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.network.codec.StreamCodec;
|
import net.minecraft.network.codec.StreamCodec;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import org.leavesmc.leaves.protocol.core.LeavesCustomPayload;
|
import org.leavesmc.leaves.protocol.core.LeavesCustomPayload;
|
||||||
|
|
||||||
public record SyncmaticaPayload(ResourceLocation packetType, FriendlyByteBuf data) implements LeavesCustomPayload {
|
public record SyncmaticaPayload(Identifier packetType, FriendlyByteBuf data) implements LeavesCustomPayload {
|
||||||
|
|
||||||
@ID
|
@ID
|
||||||
private static final ResourceLocation NETWORK_ID = ResourceLocation.tryBuild(SyncmaticaProtocol.PROTOCOL_ID, "main");
|
private static final Identifier NETWORK_ID = Identifier.tryBuild(SyncmaticaProtocol.PROTOCOL_ID, "main");
|
||||||
|
|
||||||
@Codec
|
@Codec
|
||||||
private static final StreamCodec<FriendlyByteBuf, SyncmaticaPayload> CODEC = StreamCodec.of(
|
private static final StreamCodec<FriendlyByteBuf, SyncmaticaPayload> CODEC = StreamCodec.of(
|
||||||
(buf, payload) -> buf.writeResourceLocation(payload.packetType()).writeBytes(payload.data()),
|
(buf, payload) -> buf.writeIdentifier(payload.packetType()).writeBytes(payload.data()),
|
||||||
buf -> new SyncmaticaPayload(buf.readResourceLocation(), new FriendlyByteBuf(buf.readBytes(buf.readableBytes())))
|
buf -> new SyncmaticaPayload(buf.readIdentifier(), new FriendlyByteBuf(buf.readBytes(buf.readableBytes())))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.leavesmc.leaves.protocol.syncmatica.exchange;
|
|||||||
|
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.leavesmc.leaves.protocol.syncmatica.CommunicationManager;
|
import org.leavesmc.leaves.protocol.syncmatica.CommunicationManager;
|
||||||
import org.leavesmc.leaves.protocol.syncmatica.MessageType;
|
import org.leavesmc.leaves.protocol.syncmatica.MessageType;
|
||||||
@@ -37,7 +37,7 @@ public class DownloadExchange extends AbstractExchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPacket(final @NotNull ResourceLocation id, final FriendlyByteBuf packetBuf) {
|
public boolean checkPacket(final @NotNull Identifier id, final FriendlyByteBuf packetBuf) {
|
||||||
if (id.equals(PacketType.SEND_LITEMATIC.identifier)
|
if (id.equals(PacketType.SEND_LITEMATIC.identifier)
|
||||||
|| id.equals(PacketType.FINISHED_LITEMATIC.identifier)
|
|| id.equals(PacketType.FINISHED_LITEMATIC.identifier)
|
||||||
|| id.equals(PacketType.CANCEL_LITEMATIC.identifier)) {
|
|| id.equals(PacketType.CANCEL_LITEMATIC.identifier)) {
|
||||||
@@ -47,7 +47,7 @@ public class DownloadExchange extends AbstractExchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(final @NotNull ResourceLocation id, final @NotNull FriendlyByteBuf packetBuf) {
|
public void handle(final @NotNull Identifier id, final @NotNull FriendlyByteBuf packetBuf) {
|
||||||
packetBuf.readUUID();
|
packetBuf.readUUID();
|
||||||
if (id.equals(PacketType.SEND_LITEMATIC.identifier)) {
|
if (id.equals(PacketType.SEND_LITEMATIC.identifier)) {
|
||||||
final int size = packetBuf.readInt();
|
final int size = packetBuf.readInt();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.leavesmc.leaves.protocol.syncmatica.exchange;
|
|||||||
|
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.leavesmc.leaves.protocol.syncmatica.FeatureSet;
|
import org.leavesmc.leaves.protocol.syncmatica.FeatureSet;
|
||||||
import org.leavesmc.leaves.protocol.syncmatica.PacketType;
|
import org.leavesmc.leaves.protocol.syncmatica.PacketType;
|
||||||
@@ -15,13 +15,13 @@ public abstract class FeatureExchange extends AbstractExchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPacket(final @NotNull ResourceLocation id, final FriendlyByteBuf packetBuf) {
|
public boolean checkPacket(final @NotNull Identifier id, final FriendlyByteBuf packetBuf) {
|
||||||
return id.equals(PacketType.FEATURE_REQUEST.identifier)
|
return id.equals(PacketType.FEATURE_REQUEST.identifier)
|
||||||
|| id.equals(PacketType.FEATURE.identifier);
|
|| id.equals(PacketType.FEATURE.identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(final @NotNull ResourceLocation id, final FriendlyByteBuf packetBuf) {
|
public void handle(final @NotNull Identifier id, final FriendlyByteBuf packetBuf) {
|
||||||
if (id.equals(PacketType.FEATURE_REQUEST.identifier)) {
|
if (id.equals(PacketType.FEATURE_REQUEST.identifier)) {
|
||||||
sendFeatures();
|
sendFeatures();
|
||||||
} else if (id.equals(PacketType.FEATURE.identifier)) {
|
} else if (id.equals(PacketType.FEATURE.identifier)) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.leavesmc.leaves.protocol.syncmatica.exchange;
|
|||||||
|
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.leavesmc.leaves.protocol.syncmatica.CommunicationManager;
|
import org.leavesmc.leaves.protocol.syncmatica.CommunicationManager;
|
||||||
import org.leavesmc.leaves.protocol.syncmatica.PacketType;
|
import org.leavesmc.leaves.protocol.syncmatica.PacketType;
|
||||||
@@ -24,12 +24,12 @@ public class ModifyExchangeServer extends AbstractExchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPacket(final @NotNull ResourceLocation id, final FriendlyByteBuf packetBuf) {
|
public boolean checkPacket(final @NotNull Identifier id, final FriendlyByteBuf packetBuf) {
|
||||||
return id.equals(PacketType.MODIFY_FINISH.identifier) && checkUUID(packetBuf, placement.getId());
|
return id.equals(PacketType.MODIFY_FINISH.identifier) && checkUUID(packetBuf, placement.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(final @NotNull ResourceLocation id, final @NotNull FriendlyByteBuf packetBuf) {
|
public void handle(final @NotNull Identifier id, final @NotNull FriendlyByteBuf packetBuf) {
|
||||||
packetBuf.readUUID();
|
packetBuf.readUUID();
|
||||||
if (id.equals(PacketType.MODIFY_FINISH.identifier)) {
|
if (id.equals(PacketType.MODIFY_FINISH.identifier)) {
|
||||||
CommunicationManager.receivePositionData(placement, packetBuf, getPartner());
|
CommunicationManager.receivePositionData(placement, packetBuf, getPartner());
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.leavesmc.leaves.protocol.syncmatica.exchange;
|
|||||||
|
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.leavesmc.leaves.protocol.syncmatica.PacketType;
|
import org.leavesmc.leaves.protocol.syncmatica.PacketType;
|
||||||
import org.leavesmc.leaves.protocol.syncmatica.ServerPlacement;
|
import org.leavesmc.leaves.protocol.syncmatica.ServerPlacement;
|
||||||
@@ -28,7 +28,7 @@ public class UploadExchange extends AbstractExchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPacket(final @NotNull ResourceLocation id, final FriendlyByteBuf packetBuf) {
|
public boolean checkPacket(final @NotNull Identifier id, final FriendlyByteBuf packetBuf) {
|
||||||
if (id.equals(PacketType.RECEIVED_LITEMATIC.identifier)
|
if (id.equals(PacketType.RECEIVED_LITEMATIC.identifier)
|
||||||
|| id.equals(PacketType.CANCEL_LITEMATIC.identifier)) {
|
|| id.equals(PacketType.CANCEL_LITEMATIC.identifier)) {
|
||||||
return checkUUID(packetBuf, toUpload.getId());
|
return checkUUID(packetBuf, toUpload.getId());
|
||||||
@@ -37,7 +37,7 @@ public class UploadExchange extends AbstractExchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(final @NotNull ResourceLocation id, final @NotNull FriendlyByteBuf packetBuf) {
|
public void handle(final @NotNull Identifier id, final @NotNull FriendlyByteBuf packetBuf) {
|
||||||
packetBuf.readUUID();
|
packetBuf.readUUID();
|
||||||
if (id.equals(PacketType.RECEIVED_LITEMATIC.identifier)) {
|
if (id.equals(PacketType.RECEIVED_LITEMATIC.identifier)) {
|
||||||
send();
|
send();
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.leavesmc.leaves.protocol.syncmatica.exchange;
|
|||||||
|
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.Identifier;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.leavesmc.leaves.protocol.syncmatica.CommunicationManager;
|
import org.leavesmc.leaves.protocol.syncmatica.CommunicationManager;
|
||||||
import org.leavesmc.leaves.protocol.syncmatica.FeatureSet;
|
import org.leavesmc.leaves.protocol.syncmatica.FeatureSet;
|
||||||
@@ -19,13 +19,13 @@ public class VersionHandshakeServer extends FeatureExchange {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkPacket(final @NotNull ResourceLocation id, final FriendlyByteBuf packetBuf) {
|
public boolean checkPacket(final @NotNull Identifier id, final FriendlyByteBuf packetBuf) {
|
||||||
return id.equals(PacketType.REGISTER_VERSION.identifier)
|
return id.equals(PacketType.REGISTER_VERSION.identifier)
|
||||||
|| super.checkPacket(id, packetBuf);
|
|| super.checkPacket(id, packetBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(final @NotNull ResourceLocation id, final FriendlyByteBuf packetBuf) {
|
public void handle(final @NotNull Identifier id, final FriendlyByteBuf packetBuf) {
|
||||||
if (id.equals(PacketType.REGISTER_VERSION.identifier)) {
|
if (id.equals(PacketType.REGISTER_VERSION.identifier)) {
|
||||||
String partnerVersion = packetBuf.readUtf();
|
String partnerVersion = packetBuf.readUtf();
|
||||||
if (partnerVersion.equals("0.0.1")) {
|
if (partnerVersion.equals("0.0.1")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user