2021-06-15 04:59:31 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Tue, 7 Jul 2020 10:52:34 -0700
|
|
|
|
Subject: [PATCH] More World API
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
2021-08-25 09:59:26 +02:00
|
|
|
@@ -0,0 +0,0 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
2023-12-25 23:51:56 +01:00
|
|
|
return new CraftStructureSearchResult(CraftStructure.minecraftToBukkit(found.getSecond().value()), CraftLocation.toBukkit(found.getFirst(), this));
|
2021-06-15 04:59:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
|
|
|
+ public double getCoordinateScale() {
|
|
|
|
+ return getHandle().dimensionType().coordinateScale();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean isFixedTime() {
|
|
|
|
+ return getHandle().dimensionType().hasFixedTime();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Collection<org.bukkit.Material> getInfiniburn() {
|
2024-01-14 10:46:04 +01:00
|
|
|
+ return com.google.common.collect.Sets.newHashSet(com.google.common.collect.Iterators.transform(net.minecraft.core.registries.BuiltInRegistries.BLOCK.getTagOrEmpty(this.getHandle().dimensionType().infiniburn()).iterator(), blockHolder -> CraftBlockType.minecraftToBukkit(blockHolder.value())));
|
2021-06-15 04:59:31 +02:00
|
|
|
+ }
|
2021-08-21 16:26:42 +02:00
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void sendGameEvent(Entity sourceEntity, org.bukkit.GameEvent gameEvent, Vector position) {
|
2024-04-25 05:40:32 +02:00
|
|
|
+ getHandle().gameEvent(sourceEntity != null ? ((CraftEntity) sourceEntity).getHandle(): null, net.minecraft.core.registries.BuiltInRegistries.GAME_EVENT.getHolder(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(gameEvent.getKey())).orElseThrow(), org.bukkit.craftbukkit.util.CraftVector.toBlockPos(position));
|
2021-08-21 16:26:42 +02:00
|
|
|
+ }
|
2021-06-15 04:59:31 +02:00
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
@Override
|
2023-10-22 21:12:00 +02:00
|
|
|
public BiomeSearchResult locateNearestBiome(Location origin, int radius, Biome... biomes) {
|
|
|
|
return this.locateNearestBiome(origin, radius, 32, 64, biomes);
|
2021-08-21 16:26:42 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java b/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java
|
|
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftVector.java
|
|
|
|
@@ -0,0 +0,0 @@ public final class CraftVector {
|
|
|
|
public static net.minecraft.world.phys.Vec3 toNMS(org.bukkit.util.Vector bukkit) {
|
|
|
|
return new net.minecraft.world.phys.Vec3(bukkit.getX(), bukkit.getY(), bukkit.getZ());
|
|
|
|
}
|
|
|
|
+ // Paper start
|
|
|
|
+ public static org.bukkit.util.Vector toBukkit(net.minecraft.core.BlockPos blockPosition) {
|
|
|
|
+ return new org.bukkit.util.Vector(blockPosition.getX(), blockPosition.getY(), blockPosition.getZ());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static net.minecraft.core.BlockPos toBlockPos(org.bukkit.util.Vector bukkit) {
|
2023-03-15 00:10:18 +01:00
|
|
|
+ return net.minecraft.core.BlockPos.containing(bukkit.getX(), bukkit.getY(), bukkit.getZ());
|
2021-08-21 16:26:42 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|