From 8ed67f66adb6493a98627e6ea0f00f484122c062 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 14 Sep 2018 02:42:55 +1000 Subject: [PATCH] Merge boy0001/FastAsyncWorldEdit --- .../voxelsniper/brush/CleanSnowBrush.java | 1 + .../voxelsniper/brush/UnderlayBrush.java | 2 +- .../java/com/boydti/fawe/config/Settings.java | 2 +- .../java/com/sk89q/worldedit/EditSession.java | 21 ++++---- .../worldedit/regions/Polygonal2DRegion.java | 48 +++++++++++++++++++ .../regions/iterator/FlatRegionIterator.java | 2 +- .../com/sk89q/worldedit/util/Location.java | 7 +-- .../src/main/resources/de/message.yml | 36 ++++++++++---- .../src/main/resources/nl/message.yml | 37 ++++++++------ 9 files changed, 109 insertions(+), 47 deletions(-) diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CleanSnowBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CleanSnowBrush.java index da821f5b7..0be47492e 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CleanSnowBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/CleanSnowBrush.java @@ -1,5 +1,6 @@ package com.thevoxelbox.voxelsniper.brush; +import com.sk89q.worldedit.world.block.BlockTypes; import com.thevoxelbox.voxelsniper.Message; import com.thevoxelbox.voxelsniper.SnipeData; import com.thevoxelbox.voxelsniper.Undo; diff --git a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java index 2df4259d0..38e8ea2c3 100644 --- a/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java +++ b/favs/src/main/java/com/thevoxelbox/voxelsniper/brush/UnderlayBrush.java @@ -65,7 +65,7 @@ public class UnderlayBrush extends PerformBrush { for (int d = 0; (d < this.depth); d++) { - if (!this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z).isEmpty() + if (!this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z).isEmpty()) { this.current.perform(this.clampY(this.getTargetBlock().getX() + x, y + d, this.getTargetBlock().getZ() + z)); // fills down as many layers as you specify in // parameters diff --git a/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java b/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java index a3b42122e..8ab3a990b 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/config/Settings.java @@ -23,7 +23,7 @@ public class Settings extends Config { @Final public String PLATFORM; // These values are set from FAWE before loading - @Comment({"Options: de, ru, tr", + @Comment({"Options: de, es, fr, nl, ru, tr", "Create a PR to contribute a translation: https://github.com/boy0001/FastAsyncWorldedit/new/master/core/src/main/resources",}) public String LANGUAGE = ""; @Comment({"Enable or disable automatic updates", diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 80ea4fe60..5f5c29c8e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -1785,21 +1785,16 @@ public class EditSession extends AbstractDelegateExtent implements HasFaweQueue, if (region instanceof CuboidRegion) { return this.makeCuboidWalls(region, pattern); } else { - final int minY = region.getMinimumPoint().getBlockY(); - final int maxY = region.getMaximumPoint().getBlockY(); - final ArbitraryShape shape = new RegionShape(region) { - @Override - public BlockStateHolder getMaterial(final int x, final int y, final int z, final BlockStateHolder defaultMaterial) { - if ((y > maxY) || (y < minY)) { - // Put holes into the floor and ceiling by telling ArbitraryShape that the shape goes on outside the region - return defaultMaterial; - } - - return super.getMaterial(x, y, z, defaultMaterial); + for (BlockVector position : region) { + int x = position.getBlockX(); + int y = position.getBlockY(); + int z = position.getBlockZ(); + if (!region.contains(x, z + 1) || !region.contains(x, z - 1) || !region.contains(x + 1, z) || !region.contains(x - 1, z)) { + setBlock(position, pattern); } - }; - return shape.generate(this, pattern, true); + } } + return changes; } /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java index b7d607d9d..4371aec40 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java @@ -293,6 +293,54 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { recalculate(); } + @Override + public boolean contains(int targetX, int targetZ) { + boolean inside = false; + int npoints = points.size(); + int xNew, zNew; + int xOld, zOld; + int x1, z1; + int x2, z2; + long crossproduct; + int i; + + xOld = points.get(npoints - 1).getBlockX(); + zOld = points.get(npoints - 1).getBlockZ(); + + for (i = 0; i < npoints; ++i) { + xNew = points.get(i).getBlockX(); + zNew = points.get(i).getBlockZ(); + //Check for corner + if (xNew == targetX && zNew == targetZ) { + return true; + } + if (xNew > xOld) { + x1 = xOld; + x2 = xNew; + z1 = zOld; + z2 = zNew; + } else { + x1 = xNew; + x2 = xOld; + z1 = zNew; + z2 = zOld; + } + if (x1 <= targetX && targetX <= x2) { + crossproduct = ((long) targetZ - (long) z1) * (long) (x2 - x1) + - ((long) z2 - (long) z1) * (long) (targetX - x1); + if (crossproduct == 0) { + if ((z1 <= targetZ) == (targetZ <= z2)) return true; //on edge + } else if (crossproduct < 0 && (x1 != targetX)) { + inside = !inside; + } + } + xOld = xNew; + zOld = zNew; + } + + return inside; + } + @Override public boolean contains(Vector position) { return contains(points, minY, maxY, position); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java index 6657613b2..803ce55a5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/iterator/FlatRegionIterator.java @@ -64,7 +64,7 @@ public class FlatRegionIterator implements Iterator { } private void forward() { - while (hasNext() && !region.contains(new Vector(nextX, y, nextZ))) { + while (hasNext() && !region.contains(nextX, y, nextZ)) { forwardOne(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java index 4bef9493a..98814eb4a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/Location.java @@ -339,11 +339,6 @@ public class Location extends Vector { @Override public int hashCode() { - int result = extent.hashCode(); - result = 31 * result + this.hashCode(); - result = 31 * result + Float.floatToIntBits(this.pitch); - result = 31 * result + Float.floatToIntBits(this.yaw); - return result; + return super.hashCode(); } - } diff --git a/worldedit-core/src/main/resources/de/message.yml b/worldedit-core/src/main/resources/de/message.yml index 88e79bff5..6cbb487e3 100644 --- a/worldedit-core/src/main/resources/de/message.yml +++ b/worldedit-core/src/main/resources/de/message.yml @@ -1,6 +1,6 @@ -#Adjusted and updated by NotMyFault +#Updated by NotMyFault info: - prefix: '&4&lFAWE:&f&7' + prefix: '&8(&4&lFAWE&8)&r&7' schematic_pasting: '&7Die Schematic wird eingefügt. Dies kann nicht rückgängig gemacht werden.' updated_lighting_selection: '&7Das Licht wird in %s0 Chunks aktualisiert. (Es kann @@ -163,9 +163,13 @@ worldedit: brush_target_mask_set: Zielmaske auf %s0 gesetzt brush_target_offset_set: Zielausrichtung auf %s0 gesetzt brush_equipped: Brush %s0 ausgerüstet - brush_line_primary: Punkt %s0 hinzugefügt, klicke auf eine andere Position um die Linie zu erstellen + brush_line_primary: Punkt %s0 hinzugefügt, klicke auf eine andere Position um + die Linie zu erstellen brush_line_secondary: Spline erstellt - brush_spline_primary_2: Position hinzugefügt, klicke auf die gleiche Postiion um zu beginnen! + brush_spline_primary_2: Position hinzugefügt, klicke auf die gleiche Position + um zu beginnen! + brush_catenary_direction: Punkt %s0 hinzugefügt, klicke in die Richtung in der + du die spline generieren willst rollback: rollback_element: annulliere %s0 tool: @@ -247,7 +251,8 @@ worldedit: navigation: navigation_wand_error: '&cNichts zu durchqueren' anvil: - world_is_loaded: Die Welt sollte nicht in Benutzung sein währen der Ausführung. Entlade die Welt, oder überschreibe diese mit -f (vorher speichern) + world_is_loaded: Die Welt sollte nicht in Benutzung sein währen der Ausführung. + Entlade die Welt, oder überschreibe diese mit -f (vorher speichern) help: command_clarifying_bracket: '&7Klammer für&c%s0 wurde hinzugefügt' help_suggest: '&7%s0 konnte nicht gefunden werden. Versuche &c%s1 &7' @@ -274,10 +279,10 @@ cancel: worldedit_cancel_reason_no_region: Keine erlaubte Region (Ignorieren mit /wea) worldedit_failed_load_chunk: '&cÜberspringe das Laden von Chunk: &7%s0;%s1&c. Versuche chunk-wait zu erhöhen.' - worldedit_cancel_reason_confirm: '&7Deine Selektion ist zu groß (%s0 -> %s1). Benutze &c//confirm - &7um &c%s2 auszuführen' + worldedit_cancel_reason_confirm: '&7Deine Selektion ist zu groß (%s0 -> %s1). Benutze + &c//confirm &7um &c%s2 auszuführen' worldedit_cancel_reason_outside_level: Außerhalb der Welt - worldedit_cancel_reason_outside_region: Außerhalb erlaubter Region (Bypass mit /wea, + worldedit_cancel_reason_outside_region: Außerhalb erlaubter Region (Umgehe mit /wea, oder deaktiviere `region-restrictions` in der config.yml) history: {} navigation: @@ -312,7 +317,7 @@ tips: tip_download: 'Tipp: Du kannst deine Zwischenablage mit `//download` herunterladen' tip_sel_list: 'Tipp: Liste die verschiedenen Selektoren auf mit &c//sel list' tip_select_connected: 'Tipp: Wähle alle verbundenen Blöcke mit //sel fuzzy' - tip_set_pos1: 'Tipp: Nutze pos1 als Muster &c//set pos1' + tip_set_pos1: 'Tipp: Nutze Position1 als Muster &c//set pos1' tip_farwand: 'Tipp: Markiere entferne Blöcke mit &c//farwand' tip_fast: '&7Tipp: Platziere schnell und ohne Undo-Historie &c//fast' tip_mask: '&7Tipp: Setze eine Globale Zielmaske mit &c/gmask' @@ -338,5 +343,16 @@ tips: tip_lazycut: '&7Tipp: Es ist sicherer den Befehl &c//lazycut zu verwenden.' tip_regen_0: 'Tipp: Benutze ein Biom mit /regen [biome]' tip_regen_1: 'Tipp: Benutzte einen Seed mit /regen [biome] [seed]' - tip_biome_pattern: 'Tipp: Das &c#biome[forest]&7 Muster kann in jedem Befehl genutzt werden' + tip_biome_pattern: 'Tipp: Das &c#biome[forest]&7 Muster kann in jedem Befehl genutzt + werden' tip_biome_mask: 'Tipp: Beschränke ein Biom mit der `$jungle` Maske' + tip_discord: Du benötigst Hilfe mit FAWE? https://discord.gg/ngZCzbU + tip_replace_regex: '&7Tipp: Ersetze mit regex:&c //replace .*_log ' + tip_replace_regex_2: '&7Tipp: Ersetze mit regex:&c //replace .*stairs[facing=(north|south)] + ' + tip_replace_regex_3: '&7Tipp: Ersetze mit den folgenden Operatoren:&c //replace + water[level>2] sand' + tip_replace_regex_4: '&7Tipp: Ersetze mit den folgenden Operatoren:&c //replace + true *[waterlogged=false]' + tip_replace_regex_5: '&7Tipp: Ersetze mit den folgenden Operatoren:&c //replace + true *[level-=1]' diff --git a/worldedit-core/src/main/resources/nl/message.yml b/worldedit-core/src/main/resources/nl/message.yml index 68bea5edc..f0822aaea 100644 --- a/worldedit-core/src/main/resources/nl/message.yml +++ b/worldedit-core/src/main/resources/nl/message.yml @@ -112,7 +112,7 @@ worldedit: selection_chunk: Chunk geselecteerd (%s0) selection_chunks: Chunks geselecteerd (%s0) - (%s1) selection_contract: Region contracted %s0 blokken. - selection_count: %s0 Blokken geteld. + selection_count: '%s0 Blokken geteld.' selection_distr: '# Totaal aantal blokken: %s0' selection_expand: Regio vergroot met %s0 blokken. selection_expand_vert: Regio vergroot met %s0 blokken (van boven naar beneden) @@ -134,14 +134,14 @@ worldedit: brush_target_mode_set: Target mode gezet naar %s0 brush_target_mask_set: Target mode gezet naar %s0 brush_target_offset_set: Uitschietting van de target gezet tot %s0 - brush_equipped: Brush in gebruik: %s0 + brush_equipped: Brush in gebruik %s0 brush_try_other: |- &cEr zijn betere brushes hier voor te gebruiken e.g. &8 - &7//br height [radius=5] [#clipboard|file=null] [rotation=0] [yscale=1.00] - brush_copy: Links klik de fundering van de constructie om te kopieëren, rechts klik om te plakken. verhoog - de brush Settings als dat mogelijk is. + brush_copy: Links klik de fundering van de constructie om te kopieëren, rechts klik om te plakken. Verhoog + de brush Settings als dat mogelijk is. brush_height_invalid: Onvalide hoogte map file (%s0) - brush_smooth: 'Note: Gebruik de blend brush om caves en hangende dingen glad te krijgen.' + brush_smooth: Gebruik de blend brush om caves en hangende dingen glad te krijgen.' brush_spline: Klik Om een bevestigingspunt te zetten, klik hetzelfde punt om het af te ronden. brush_line_primary: Punt %s0 toegevoegt, klik op een andere locatie om de lijn te creëeren. brush_catenary_direction: Punt %s0 toegevoegt, klik naar de directie waar je @@ -160,7 +160,7 @@ worldedit: brush_transform: Brush transform gezet brush_material: Brush material gezet rollback: - rollback_element: %s0 aan het ontdaan maken. + rollback_element: aan %s0 het ontdaan maken. tool: tool_inspect: Inspect tool gebonden aan %s0. tool_inspect_info: '&7%s0 veranderd %s1 to %s2 %s3 geleden' @@ -191,7 +191,7 @@ worldedit: biome_list_header: 'Biomes (page %s0/%s1):' biome_changed: Biotopen zijn veranderd in %s0 columns. utility: - kill_success: %s0 entities zijn vermoord in een radius van %s1. + kill_success: entities %s0 zijn vermoord in een radius van %s1. nothing_confirmed: Je hebt geen acties die bevestigt moeten worden. page_footer: Gebruik %s0 om naar de volgende pagina te gaan schematic: @@ -269,11 +269,11 @@ cancel: chunk-wait op te krikken.' navigation: ascend_fail: Geen vrije plekken boven je gesignaleerd. - ascended_plural: %s0 levels verlaagt. + ascended_plural: levels %s0 verlaagt. ascended_singular: Ascended a level. unstuck: There you go! descend_fail: geen vrije plekken onder je gesignaleerd. - descend_plural: %s0 levels gedaald. + descend_plural: levels %s0 gedaald. descend_singular: Een level gedaald. whoosh: Whoosh! poof: Poof! @@ -308,9 +308,15 @@ tips: tip_set_linear: '&7Tip: Zet een blok lineaire met &c//set #l3d[wood,bedrock]' tip_surface_spread: '&7Tip: Verpsreid een oppervlakte met &c//set #surfacespread[5][0][5][#existing]' tip_set_hand: '&7Tip: Gebruik je huide hand met &c//set hand' + tip_replace_regex: '&7&7Tip: Vervang door regex:&c //replace .*_log ' + tip_replace_regex_2: '&7&7Tip: Vervang door regex:&c //replace .*stairs[facing=(north|south)] + ' + tip_replace_regex_3: '&7&7Tip: Vervang door operators:&c //replace water[level>2] + sand' + tip_replace_regex_4: '&7&7Tip: Vervang door operators:&c //replace true *[waterlogged=false]' + tip_replace_regex_5: '&7&7Tip: Vervang door operators:&c //replace true *[level-=1]' tip_replace_id: '&7Tip: Vervang alleen het blok id:&c//replace woodenstair #id[cobblestair]' - tip_replace_light: 'Tip: Verwijder licht met with&c//replace #brightness[1][15] - 0 + tip_replace_light: 'Tip: Verwijder licht met with&c//replace #brightness[1][15]' tip_tab_complete: 'Tip: The replace command supports tab completion' tip_flip: 'Tip: Mirror met &c//flip' tip_deform: 'Tip: Verander het van vorm met &c//deform' @@ -321,11 +327,12 @@ tips: tip_replace_marker: 'Tip: verander een blok in je volle klipbord met &c//replace wool #fullcopy' tip_paste: 'Tip: Plaats met &c//paste' - tip_lazycopy: 'Tip: lazycopy is sneller' - tip_download: 'Tip: probeer &c//download' - tip_rotate: 'Tip: orïenteer met &c//rotate' + tip_lazycopy: 'Tip: Lazycopy is sneller' + tip_download: 'Tip: Probeer &c//download' + tip_rotate: 'Tip: Orïenteer met &c//rotate' tip_copy_pattern: 'Tip: Om een pattern te gebruiken, probeer &c#copy' tip_regen_0: 'Tip: Gebruik een biome met /regen [biome]' - tip_regen_1: 'Tip: gebruik een seed met /regen [biome] [seed]' + tip_regen_1: 'Tip: Gebruik een seed met /regen [biome] [seed]' tip_biome_pattern: 'Tip: Dee &c#biome[forest]&7 pattern kan ik elke opdracht gebruikt worden' tip_biome_mask: 'Tip: Er wordt een restrictie geplaatst op de biome met `$jungle` mask' + tip_discord: 'Heb je hulp nodig bij FAWE? https://discord.gg/ngZCzbU'