aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/server/commands/PlaceCommand.java.patch
blob: 56cb1597d92b2d5e329de6ef288ad554918b3b14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--- a/net/minecraft/server/commands/PlaceCommand.java
+++ b/net/minecraft/server/commands/PlaceCommand.java
@@ -278,30 +130,20 @@
         if (!structureStart.isValid()) {
             throw ERROR_STRUCTURE_FAILED.create();
         } else {
-            BoundingBox boundingBox = structureStart.getBoundingBox();
-            ChunkPos chunkPos = new ChunkPos(SectionPos.blockToSectionCoord(boundingBox.minX()), SectionPos.blockToSectionCoord(boundingBox.minZ()));
-            ChunkPos chunkPos1 = new ChunkPos(SectionPos.blockToSectionCoord(boundingBox.maxX()), SectionPos.blockToSectionCoord(boundingBox.maxZ()));
-            checkLoaded(level, chunkPos, chunkPos1);
-            ChunkPos.rangeClosed(chunkPos, chunkPos1)
-                .forEach(
-                    chunkPos2 -> structureStart.placeInChunk(
-                            level,
-                            level.structureManager(),
-                            generator,
-                            level.getRandom(),
-                            new BoundingBox(
-                                chunkPos2.getMinBlockX(),
-                                level.getMinBuildHeight(),
-                                chunkPos2.getMinBlockZ(),
-                                chunkPos2.getMaxBlockX(),
-                                level.getMaxBuildHeight(),
-                                chunkPos2.getMaxBlockZ()
-                            ),
-                            chunkPos2
-                        )
-                );
-            String string = structure.key().location().toString();
-            source.sendSuccess(() -> Component.translatable("commands.place.structure.success", string, pos.getX(), pos.getY(), pos.getZ()), true);
+            structurestart.generationEventCause = org.bukkit.event.world.AsyncStructureGenerateEvent.Cause.COMMAND; // CraftBukkit - set AsyncStructureGenerateEvent.Cause.COMMAND as generation cause
+            BoundingBox structureboundingbox = structurestart.getBoundingBox();
+            ChunkPos chunkcoordintpair = new ChunkPos(SectionPos.blockToSectionCoord(structureboundingbox.minX()), SectionPos.blockToSectionCoord(structureboundingbox.minZ()));
+            ChunkPos chunkcoordintpair1 = new ChunkPos(SectionPos.blockToSectionCoord(structureboundingbox.maxX()), SectionPos.blockToSectionCoord(structureboundingbox.maxZ()));
+
+            checkLoaded(worldserver, chunkcoordintpair, chunkcoordintpair1);
+            ChunkPos.rangeClosed(chunkcoordintpair, chunkcoordintpair1).forEach((chunkcoordintpair2) -> {
+                structurestart.placeInChunk(worldserver, worldserver.structureManager(), chunkgenerator, worldserver.getRandom(), new BoundingBox(chunkcoordintpair2.getMinBlockX(), worldserver.getMinBuildHeight(), chunkcoordintpair2.getMinBlockZ(), chunkcoordintpair2.getMaxBlockX(), worldserver.getMaxBuildHeight(), chunkcoordintpair2.getMaxBlockZ()), chunkcoordintpair2);
+            });
+            String s = structure.key().location().toString();
+
+            source.sendSuccess(() -> {
+                return Component.translatable("commands.place.structure.success", s, pos.getX(), pos.getY(), pos.getZ());
+            }, true);
             return 1;
         }
     }