summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUgleh <troti@ymail.com>2018-09-24 19:32:34 +1000
committermd_5 <git@md-5.net>2018-09-24 19:32:42 +1000
commitc1ecaa2ff772cb60bc8842267d3649564c21738c (patch)
treeeed864a7df15203b06ac719525ba78e0b9e09561 /src
parent5cffeca21fcb6266999d8b5fbda443eee58d996f (diff)
downloadcraftbukkit-c1ecaa2ff772cb60bc8842267d3649564c21738c.tar
craftbukkit-c1ecaa2ff772cb60bc8842267d3649564c21738c.tar.gz
craftbukkit-c1ecaa2ff772cb60bc8842267d3649564c21738c.tar.lz
craftbukkit-c1ecaa2ff772cb60bc8842267d3649564c21738c.tar.xz
craftbukkit-c1ecaa2ff772cb60bc8842267d3649564c21738c.zip
API to generate filled explorer maps
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftServer.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2d5dff3d..a0eefe04 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -37,6 +37,7 @@ import org.bukkit.Server;
import org.bukkit.UnsafeValues;
import org.bukkit.Warning.WarningState;
import org.bukkit.World;
+import org.bukkit.StructureType;
import org.bukkit.World.Environment;
import org.bukkit.WorldCreator;
import org.bukkit.boss.BarColor;
@@ -59,6 +60,7 @@ import org.bukkit.craftbukkit.generator.CraftChunkData;
import org.bukkit.craftbukkit.help.SimpleHelpMap;
import org.bukkit.craftbukkit.inventory.CraftFurnaceRecipe;
import org.bukkit.craftbukkit.inventory.CraftInventoryCustom;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.inventory.CraftItemFactory;
import org.bukkit.craftbukkit.inventory.CraftMerchantCustom;
import org.bukkit.craftbukkit.inventory.CraftRecipe;
@@ -96,6 +98,7 @@ import org.bukkit.inventory.Recipe;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.ShapelessRecipe;
import org.bukkit.loot.LootTable;
+import org.bukkit.map.MapView;
import org.bukkit.permissions.Permissible;
import org.bukkit.permissions.Permission;
import org.bukkit.plugin.Plugin;
@@ -1255,6 +1258,30 @@ public final class CraftServer implements Server {
}
@Override
+ public ItemStack createExplorerMap(World world, Location location, StructureType structureType) {
+ return this.createExplorerMap(world, location, structureType, 100, true);
+ }
+
+ @Override
+ public ItemStack createExplorerMap(World world, Location location, StructureType structureType, int radius, boolean findUnexplored) {
+ Validate.notNull(world, "World cannot be null");
+ Validate.notNull(structureType, "StructureType cannot be null");
+ Validate.notNull(structureType.getMapIcon(), "Cannot create explorer maps for StructureType " + structureType.getName());
+
+ WorldServer worldServer = ((CraftWorld) world).getHandle();
+ Location structureLocation = world.locateNearestStructure(location, structureType, radius, findUnexplored);
+ BlockPosition structurePosition = new BlockPosition(structureLocation.getBlockX(), structureLocation.getBlockY(), structureLocation.getBlockZ());
+
+ // Create map with trackPlayer = true, unlimitedTracking = true
+ net.minecraft.server.ItemStack stack = ItemWorldMap.a(worldServer, structurePosition.getX(), structurePosition.getZ(), MapView.Scale.NORMAL.getValue(), true, true); //PAIL rename setFilledMapView
+ ItemWorldMap.a(worldServer, stack); // PAIL rename sepiaMapFilter
+ // "+" map ID taken from EntityVillager
+ ItemWorldMap.getSavedMap(stack, worldServer).a(stack, structurePosition, "+", MapIcon.Type.a(structureType.getMapIcon().getValue())); // PAIL rename decorateMap
+
+ return CraftItemStack.asBukkitCopy(stack);
+ }
+
+ @Override
public void shutdown() {
console.safeShutdown();
}