Skip to content

Commit fc05696

Browse files
committed
Merge branch 'mc/1.13' into mc/1.12
2 parents 2228fc8 + e9b8675 commit fc05696

File tree

10 files changed

+270
-64
lines changed

10 files changed

+270
-64
lines changed

BlueMapBukkit/src/main/java/de/bluecolored/bluemap/bukkit/BukkitCommands.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public boolean execute(CommandSender sender, CommandSource source, String[] args
7373
}
7474
});
7575

76-
commands.add(new Command("bluemap.rendertask.create.world", "render") {
76+
commands.add(new Command("bluemap.render", "render") {
7777
@Override
7878
public boolean execute(CommandSender sender, CommandSource source, String[] args) {
7979
if (sender instanceof Player) {
@@ -113,7 +113,7 @@ public boolean execute(CommandSender sender, CommandSource source, String[] args
113113
}
114114
});
115115

116-
commands.add(new Command("bluemap.rendertask.prioritize", "render", "prioritize") {
116+
commands.add(new Command("bluemap.render", "render", "prioritize") {
117117
@Override
118118
public boolean execute(CommandSender sender, CommandSource source, String[] args) {
119119
if (args.length != 1) return false;
@@ -129,7 +129,7 @@ public boolean execute(CommandSender sender, CommandSource source, String[] args
129129
}
130130
});
131131

132-
commands.add(new Command("bluemap.rendertask.remove", "render", "remove") {
132+
commands.add(new Command("bluemap.render", "render", "remove") {
133133
@Override
134134
public boolean execute(CommandSender sender, CommandSource source, String[] args) {
135135
if (args.length != 1) return false;

BlueMapBukkit/src/main/resources/plugin.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ permissions:
2323
bluemap.reload: true
2424
bluemap.pause: true
2525
bluemap.resume: true
26-
bluemap.rendertask.create.world: true
27-
bluemap.rendertask.prioritize: true
28-
bluemap.rendertask.remove: true
26+
bluemap.render: true
2927
bluemap.debug: true
3028
default: op
3129
bluemap.status:
@@ -36,11 +34,7 @@ permissions:
3634
default: op
3735
bluemap.resume:
3836
default: op
39-
bluemap.rendertask.create.world:
40-
default: op
41-
bluemap.rendertask.prioritize:
42-
default: op
43-
bluemap.rendertask.remove:
37+
bluemap.render:
4438
default: op
4539
bluemap.debug:
4640
default: op

BlueMapCLI/build.gradle

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@ build.dependsOn shadowJar {
1313
destinationDir = file '../build/release'
1414
archiveFileName = "BlueMap-${version}-cli.jar"
1515

16-
relocate 'com.google', 'de.bluecolored.bluemap.google'
17-
relocate 'com.flowpowered', 'de.bluecolored.bluemap.flowpowered'
18-
relocate 'com.typesafe', 'de.bluecolored.bluemap.typesafe'
19-
relocate 'net.querz', 'de.bluecolored.bluemap.querz'
20-
relocate 'ninja', 'de.bluecolored.bluemap.ninja'
21-
relocate 'org.apache', 'de.bluecolored.bluemap.apache'
22-
relocate 'org.yaml', 'de.bluecolored.bluemap.yaml'
16+
relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math'
17+
relocate 'com.google.common', 'de.bluecolored.shadow.google.common'
18+
relocate 'com.google.gson', 'de.bluecolored.shadow.google.gson'
19+
relocate 'com.google.thirdparty', 'de.bluecolored.shadow.google.thirdparty'
20+
relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config'
21+
relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt'
22+
relocate 'ninja.leaping.configurate', 'de.bluecolored.shadow.ninja.leaping.configurate'
23+
relocate 'org.apache.commons.cli', 'de.bluecolored.shadow.apache.commons.cli'
24+
relocate 'org.apache.commons.io', 'de.bluecolored.shadow.apache.commons.io'
25+
relocate 'org.apache.commons.lang3', 'de.bluecolored.shadow.apache.commons.lang3'
26+
relocate 'org.bstats.bukkit', 'de.bluecolored.shadow.bstats.bukkit'
27+
relocate 'org.yaml.snakeyaml', 'de.bluecolored.shadow.yaml.snakeyaml'
2328
}

BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/plugin/Commands.java

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,58 @@ public boolean executeResumeCommand(CommandSource source) {
155155
}
156156
}
157157

158+
/**
159+
* Command: /bluemap render [world,map]
160+
*/
161+
public boolean executeRenderCommand(CommandSource source, String mapOrWorld) {
162+
return executeRenderCommand(source, mapOrWorld, null, -1);
163+
}
164+
165+
/**
166+
* Command: /bluemap render [world,map] [block-radius]
167+
*/
168+
public boolean executeRenderCommand(CommandSource source, String mapOrWorld, Vector2i center, int blockRadius) {
169+
if (!checkLoaded(source)) return false;
170+
171+
MapType map = null;
172+
World world = null;
173+
for (MapType m : bluemap.getMapTypes()) {
174+
if (mapOrWorld.equalsIgnoreCase(m.getId()) || mapOrWorld.equalsIgnoreCase(m.getName())){
175+
map = m;
176+
world = map.getWorld();
177+
break;
178+
}
179+
}
180+
181+
if (world == null) {
182+
for (World w : bluemap.getWorlds()) {
183+
if (mapOrWorld.equalsIgnoreCase(w.getName())){
184+
world = w;
185+
break;
186+
}
187+
}
188+
}
189+
190+
if (world == null) {
191+
source.sendMessage(Text.of(TextColor.RED, "Could not find a world or map with this name or id ", TextColor.GRAY, "('" + mapOrWorld + "')", TextColor.RED, "! Maybe it is not configured in BlueMap's config?"));
192+
}
193+
194+
world.invalidateChunkCache();
195+
196+
final World worldToRender = world;
197+
final MapType mapToRender = map;
198+
if (mapToRender == null) {
199+
new Thread(() -> {
200+
createWorldRenderTask(source, worldToRender, center, blockRadius);
201+
}).start();
202+
} else {
203+
new Thread(() -> {
204+
createMapRenderTask(source, mapToRender, center, blockRadius);
205+
}).start();
206+
}
207+
208+
return true;
209+
}
158210

159211
/**
160212
* Command: /bluemap render [world]
@@ -172,7 +224,7 @@ public boolean executeRenderWorldCommand(CommandSource source, UUID worldUuid, V
172224
World world = bluemap.getWorld(worldUuid);
173225

174226
if (world == null) {
175-
source.sendMessage(Text.of(TextColor.RED, "This world is not loaded with BlueMap! Maybe it is not configured?"));
227+
source.sendMessage(Text.of(TextColor.RED, "This world is not loaded with BlueMap! Maybe it is not configured in BlueMap's config?"));
176228
return false;
177229
}
178230

@@ -307,6 +359,36 @@ private void createWorldRenderTask(CommandSource source, World world, Vector2i c
307359
source.sendMessage(Text.of(TextColor.GREEN, "All render tasks created! Use /bluemap to view the progress!"));
308360
}
309361

362+
private void createMapRenderTask(CommandSource source, MapType map, Vector2i center, long blockRadius) {
363+
source.sendMessage(Text.of(TextColor.GOLD, "Collecting chunks to render..."));
364+
365+
String taskName = "world-render";
366+
367+
Predicate<Vector2i> filter;
368+
if (center == null || blockRadius < 0) {
369+
filter = c -> true;
370+
} else {
371+
filter = c -> c.mul(16).distanceSquared(center) <= blockRadius * blockRadius;
372+
taskName = "radius-render";
373+
}
374+
375+
Collection<Vector2i> chunks = map.getWorld().getChunkList(filter);
376+
377+
source.sendMessage(Text.of(TextColor.GREEN, chunks.size() + " chunks found!"));
378+
source.sendMessage(Text.of(TextColor.GOLD, "Collecting tiles for map '" + map.getId() + "'"));
379+
380+
HiresModelManager hmm = map.getTileRenderer().getHiresModelManager();
381+
Collection<Vector2i> tiles = hmm.getTilesForChunks(chunks);
382+
383+
RenderTask task = new RenderTask(taskName, map);
384+
task.addTiles(tiles);
385+
task.optimizeQueue();
386+
bluemap.getRenderManager().addRenderTask(task);
387+
388+
source.sendMessage(Text.of(TextColor.GREEN, tiles.size() + " tiles found! Task created."));
389+
source.sendMessage(Text.of(TextColor.GREEN, "All render tasks created! Use /bluemap to view the progress!"));
390+
}
391+
310392
private boolean checkLoaded(CommandSource source) {
311393
if (!bluemap.isLoaded()) {
312394
source.sendMessage(Text.of(TextColor.RED, "BlueMap is not loaded!", TextColor.GRAY, "(Try /bluemap reload)"));

BlueMapCommon/src/main/java/de/bluecolored/bluemap/common/plugin/Plugin.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,10 @@ public World getWorld(UUID uuid){
361361
return worlds.get(uuid);
362362
}
363363

364+
public Collection<World> getWorlds(){
365+
return worlds.values();
366+
}
367+
364368
public Collection<MapType> getMapTypes(){
365369
return maps.values();
366370
}

BlueMapCore/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies {
66
compile 'com.google.guava:guava:21.0'
77
compile 'com.google.code.gson:gson:2.8.0'
88
compile 'org.apache.commons:commons-lang3:3.5'
9-
compile group: 'commons-io', name: 'commons-io', version: '2.6'
9+
compile group: 'commons-io', name: 'commons-io', version: '2.5'
1010
compile 'com.flowpowered:flow-math:1.0.3'
1111
compile 'ninja.leaping.configurate:configurate-hocon:3.3'
1212
compile 'ninja.leaping.configurate:configurate-gson:3.3'

BlueMapForge/build.gradle

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ configurations {
2121

2222
dependencies {
2323
minecraft 'net.minecraftforge:forge:1.15.2-31.1.0'
24-
include project(':BlueMapCommon')
24+
25+
include (project(':BlueMapCommon')) {
26+
//exclude dependencies provided by forge
27+
exclude group: 'com.google.guava', module: 'guava'
28+
exclude group: 'com.google.code.gson', module: 'gson'
29+
exclude group: 'org.apache.commons', module: 'commons-lang3'
30+
exclude group: 'commons-io', module: 'commons-io'
31+
}
2532
}
2633

2734
build.dependsOn shadowJar {
@@ -30,13 +37,11 @@ build.dependsOn shadowJar {
3037

3138
configurations = [project.configurations.include]
3239

33-
relocate 'com.google', 'de.bluecolored.bluemap.google'
34-
relocate 'com.flowpowered', 'de.bluecolored.bluemap.flowpowered'
35-
relocate 'com.typesafe', 'de.bluecolored.bluemap.typesafe'
36-
relocate 'net.querz', 'de.bluecolored.bluemap.querz'
37-
relocate 'ninja', 'de.bluecolored.bluemap.ninja'
38-
relocate 'org.apache.commons', 'de.bluecolored.bluemap.apache.commons'
39-
relocate 'org.yaml', 'de.bluecolored.bluemap.yaml'
40+
relocate 'com.flowpowered.math', 'de.bluecolored.shadow.flowpowered.math'
41+
relocate 'com.typesafe.config', 'de.bluecolored.shadow.typesafe.config'
42+
relocate 'net.querz.nbt', 'de.bluecolored.shadow.querz.nbt'
43+
relocate 'ninja.leaping.configurate', 'de.bluecolored.shadow.ninja.leaping.configurate'
44+
relocate 'org.yaml.snakeyaml', 'de.bluecolored.shadow.yaml.snakeyaml'
4045
}
4146

4247
processResources {

0 commit comments

Comments
 (0)