├── .github ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md └── ISSUE_TEMPLATE │ └── config.yml ├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── bukkit ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ ├── boydti │ │ └── fawe │ │ │ └── bukkit │ │ │ ├── BukkitCommand.java │ │ │ ├── BukkitMain.java │ │ │ ├── BukkitPlayer.java │ │ │ ├── FaweBukkit.java │ │ │ ├── Metrics.java │ │ │ ├── block │ │ │ └── BrushBoundBaseBlock.java │ │ │ ├── chat │ │ │ ├── ArrayWrapper.java │ │ │ ├── BukkitChatManager.java │ │ │ ├── FancyMessage.java │ │ │ ├── JsonRepresentedObject.java │ │ │ ├── JsonString.java │ │ │ ├── MessagePart.java │ │ │ ├── Reflection.java │ │ │ └── TextualComponent.java │ │ │ ├── filter │ │ │ ├── GriefPreventionFilter.java │ │ │ └── WorldGuardFilter.java │ │ │ ├── listener │ │ │ ├── BrushListener.java │ │ │ ├── BukkitImageListener.java │ │ │ ├── CFIPacketListener.java │ │ │ └── RenderListener.java │ │ │ ├── regions │ │ │ ├── ASkyBlockHook.java │ │ │ ├── BukkitMask.java │ │ │ ├── BukkitMaskManager.java │ │ │ ├── FactionsFeature.java │ │ │ ├── FactionsOneFeature.java │ │ │ ├── FreeBuildRegion.java │ │ │ ├── GriefPreventionFeature.java │ │ │ ├── PlotMeFeature.java │ │ │ ├── ResidenceFeature.java │ │ │ ├── TownyFeature.java │ │ │ └── Worldguard.java │ │ │ ├── util │ │ │ ├── BukkitReflectionUtils.java │ │ │ ├── BukkitTaskMan.java │ │ │ ├── ItemUtil.java │ │ │ ├── VaultUtil.java │ │ │ ├── cui │ │ │ │ ├── CUIListener.java │ │ │ │ └── StructureCUI.java │ │ │ └── image │ │ │ │ └── BukkitImageViewer.java │ │ │ ├── v0 │ │ │ ├── BukkitChunk_All.java │ │ │ ├── BukkitChunk_All_ReadonlySnapshot.java │ │ │ ├── BukkitQueue_0.java │ │ │ ├── BukkitQueue_All.java │ │ │ ├── ChunkListener.java │ │ │ ├── ChunkListener_8.java │ │ │ ├── ChunkListener_8Plus.java │ │ │ ├── ChunkListener_9.java │ │ │ ├── FaweAdapter_All.java │ │ │ └── PaperChunkCallback.java │ │ │ ├── v1_10 │ │ │ ├── BukkitChunk_1_10.java │ │ │ ├── BukkitChunk_1_10_Copy.java │ │ │ ├── BukkitQueue_1_10.java │ │ │ ├── FaweAdapter_1_10.java │ │ │ └── MutableGenLayer.java │ │ │ ├── v1_11 │ │ │ ├── BukkitChunk_1_11.java │ │ │ ├── BukkitChunk_1_11_Copy.java │ │ │ ├── BukkitQueue_1_11.java │ │ │ ├── FaweAdapter_1_11.java │ │ │ └── MutableGenLayer.java │ │ │ ├── v1_12 │ │ │ ├── BukkitChunk_1_12.java │ │ │ ├── BukkitChunk_1_12_Copy.java │ │ │ ├── BukkitQueue_1_12.java │ │ │ ├── FaweAdapter_1_12.java │ │ │ ├── MutableGenLayer.java │ │ │ ├── NMSRegistryDumper.java │ │ │ └── packet │ │ │ │ ├── BitArray.java │ │ │ │ ├── FaweChunkPacket.java │ │ │ │ └── MCAChunkPacket.java │ │ │ ├── v1_7 │ │ │ ├── BukkitChunk_1_7.java │ │ │ ├── BukkitQueue17.java │ │ │ └── MutableGenLayer.java │ │ │ ├── v1_8 │ │ │ ├── BukkitChunk_1_8.java │ │ │ ├── BukkitQueue18R3.java │ │ │ └── MutableGenLayer.java │ │ │ ├── v1_9 │ │ │ ├── BukkitChunk_1_9.java │ │ │ ├── BukkitQueue_1_9_R1.java │ │ │ ├── FaweAdapter_1_9.java │ │ │ └── MutableGenLayer.java │ │ │ └── wrapper │ │ │ ├── AsyncBlock.java │ │ │ ├── AsyncBlockState.java │ │ │ ├── AsyncChunk.java │ │ │ ├── AsyncWorld.java │ │ │ └── state │ │ │ └── AsyncSign.java │ │ └── sk89q │ │ ├── bukkit │ │ └── util │ │ │ └── FallbackRegistrationListener.java │ │ └── worldedit │ │ └── bukkit │ │ ├── BukkitCommandSender_unused_for_now.java │ │ ├── BukkitPlayer.java │ │ ├── BukkitPlayerBlockBag.java │ │ ├── BukkitWorld.java │ │ ├── DelegateEntity.java │ │ └── EditSessionBlockChangeDelegate.java │ └── resources │ ├── config.yml │ └── plugin.yml ├── core ├── build.gradle └── src │ └── main │ ├── java │ ├── com │ │ ├── boydti │ │ │ └── fawe │ │ │ │ ├── Fawe.java │ │ │ │ ├── FaweAPI.java │ │ │ │ ├── FaweCache.java │ │ │ │ ├── FaweVersion.java │ │ │ │ ├── IFawe.java │ │ │ │ ├── command │ │ │ │ ├── AnvilCommands.java │ │ │ │ ├── CFICommand.java │ │ │ │ ├── CFICommands.java │ │ │ │ ├── Cancel.java │ │ │ │ ├── FaweBinding.java │ │ │ │ ├── FaweParser.java │ │ │ │ ├── FawePrimitiveBinding.java │ │ │ │ ├── MaskBinding.java │ │ │ │ ├── PatternBinding.java │ │ │ │ ├── Rollback.java │ │ │ │ └── SuggestInputParseException.java │ │ │ │ ├── config │ │ │ │ ├── BBC.java │ │ │ │ ├── Commands.java │ │ │ │ ├── Config.java │ │ │ │ └── Settings.java │ │ │ │ ├── configuration │ │ │ │ ├── Configuration.java │ │ │ │ ├── ConfigurationOptions.java │ │ │ │ ├── ConfigurationSection.java │ │ │ │ ├── InvalidConfigurationException.java │ │ │ │ ├── MemoryConfiguration.java │ │ │ │ ├── MemoryConfigurationOptions.java │ │ │ │ ├── MemorySection.java │ │ │ │ ├── TypeDescription.java │ │ │ │ ├── Yaml.java │ │ │ │ ├── file │ │ │ │ │ ├── FileConfiguration.java │ │ │ │ │ ├── FileConfigurationOptions.java │ │ │ │ │ ├── YamlConfiguration.java │ │ │ │ │ ├── YamlConfigurationOptions.java │ │ │ │ │ ├── YamlConstructor.java │ │ │ │ │ └── YamlRepresenter.java │ │ │ │ └── serialization │ │ │ │ │ ├── ConfigurationSerializable.java │ │ │ │ │ ├── ConfigurationSerialization.java │ │ │ │ │ ├── DelegateDeserialization.java │ │ │ │ │ └── SerializableAs.java │ │ │ │ ├── database │ │ │ │ ├── DBHandler.java │ │ │ │ └── RollbackDatabase.java │ │ │ │ ├── example │ │ │ │ ├── CharFaweChunk.java │ │ │ │ ├── DefaultFaweQueueMap.java │ │ │ │ ├── IFaweQueueMap.java │ │ │ │ ├── MappedFaweQueue.java │ │ │ │ ├── NMSMappedFaweQueue.java │ │ │ │ ├── NMSRelighter.java │ │ │ │ ├── NullFaweChunk.java │ │ │ │ ├── NullQueueCharFaweChunk.java │ │ │ │ ├── NullRelighter.java │ │ │ │ ├── Relighter.java │ │ │ │ ├── SimpleCharFaweChunk.java │ │ │ │ └── WeakFaweQueueMap.java │ │ │ │ ├── jnbt │ │ │ │ ├── CorruptSchematicStreamer.java │ │ │ │ ├── JSON2NBT.java │ │ │ │ ├── NBTException.java │ │ │ │ ├── NBTStreamer.java │ │ │ │ ├── SchematicStreamer.java │ │ │ │ └── anvil │ │ │ │ │ ├── ChunkSimplifier.java │ │ │ │ │ ├── HeightMapMCADrawer.java │ │ │ │ │ ├── HeightMapMCAGenerator.java │ │ │ │ │ ├── MCAChunk.java │ │ │ │ │ ├── MCAClipboard.java │ │ │ │ │ ├── MCAFile.java │ │ │ │ │ ├── MCAFilter.java │ │ │ │ │ ├── MCAFilterCounter.java │ │ │ │ │ ├── MCAQueue.java │ │ │ │ │ ├── MCAQueueMap.java │ │ │ │ │ ├── MCAWorld.java │ │ │ │ │ ├── MCAWriter.java │ │ │ │ │ ├── MutableMCABackedBaseBlock.java │ │ │ │ │ ├── filters │ │ │ │ │ ├── CountFilter.java │ │ │ │ │ ├── CountIdFilter.java │ │ │ │ │ ├── DebugFixAir.java │ │ │ │ │ ├── DelegateMCAFilter.java │ │ │ │ │ ├── DeleteBiomeFilterSimple.java │ │ │ │ │ ├── DeleteOldFilter.java │ │ │ │ │ ├── DeleteUnclaimedFilter.java │ │ │ │ │ ├── DeleteUninhabitedFilter.java │ │ │ │ │ ├── MappedReplacePatternFilter.java │ │ │ │ │ ├── PlotTrimFilter.java │ │ │ │ │ ├── RemapFilter.java │ │ │ │ │ ├── RemoveLayerFilter.java │ │ │ │ │ ├── ReplacePatternFilter.java │ │ │ │ │ ├── ReplaceSimpleFilter.java │ │ │ │ │ ├── SetPatternFilter.java │ │ │ │ │ ├── TrimAirFilter.java │ │ │ │ │ └── TrimFlatFilter.java │ │ │ │ │ ├── generator │ │ │ │ │ ├── CavesGen.java │ │ │ │ │ ├── GenBase.java │ │ │ │ │ ├── OreGen.java │ │ │ │ │ ├── Resource.java │ │ │ │ │ └── SchemGen.java │ │ │ │ │ └── history │ │ │ │ │ ├── IAnvilHistory.java │ │ │ │ │ └── NullAnvilHistory.java │ │ │ │ ├── logging │ │ │ │ ├── LoggingChangeSet.java │ │ │ │ ├── MutableBlockData.java │ │ │ │ ├── MutableVector.java │ │ │ │ └── rollback │ │ │ │ │ └── RollbackOptimizedHistory.java │ │ │ │ ├── object │ │ │ │ ├── BytePair.java │ │ │ │ ├── ChangeSetFaweQueue.java │ │ │ │ ├── DataAnglePattern.java │ │ │ │ ├── DelegateConsumer.java │ │ │ │ ├── FaweChunk.java │ │ │ │ ├── FaweCommand.java │ │ │ │ ├── FaweInputStream.java │ │ │ │ ├── FaweLimit.java │ │ │ │ ├── FaweLocation.java │ │ │ │ ├── FaweOutputStream.java │ │ │ │ ├── FawePlayer.java │ │ │ │ ├── FaweQueue.java │ │ │ │ ├── HasFaweQueue.java │ │ │ │ ├── HistoryExtent.java │ │ │ │ ├── IntegerPair.java │ │ │ │ ├── IntegerTrio.java │ │ │ │ ├── MaskedFaweQueue.java │ │ │ │ ├── Metadatable.java │ │ │ │ ├── NullChangeSet.java │ │ │ │ ├── PseudoRandom.java │ │ │ │ ├── RegionWrapper.java │ │ │ │ ├── RunnableVal.java │ │ │ │ ├── RunnableVal2.java │ │ │ │ ├── RunnableVal3.java │ │ │ │ ├── RunnableVal4.java │ │ │ │ ├── brush │ │ │ │ │ ├── AbstractBrush.java │ │ │ │ │ ├── BlendBall.java │ │ │ │ │ ├── BlobBrush.java │ │ │ │ │ ├── BrushSettings.java │ │ │ │ │ ├── CatenaryBrush.java │ │ │ │ │ ├── CircleBrush.java │ │ │ │ │ ├── CommandBrush.java │ │ │ │ │ ├── CopyPastaBrush.java │ │ │ │ │ ├── ErodeBrush.java │ │ │ │ │ ├── FallingSphere.java │ │ │ │ │ ├── FlattenBrush.java │ │ │ │ │ ├── HeightBrush.java │ │ │ │ │ ├── ImageBrush.java │ │ │ │ │ ├── InspectBrush.java │ │ │ │ │ ├── LayerBrush.java │ │ │ │ │ ├── LineBrush.java │ │ │ │ │ ├── MovableTool.java │ │ │ │ │ ├── PopulateSchem.java │ │ │ │ │ ├── RaiseBrush.java │ │ │ │ │ ├── RecurseBrush.java │ │ │ │ │ ├── ResettableTool.java │ │ │ │ │ ├── RockBrush.java │ │ │ │ │ ├── ScatterBrush.java │ │ │ │ │ ├── ScatterCommand.java │ │ │ │ │ ├── ScatterOverlayBrush.java │ │ │ │ │ ├── ShatterBrush.java │ │ │ │ │ ├── SpikeBrush.java │ │ │ │ │ ├── SplatterBrush.java │ │ │ │ │ ├── SplineBrush.java │ │ │ │ │ ├── StencilBrush.java │ │ │ │ │ ├── SurfaceSphereBrush.java │ │ │ │ │ ├── SurfaceSpline.java │ │ │ │ │ ├── TargetMode.java │ │ │ │ │ ├── heightmap │ │ │ │ │ │ ├── AbstractDelegateHeightMap.java │ │ │ │ │ │ ├── ArrayHeightMap.java │ │ │ │ │ │ ├── AverageHeightMapFilter.java │ │ │ │ │ │ ├── FlatScalableHeightMap.java │ │ │ │ │ │ ├── HeightMap.java │ │ │ │ │ │ ├── RotatableHeightMap.java │ │ │ │ │ │ └── ScalableHeightMap.java │ │ │ │ │ ├── scroll │ │ │ │ │ │ ├── ScrollAction.java │ │ │ │ │ │ ├── ScrollClipboard.java │ │ │ │ │ │ ├── ScrollMask.java │ │ │ │ │ │ ├── ScrollPattern.java │ │ │ │ │ │ ├── ScrollRange.java │ │ │ │ │ │ ├── ScrollSize.java │ │ │ │ │ │ ├── ScrollTarget.java │ │ │ │ │ │ ├── ScrollTargetOffset.java │ │ │ │ │ │ └── ScrollTool.java │ │ │ │ │ ├── sweep │ │ │ │ │ │ ├── ClipboardSpline.java │ │ │ │ │ │ ├── Spline.java │ │ │ │ │ │ └── SweepBrush.java │ │ │ │ │ └── visualization │ │ │ │ │ │ ├── ImmutableVirtualWorld.java │ │ │ │ │ │ ├── VirtualWorld.java │ │ │ │ │ │ ├── VisualChunk.java │ │ │ │ │ │ ├── VisualExtent.java │ │ │ │ │ │ ├── VisualMode.java │ │ │ │ │ │ └── VisualQueue.java │ │ │ │ ├── change │ │ │ │ │ ├── CFIChange.java │ │ │ │ │ ├── MutableBiomeChange.java │ │ │ │ │ ├── MutableBlockChange.java │ │ │ │ │ ├── MutableChunkChange.java │ │ │ │ │ ├── MutableEntityChange.java │ │ │ │ │ ├── MutableFullBlockChange.java │ │ │ │ │ ├── MutableTileChange.java │ │ │ │ │ └── StreamChange.java │ │ │ │ ├── changeset │ │ │ │ │ ├── AbstractDelegateChangeSet.java │ │ │ │ │ ├── AnvilHistory.java │ │ │ │ │ ├── BlockBagChangeSet.java │ │ │ │ │ ├── CFIChangeSet.java │ │ │ │ │ ├── CPUOptimizedChangeSet.java │ │ │ │ │ ├── DiskStorageHistory.java │ │ │ │ │ ├── FaweChangeSet.java │ │ │ │ │ ├── FaweStreamChangeSet.java │ │ │ │ │ ├── MemoryOptimizedHistory.java │ │ │ │ │ └── MutableAnvilChange.java │ │ │ │ ├── clipboard │ │ │ │ │ ├── AbstractClipboardFormat.java │ │ │ │ │ ├── AbstractDelegateFaweClipboard.java │ │ │ │ │ ├── CPUOptimizedClipboard.java │ │ │ │ │ ├── DiskOptimizedClipboard.java │ │ │ │ │ ├── EmptyClipboard.java │ │ │ │ │ ├── FaweClipboard.java │ │ │ │ │ ├── IClipboardFormat.java │ │ │ │ │ ├── LazyClipboardHolder.java │ │ │ │ │ ├── MemoryOptimizedClipboard.java │ │ │ │ │ ├── MultiClipboardHolder.java │ │ │ │ │ ├── OffsetFaweClipboard.java │ │ │ │ │ ├── ReadOnlyClipboard.java │ │ │ │ │ ├── ResizableClipboardBuilder.java │ │ │ │ │ ├── URIClipboardHolder.java │ │ │ │ │ ├── WorldCopyClipboard.java │ │ │ │ │ ├── WorldCutClipboard.java │ │ │ │ │ └── remap │ │ │ │ │ │ ├── ClipboardRemapper.java │ │ │ │ │ │ ├── RemappedClipboard.java │ │ │ │ │ │ └── WikiScraper.java │ │ │ │ ├── collection │ │ │ │ │ ├── BlockVectorSet.java │ │ │ │ │ ├── ByteStore.java │ │ │ │ │ ├── DifferentialArray.java │ │ │ │ │ ├── DifferentialBlockBuffer.java │ │ │ │ │ ├── DifferentialCollection.java │ │ │ │ │ ├── FastRandomCollection.java │ │ │ │ │ ├── IterableThreadLocal.java │ │ │ │ │ ├── LocalBlockVector2DSet.java │ │ │ │ │ ├── LocalBlockVectorSet.java │ │ │ │ │ ├── LongHashSet.java │ │ │ │ │ ├── PrimitiveList.java │ │ │ │ │ ├── RandomCollection.java │ │ │ │ │ ├── SimpleRandomCollection.java │ │ │ │ │ ├── SoftHashMap.java │ │ │ │ │ ├── SparseBitSet.java │ │ │ │ │ ├── SparseBlockSet.java │ │ │ │ │ ├── SummedAreaTable.java │ │ │ │ │ └── SummedColorTable.java │ │ │ │ ├── exception │ │ │ │ │ └── FaweException.java │ │ │ │ ├── extent │ │ │ │ │ ├── BlockTranslateExtent.java │ │ │ │ │ ├── EmptyExtent.java │ │ │ │ │ ├── ExtentHeightCacher.java │ │ │ │ │ ├── FastWorldEditExtent.java │ │ │ │ │ ├── FaweRegionExtent.java │ │ │ │ │ ├── HeightBoundExtent.java │ │ │ │ │ ├── LightingExtent.java │ │ │ │ │ ├── Linear3DTransform.java │ │ │ │ │ ├── LinearTransform.java │ │ │ │ │ ├── MemoryCheckingExtent.java │ │ │ │ │ ├── MultiRegionExtent.java │ │ │ │ │ ├── MultiTransform.java │ │ │ │ │ ├── NullExtent.java │ │ │ │ │ ├── OffsetExtent.java │ │ │ │ │ ├── PatternTransform.java │ │ │ │ │ ├── PositionTransformExtent.java │ │ │ │ │ ├── ProcessedWEExtent.java │ │ │ │ │ ├── RandomOffsetTransform.java │ │ │ │ │ ├── RandomTransform.java │ │ │ │ │ ├── ResettableExtent.java │ │ │ │ │ ├── ScaleTransform.java │ │ │ │ │ ├── SelectTransform.java │ │ │ │ │ ├── SingleRegionExtent.java │ │ │ │ │ ├── SlowExtent.java │ │ │ │ │ ├── SourceMaskExtent.java │ │ │ │ │ ├── StripNBTExtent.java │ │ │ │ │ ├── TemporalExtent.java │ │ │ │ │ └── TransformExtent.java │ │ │ │ ├── function │ │ │ │ │ ├── NullRegionFunction.java │ │ │ │ │ ├── SurfaceRegionFunction.java │ │ │ │ │ ├── block │ │ │ │ │ │ ├── BiomeCopy.java │ │ │ │ │ │ ├── CombinedBlockCopy.java │ │ │ │ │ │ └── SimpleBlockCopy.java │ │ │ │ │ └── mask │ │ │ │ │ │ └── AbstractDelegateMask.java │ │ │ │ ├── io │ │ │ │ │ ├── AbstractDelegateOutputStream.java │ │ │ │ │ ├── AsyncBufferedOutputStream.java │ │ │ │ │ ├── BufferedRandomAccessFile.java │ │ │ │ │ ├── FastByteArrayInputStream.java │ │ │ │ │ ├── FastByteArrayOutputStream.java │ │ │ │ │ ├── FastByteArraysInputStream.java │ │ │ │ │ ├── LittleEndianOutputStream.java │ │ │ │ │ ├── NonClosableOutputStream.java │ │ │ │ │ ├── NonCloseableInputStream.java │ │ │ │ │ ├── PGZIPBlock.java │ │ │ │ │ ├── PGZIPOutputStream.java │ │ │ │ │ ├── PGZIPState.java │ │ │ │ │ ├── PGZIPThreadLocal.java │ │ │ │ │ ├── RandomAccessInputStream.java │ │ │ │ │ ├── RandomFileOutputStream.java │ │ │ │ │ ├── ResettableFileInputStream.java │ │ │ │ │ ├── serialize │ │ │ │ │ │ ├── Serialize.java │ │ │ │ │ │ └── Serializer.java │ │ │ │ │ └── zstd │ │ │ │ │ │ ├── BitStream.java │ │ │ │ │ │ ├── FiniteStateEntropy.java │ │ │ │ │ │ ├── FrameHeader.java │ │ │ │ │ │ ├── FseTableReader.java │ │ │ │ │ │ ├── Huffman.java │ │ │ │ │ │ ├── MalformedInputException.java │ │ │ │ │ │ ├── UnsafeUtil.java │ │ │ │ │ │ ├── Util.java │ │ │ │ │ │ ├── ZstdDecompressor.java │ │ │ │ │ │ ├── ZstdFrameDecompressor.java │ │ │ │ │ │ └── ZstdInputStream.java │ │ │ │ ├── mask │ │ │ │ │ ├── AdjacentAnyMask.java │ │ │ │ │ ├── AdjacentMask.java │ │ │ │ │ ├── AngleMask.java │ │ │ │ │ ├── BiomeMask.java │ │ │ │ │ ├── BlockLightMask.java │ │ │ │ │ ├── BrightnessMask.java │ │ │ │ │ ├── CachedMask.java │ │ │ │ │ ├── DataMask.java │ │ │ │ │ ├── ExtremaMask.java │ │ │ │ │ ├── FaweBlockMatcher.java │ │ │ │ │ ├── IdDataMask.java │ │ │ │ │ ├── IdMask.java │ │ │ │ │ ├── LightMask.java │ │ │ │ │ ├── MaskedTargetBlock.java │ │ │ │ │ ├── OpacityMask.java │ │ │ │ │ ├── PlaneMask.java │ │ │ │ │ ├── ROCAngleMask.java │ │ │ │ │ ├── RadiusMask.java │ │ │ │ │ ├── RandomMask.java │ │ │ │ │ ├── ResettableMask.java │ │ │ │ │ ├── SimplexMask.java │ │ │ │ │ ├── SkyLightMask.java │ │ │ │ │ ├── SolidPlaneMask.java │ │ │ │ │ ├── SurfaceMask.java │ │ │ │ │ ├── WallMask.java │ │ │ │ │ ├── XAxisMask.java │ │ │ │ │ ├── YAxisMask.java │ │ │ │ │ └── ZAxisMask.java │ │ │ │ ├── number │ │ │ │ │ └── MutableLong.java │ │ │ │ ├── pattern │ │ │ │ │ ├── AbstractExtentPattern.java │ │ │ │ │ ├── AngleColorPattern.java │ │ │ │ │ ├── AverageColorPattern.java │ │ │ │ │ ├── BiomePattern.java │ │ │ │ │ ├── BufferedPattern.java │ │ │ │ │ ├── BufferedPattern2D.java │ │ │ │ │ ├── DataPattern.java │ │ │ │ │ ├── DesaturatePattern.java │ │ │ │ │ ├── ExistingPattern.java │ │ │ │ │ ├── ExpressionPattern.java │ │ │ │ │ ├── FullClipboardPattern.java │ │ │ │ │ ├── IdDataMaskPattern.java │ │ │ │ │ ├── IdPattern.java │ │ │ │ │ ├── Linear2DBlockPattern.java │ │ │ │ │ ├── Linear3DBlockPattern.java │ │ │ │ │ ├── LinearBlockPattern.java │ │ │ │ │ ├── MaskedPattern.java │ │ │ │ │ ├── NoXPattern.java │ │ │ │ │ ├── NoYPattern.java │ │ │ │ │ ├── NoZPattern.java │ │ │ │ │ ├── OffsetPattern.java │ │ │ │ │ ├── PatternExtent.java │ │ │ │ │ ├── PatternTraverser.java │ │ │ │ │ ├── RandomFullClipboardPattern.java │ │ │ │ │ ├── RandomOffsetPattern.java │ │ │ │ │ ├── RelativePattern.java │ │ │ │ │ ├── ResettablePattern.java │ │ │ │ │ ├── SaturatePattern.java │ │ │ │ │ ├── ShadePattern.java │ │ │ │ │ ├── SolidRandomOffsetPattern.java │ │ │ │ │ └── SurfaceRandomOffsetPattern.java │ │ │ │ ├── progress │ │ │ │ │ ├── ChatProgressTracker.java │ │ │ │ │ └── DefaultProgressTracker.java │ │ │ │ ├── queue │ │ │ │ │ ├── DelegateFaweQueue.java │ │ │ │ │ ├── FaweQueueDelegateExtent.java │ │ │ │ │ ├── IDelegateFaweQueue.java │ │ │ │ │ ├── LazyFaweChunk.java │ │ │ │ │ └── NullFaweQueue.java │ │ │ │ ├── random │ │ │ │ │ ├── SimpleRandom.java │ │ │ │ │ ├── SimplexNoise.java │ │ │ │ │ ├── SimplexRandom.java │ │ │ │ │ └── TrueRandom.java │ │ │ │ ├── regions │ │ │ │ │ ├── FuzzyRegion.java │ │ │ │ │ ├── PolyhedralRegion.java │ │ │ │ │ ├── Triangle.java │ │ │ │ │ └── selector │ │ │ │ │ │ ├── FuzzyRegionSelector.java │ │ │ │ │ │ └── PolyhedralRegionSelector.java │ │ │ │ ├── schematic │ │ │ │ │ ├── FaweFormat.java │ │ │ │ │ ├── PNGWriter.java │ │ │ │ │ ├── Schematic.java │ │ │ │ │ ├── StructureFormat.java │ │ │ │ │ └── visualizer │ │ │ │ │ │ └── SchemVis.java │ │ │ │ ├── task │ │ │ │ │ ├── AsyncNotifyQueue.java │ │ │ │ │ ├── SimpleAsyncNotifyQueue.java │ │ │ │ │ ├── SingleThreadIntervalQueue.java │ │ │ │ │ ├── ThrowableRunnable.java │ │ │ │ │ └── ThrowableSupplier.java │ │ │ │ └── visitor │ │ │ │ │ ├── AboveVisitor.java │ │ │ │ │ ├── DFSRecursiveVisitor.java │ │ │ │ │ ├── DFSVisitor.java │ │ │ │ │ ├── Fast2DIterator.java │ │ │ │ │ ├── FastChunkIterator.java │ │ │ │ │ ├── FastIterator.java │ │ │ │ │ └── FaweChunkVisitor.java │ │ │ │ ├── regions │ │ │ │ ├── FaweMask.java │ │ │ │ ├── FaweMaskManager.java │ │ │ │ ├── SimpleRegion.java │ │ │ │ └── general │ │ │ │ │ ├── CuboidRegionFilter.java │ │ │ │ │ ├── RedProtectFeature.java │ │ │ │ │ ├── RegionFilter.java │ │ │ │ │ └── plot │ │ │ │ │ ├── CFIRedirect.java │ │ │ │ │ ├── FaweChunkManager.java │ │ │ │ │ ├── FaweLocalBlockQueue.java │ │ │ │ │ ├── FaweSchematicHandler.java │ │ │ │ │ ├── FaweTrim.java │ │ │ │ │ ├── MoveTo512.java │ │ │ │ │ ├── PlotRegionFilter.java │ │ │ │ │ ├── PlotSetBiome.java │ │ │ │ │ ├── PlotSquaredFeature.java │ │ │ │ │ ├── PlotTrim.java │ │ │ │ │ └── ReplaceAll.java │ │ │ │ ├── util │ │ │ │ ├── ArrayUtil.java │ │ │ │ ├── CachedTextureUtil.java │ │ │ │ ├── CleanTextureUtil.java │ │ │ │ ├── ColorUtil.java │ │ │ │ ├── DelegateTextureUtil.java │ │ │ │ ├── DocumentationPrinter.java │ │ │ │ ├── EditSessionBuilder.java │ │ │ │ ├── ExtentTraverser.java │ │ │ │ ├── FaweTimer.java │ │ │ │ ├── FilteredTextureUtil.java │ │ │ │ ├── IOUtil.java │ │ │ │ ├── ImgurUtility.java │ │ │ │ ├── IncendoPaster.java │ │ │ │ ├── Jars.java │ │ │ │ ├── MainUtil.java │ │ │ │ ├── MaskTraverser.java │ │ │ │ ├── MathMan.java │ │ │ │ ├── MemUtil.java │ │ │ │ ├── Perm.java │ │ │ │ ├── RandomTextureUtil.java │ │ │ │ ├── ReflectionUtils.java │ │ │ │ ├── SetQueue.java │ │ │ │ ├── ShapeInterpolator.java │ │ │ │ ├── StringMan.java │ │ │ │ ├── TaskManager.java │ │ │ │ ├── TextureHolder.java │ │ │ │ ├── TextureUtil.java │ │ │ │ ├── Updater.java │ │ │ │ ├── WEManager.java │ │ │ │ ├── chat │ │ │ │ │ ├── ChatManager.java │ │ │ │ │ ├── Message.java │ │ │ │ │ ├── PlainChatManager.java │ │ │ │ │ └── UsageMessage.java │ │ │ │ ├── cui │ │ │ │ │ └── CUI.java │ │ │ │ ├── gui │ │ │ │ │ └── FormBuilder.java │ │ │ │ ├── image │ │ │ │ │ ├── Drawable.java │ │ │ │ │ ├── ImageUtil.java │ │ │ │ │ └── ImageViewer.java │ │ │ │ ├── metrics │ │ │ │ │ └── BStats.java │ │ │ │ ├── task │ │ │ │ │ ├── DelayedTask.java │ │ │ │ │ ├── ReceiveTask.java │ │ │ │ │ ├── ReturnTask.java │ │ │ │ │ ├── Task.java │ │ │ │ │ └── TaskBuilder.java │ │ │ │ └── terrain │ │ │ │ │ └── Erosion.java │ │ │ │ ├── web │ │ │ │ └── SchemSync.java │ │ │ │ └── wrappers │ │ │ │ ├── FakePlayer.java │ │ │ │ ├── LocationMaskedPlayerWrapper.java │ │ │ │ ├── PlayerWrapper.java │ │ │ │ ├── SilentPlayerWrapper.java │ │ │ │ └── WorldWrapper.java │ │ └── sk89q │ │ │ ├── jnbt │ │ │ ├── CompoundTag.java │ │ │ ├── CompoundTagBuilder.java │ │ │ ├── ListTag.java │ │ │ ├── NBTInputStream.java │ │ │ ├── NBTOutputStream.java │ │ │ ├── NamedData.java │ │ │ └── Tag.java │ │ │ ├── minecraft │ │ │ └── util │ │ │ │ └── commands │ │ │ │ ├── Link.java │ │ │ │ ├── Step.java │ │ │ │ └── SuggestedRange.java │ │ │ └── worldedit │ │ │ ├── BlockVector.java │ │ │ ├── BlockWorldVector.java │ │ │ ├── CuboidClipboard.java │ │ │ ├── EditSession.java │ │ │ ├── LocalSession.java │ │ │ ├── MutableBlockVector.java │ │ │ ├── MutableBlockVector2D.java │ │ │ ├── PlayerDirection.java │ │ │ ├── Vector.java │ │ │ ├── Vector2D.java │ │ │ ├── blocks │ │ │ ├── BaseBlock.java │ │ │ ├── BaseItem.java │ │ │ ├── BlockData.java │ │ │ ├── ImmutableBlock.java │ │ │ ├── ImmutableDatalessBlock.java │ │ │ └── ImmutableNBTBlock.java │ │ │ ├── command │ │ │ ├── BiomeCommands.java │ │ │ ├── BrushCommands.java │ │ │ ├── BrushOptionsCommands.java │ │ │ ├── BrushProcessor.java │ │ │ ├── ChunkCommands.java │ │ │ ├── ClipboardCommands.java │ │ │ ├── FlattenedClipboardTransform.java │ │ │ ├── GenerationCommands.java │ │ │ ├── HelpBuilder.java │ │ │ ├── HistoryCommands.java │ │ │ ├── MaskCommands.java │ │ │ ├── MethodCommands.java │ │ │ ├── NavigationCommands.java │ │ │ ├── OptionsCommands.java │ │ │ ├── PatternCommands.java │ │ │ ├── RegionCommands.java │ │ │ ├── SchematicCommands.java │ │ │ ├── ScriptingCommands.java │ │ │ ├── SelectionCommands.java │ │ │ ├── SnapshotCommands.java │ │ │ ├── SnapshotUtilCommands.java │ │ │ ├── SuperPickaxeCommands.java │ │ │ ├── ToolCommands.java │ │ │ ├── TransformCommands.java │ │ │ ├── UtilityCommands.java │ │ │ ├── WorldEditCommands.java │ │ │ ├── composition │ │ │ │ └── SelectionCommand.java │ │ │ ├── tool │ │ │ │ ├── AreaPickaxe.java │ │ │ │ ├── BrushHolder.java │ │ │ │ ├── BrushTool.java │ │ │ │ ├── FloodFillTool.java │ │ │ │ ├── LongRangeBuildTool.java │ │ │ │ ├── RecursivePickaxe.java │ │ │ │ ├── SinglePickaxe.java │ │ │ │ └── brush │ │ │ │ │ └── GravityBrush.java │ │ │ └── util │ │ │ │ └── EntityRemover.java │ │ │ ├── event │ │ │ └── extent │ │ │ │ ├── EditSessionEvent.java │ │ │ │ ├── FaweEvent.java │ │ │ │ ├── PasteEvent.java │ │ │ │ └── PlayerSaveClipboardEvent.java │ │ │ ├── extension │ │ │ ├── factory │ │ │ │ ├── DefaultBlockParser.java │ │ │ │ ├── DefaultMaskParser.java │ │ │ │ ├── DefaultTransformParser.java │ │ │ │ └── HashTagPatternParser.java │ │ │ └── platform │ │ │ │ ├── AbstractPlayerActor.java │ │ │ │ ├── CommandManager.java │ │ │ │ ├── PlatformManager.java │ │ │ │ └── PlayerProxy.java │ │ │ ├── extent │ │ │ ├── AbstractDelegateExtent.java │ │ │ ├── Extent.java │ │ │ ├── MaskingExtent.java │ │ │ ├── clipboard │ │ │ │ ├── BlockArrayClipboard.java │ │ │ │ ├── ClipboardFormats.java │ │ │ │ └── io │ │ │ │ │ ├── ClipboardFormat.java │ │ │ │ │ ├── SchematicReader.java │ │ │ │ │ ├── SchematicWriter.java │ │ │ │ │ └── WavefrontReader.java │ │ │ ├── inventory │ │ │ │ ├── BlockBagExtent.java │ │ │ │ └── SlottableBlockBag.java │ │ │ └── transform │ │ │ │ └── BlockTransformExtent.java │ │ │ ├── function │ │ │ ├── CombinedRegionFunction.java │ │ │ ├── GroundFunction.java │ │ │ ├── RegionMaskTestFunction.java │ │ │ ├── block │ │ │ │ ├── BlockReplace.java │ │ │ │ └── ExtentBlockCopy.java │ │ │ ├── entity │ │ │ │ └── ExtentEntityCopy.java │ │ │ ├── mask │ │ │ │ ├── AbstractExtentMask.java │ │ │ │ ├── AbstractMask.java │ │ │ │ ├── BlockMask.java │ │ │ │ ├── ConditionalMask.java │ │ │ │ ├── FuzzyBlockMask.java │ │ │ │ ├── Mask.java │ │ │ │ ├── MaskIntersection.java │ │ │ │ ├── MaskUnion.java │ │ │ │ ├── Masks.java │ │ │ │ ├── OffsetMask.java │ │ │ │ └── SolidBlockMask.java │ │ │ ├── operation │ │ │ │ ├── BackwardsExtentBlockCopy.java │ │ │ │ ├── ChangeSetExecutor.java │ │ │ │ ├── ForwardExtentCopy.java │ │ │ │ └── Operations.java │ │ │ ├── pattern │ │ │ │ ├── AbstractPattern.java │ │ │ │ ├── BlockPattern.java │ │ │ │ ├── ClipboardPattern.java │ │ │ │ ├── Pattern.java │ │ │ │ ├── Patterns.java │ │ │ │ └── RandomPattern.java │ │ │ └── visitor │ │ │ │ ├── BreadthFirstSearch.java │ │ │ │ ├── DirectionalVisitor.java │ │ │ │ ├── DownwardVisitor.java │ │ │ │ ├── EntityVisitor.java │ │ │ │ ├── FlatRegionVisitor.java │ │ │ │ ├── IntersectRegionFunction.java │ │ │ │ ├── LayerVisitor.java │ │ │ │ ├── NonRisingVisitor.java │ │ │ │ ├── RecursiveVisitor.java │ │ │ │ └── RegionVisitor.java │ │ │ ├── history │ │ │ └── change │ │ │ │ ├── EntityCreate.java │ │ │ │ └── EntityRemove.java │ │ │ ├── internal │ │ │ ├── LocalWorldAdapter.java │ │ │ ├── command │ │ │ │ └── WorldEditBinding.java │ │ │ └── expression │ │ │ │ ├── Expression.java │ │ │ │ └── runtime │ │ │ │ ├── ExpressionEnvironment.java │ │ │ │ ├── For.java │ │ │ │ ├── Function.java │ │ │ │ ├── Functions.java │ │ │ │ ├── SimpleFor.java │ │ │ │ └── While.java │ │ │ ├── math │ │ │ ├── convolution │ │ │ │ └── HeightMap.java │ │ │ ├── interpolation │ │ │ │ └── KochanekBartelsInterpolation.java │ │ │ └── transform │ │ │ │ ├── AffineTransform.java │ │ │ │ └── RoundedTransform.java │ │ │ ├── patterns │ │ │ └── Pattern.java │ │ │ ├── regions │ │ │ ├── CuboidRegion.java │ │ │ ├── CylinderRegion.java │ │ │ ├── EllipsoidRegion.java │ │ │ ├── IDelegateRegion.java │ │ │ ├── Region.java │ │ │ ├── selector │ │ │ │ ├── ConvexPolyhedralRegionSelector.java │ │ │ │ ├── CuboidRegionSelector.java │ │ │ │ ├── CylinderRegionSelector.java │ │ │ │ ├── EllipsoidRegionSelector.java │ │ │ │ ├── ExtendingCuboidRegionSelector.java │ │ │ │ ├── Polygonal2DRegionSelector.java │ │ │ │ └── SphereRegionSelector.java │ │ │ └── shape │ │ │ │ ├── ArbitraryShape.java │ │ │ │ └── WorldEditExpressionEnvironment.java │ │ │ ├── scripting │ │ │ ├── CommandScriptLoader.java │ │ │ └── NashornCraftScriptEngine.java │ │ │ ├── session │ │ │ ├── ClipboardHolder.java │ │ │ ├── DelegateClipboardHolder.java │ │ │ ├── PasteBuilder.java │ │ │ ├── SessionManager.java │ │ │ └── request │ │ │ │ └── Request.java │ │ │ ├── util │ │ │ ├── TargetBlock.java │ │ │ ├── command │ │ │ │ ├── CallableProcessor.java │ │ │ │ ├── DelegateCallable.java │ │ │ │ ├── ProcessedCallable.java │ │ │ │ ├── SimpleCommandMapping.java │ │ │ │ ├── SimpleDispatcher.java │ │ │ │ ├── fluent │ │ │ │ │ └── DispatcherNode.java │ │ │ │ └── parametric │ │ │ │ │ ├── AParametricCallable.java │ │ │ │ │ ├── ArgumentStack.java │ │ │ │ │ ├── ContextArgumentStack.java │ │ │ │ │ ├── FaweParanamer.java │ │ │ │ │ ├── FunctionParametricCallable.java │ │ │ │ │ ├── ParameterData.java │ │ │ │ │ ├── ParametricBuilder.java │ │ │ │ │ ├── ParametricCallable.java │ │ │ │ │ └── StringArgumentStack.java │ │ │ └── formatting │ │ │ │ ├── Fragment.java │ │ │ │ └── component │ │ │ │ ├── CommandListBox.java │ │ │ │ ├── CommandUsageBox.java │ │ │ │ └── MessageBox.java │ │ │ └── world │ │ │ ├── SimpleWorld.java │ │ │ ├── biome │ │ │ └── BaseBiome.java │ │ │ └── registry │ │ │ └── BundledBlockData.java │ └── net │ │ └── jpountz │ │ ├── lz4 │ │ ├── LZ4BlockInputStream.java │ │ ├── LZ4BlockOutputStream.java │ │ ├── LZ4ByteBufferUtils.java │ │ ├── LZ4Compressor.java │ │ ├── LZ4Constants.java │ │ ├── LZ4Decompressor.java │ │ ├── LZ4Exception.java │ │ ├── LZ4Factory.java │ │ ├── LZ4FastDecompressor.java │ │ ├── LZ4HCJNICompressor.java │ │ ├── LZ4HCJavaSafeCompressor.java │ │ ├── LZ4HCJavaUnsafeCompressor.java │ │ ├── LZ4InputStream.java │ │ ├── LZ4JNI.java │ │ ├── LZ4JNICompressor.java │ │ ├── LZ4JNIFastDecompressor.java │ │ ├── LZ4JNISafeDecompressor.java │ │ ├── LZ4JavaSafeCompressor.java │ │ ├── LZ4JavaSafeFastDecompressor.java │ │ ├── LZ4JavaSafeSafeDecompressor.java │ │ ├── LZ4JavaUnsafeCompressor.java │ │ ├── LZ4JavaUnsafeFastDecompressor.java │ │ ├── LZ4JavaUnsafeSafeDecompressor.java │ │ ├── LZ4OutputStream.java │ │ ├── LZ4SafeDecompressor.java │ │ ├── LZ4SafeUtils.java │ │ ├── LZ4StreamHelper.java │ │ ├── LZ4UnknownSizeDecompressor.java │ │ ├── LZ4UnsafeUtils.java │ │ └── LZ4Utils.java │ │ └── util │ │ ├── ByteBufferUtils.java │ │ ├── Native.java │ │ ├── SafeUtils.java │ │ ├── UnsafeUtils.java │ │ └── Utils.java │ └── resources │ ├── LICENSE │ ├── cn │ └── message.yml │ ├── cs_adv.js │ ├── darwin │ └── x86_64 │ │ └── liblz4-java.dylib │ ├── de │ └── message.yml │ ├── es │ ├── commands.yml │ └── message.yml │ ├── extrablocks.json │ ├── fawe.properties │ ├── fr │ └── message.yml │ ├── it │ └── message.yml │ ├── linux │ ├── amd64 │ │ └── liblz4-java.so │ ├── arm │ │ └── liblz4-java.so │ ├── i386 │ │ └── liblz4-java.so │ ├── ppc64le │ │ └── liblz4-java.so │ └── s390x │ │ └── liblz4-java.so │ ├── nl │ └── message.yml │ ├── ru │ ├── commands.yml │ └── message.yml │ ├── tr │ └── message.yml │ └── win32 │ ├── amd64 │ └── liblz4-java.so │ └── x86 │ └── liblz4-java.so ├── favs ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ ├── boydti │ │ └── fawe │ │ │ └── bukkit │ │ │ └── favs │ │ │ ├── Favs.java │ │ │ ├── Metrics.java │ │ │ └── PatternUtil.java │ │ └── thevoxelbox │ │ └── voxelsniper │ │ ├── RangeBlockHelper.java │ │ ├── SnipeData.java │ │ ├── Sniper.java │ │ ├── Undo.java │ │ ├── brush │ │ ├── WarpBrush.java │ │ └── perform │ │ │ ├── PatternPerformer.java │ │ │ └── PerformBrush.java │ │ ├── command │ │ └── VoxelVoxelCommand.java │ │ └── event │ │ ├── SniperBrushChangedEvent.java │ │ └── SniperMaterialChangedEvent.java │ └── resources │ └── plugin.yml ├── forge110 ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ ├── boydti │ │ └── fawe │ │ │ └── forge │ │ │ ├── FaweForge.java │ │ │ ├── ForgeCommand.java │ │ │ ├── ForgeMain.java │ │ │ ├── ForgeMetrics.java │ │ │ ├── ForgePlayer.java │ │ │ ├── ForgePlayerBlockBag.java │ │ │ ├── ForgeTaskMan.java │ │ │ └── v110 │ │ │ ├── ForgeChunk_All.java │ │ │ └── ForgeQueue_All.java │ │ └── sk89q │ │ └── worldedit │ │ └── forge │ │ └── ForgePlayer.java │ └── resources │ └── config.yml ├── forge111 ├── build.gradle └── src │ └── main │ └── java │ └── com │ ├── boydti │ └── fawe │ │ └── forge │ │ ├── FaweForge.java │ │ ├── ForgeCommand.java │ │ ├── ForgeMain.java │ │ ├── ForgeMetrics.java │ │ ├── ForgePlayer.java │ │ ├── ForgePlayerBlockBag.java │ │ ├── ForgeTaskMan.java │ │ ├── MutableGenLayer.java │ │ └── v111 │ │ ├── ForgeChunk_All.java │ │ └── ForgeQueue_All.java │ └── sk89q │ └── worldedit │ └── forge │ └── ForgePlayer.java ├── forge112 ├── build.gradle └── src │ └── main │ └── java │ └── com │ ├── boydti │ └── fawe │ │ └── forge │ │ ├── FaweForge.java │ │ ├── ForgeCommand.java │ │ ├── ForgeMain.java │ │ ├── ForgeMetrics.java │ │ ├── ForgePlayer.java │ │ ├── ForgePlayerBlockBag.java │ │ ├── ForgeTaskMan.java │ │ ├── MutableGenLayer.java │ │ └── v112 │ │ ├── ForgeChunk_All.java │ │ └── ForgeQueue_All.java │ └── sk89q │ └── worldedit │ └── forge │ └── ForgePlayer.java ├── forge1710 ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ ├── boydti │ │ └── fawe │ │ │ └── forge │ │ │ ├── FaweForge.java │ │ │ ├── ForgeCommand.java │ │ │ ├── ForgeMain.java │ │ │ ├── ForgeMetrics.java │ │ │ ├── ForgePlayer.java │ │ │ ├── ForgePlayerBlockBag.java │ │ │ ├── ForgeTaskMan.java │ │ │ └── v1710 │ │ │ ├── ForgeChunk_All.java │ │ │ └── ForgeQueue_All.java │ │ └── sk89q │ │ └── worldedit │ │ └── forge │ │ └── ForgePlayer.java │ └── resources │ ├── config.yml │ └── mcmod.info ├── forge189 ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ ├── boydti │ │ └── fawe │ │ │ └── forge │ │ │ ├── FaweForge.java │ │ │ ├── ForgeCommand.java │ │ │ ├── ForgeMain.java │ │ │ ├── ForgeMetrics.java │ │ │ ├── ForgePlayer.java │ │ │ ├── ForgePlayerBlockBag.java │ │ │ ├── ForgeTaskMan.java │ │ │ └── v189 │ │ │ ├── ForgeChunk_All.java │ │ │ └── ForgeQueue_All.java │ │ └── sk89q │ │ └── worldedit │ │ └── forge │ │ └── ForgePlayer.java │ └── resources │ └── config.yml ├── forge194 ├── build.gradle └── src │ └── main │ ├── java │ └── com │ │ ├── boydti │ │ └── fawe │ │ │ └── forge │ │ │ ├── FaweForge.java │ │ │ ├── ForgeCommand.java │ │ │ ├── ForgeMain.java │ │ │ ├── ForgeMetrics.java │ │ │ ├── ForgePlayer.java │ │ │ ├── ForgePlayerBlockBag.java │ │ │ ├── ForgeTaskMan.java │ │ │ └── v194 │ │ │ ├── ForgeChunk_All.java │ │ │ └── ForgeQueue_All.java │ │ └── sk89q │ │ └── worldedit │ │ └── forge │ │ └── ForgePlayer.java │ └── resources │ └── config.yml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── nukkit ├── build.gradle ├── lib │ ├── leveldb.jar │ ├── nukkit-1.0-SNAPSHOT.jar │ └── worldedit-core-6.1.4-SNAPSHOT-dist.jar └── src │ └── main │ ├── java │ └── com │ │ └── boydti │ │ └── fawe │ │ └── nukkit │ │ ├── core │ │ ├── CommandInfo.java │ │ ├── DynamicPluginCommand.java │ │ ├── NBTConverter.java │ │ ├── NukkitCommandManager.java │ │ ├── NukkitCommandSender.java │ │ ├── NukkitConfiguration.java │ │ ├── NukkitEntity.java │ │ ├── NukkitEntityType.java │ │ ├── NukkitPlatform.java │ │ ├── NukkitPlayer.java │ │ ├── NukkitPlayerBlockBag.java │ │ ├── NukkitRegistryDumper.java │ │ ├── NukkitTaskManager.java │ │ ├── NukkitUtil.java │ │ ├── NukkitWorld.java │ │ ├── NukkitWorldEdit.java │ │ ├── WorldEditListener.java │ │ ├── converter │ │ │ ├── ConvertCommands.java │ │ │ ├── ConverterFrame.java │ │ │ ├── LevelDBToMCAFile.java │ │ │ ├── MCAFile2LevelDB.java │ │ │ └── MapConverter.java │ │ └── gui │ │ │ ├── DelegateFormWindow.java │ │ │ ├── NukkitFormBuilder.java │ │ │ └── ResponseFormWindow.java │ │ ├── listener │ │ └── BrushListener.java │ │ └── optimization │ │ ├── FaweNukkit.java │ │ ├── FaweNukkitPlayer.java │ │ ├── Metrics.java │ │ ├── NukkitCommand.java │ │ └── queue │ │ ├── NukkitChunk.java │ │ └── NukkitQueue.java │ └── resources │ ├── axe-logo.png │ ├── config-basic.yml │ └── plugin.yml ├── settings.gradle ├── sponge111 ├── .gitignore ├── build.gradle ├── lib │ └── worldedit-core-6.1.7-SNAPSHOT-dist.jar └── src │ └── main │ ├── java │ └── com │ │ ├── boydti │ │ └── fawe │ │ │ ├── SpongeCommand.java │ │ │ └── sponge │ │ │ ├── FaweSponge.java │ │ │ ├── SpongeMain.java │ │ │ ├── SpongeMetrics.java │ │ │ ├── SpongePlayer.java │ │ │ ├── SpongeTaskMan.java │ │ │ └── v1_11 │ │ │ ├── MutableGenLayer.java │ │ │ ├── SpongeChunk_1_11.java │ │ │ ├── SpongeQueue_1_11.java │ │ │ └── SpongeQueue_ALL.java.unused │ │ └── sk89q │ │ └── worldedit │ │ └── sponge │ │ ├── SpongePlayer.java │ │ └── chat │ │ └── SpongeChatManager.java │ └── resources │ └── config.yml └── sponge112 ├── build.gradle ├── lib ├── worldedit-core-6.1.9-SNAPSHOT-dist.jar └── worldedit-sponge-6.1.9-SNAPSHOT-dist.jar └── src └── main └── java └── com ├── boydti └── fawe │ ├── SpongeCommand.java │ └── sponge │ ├── FaweSponge.java │ ├── SpongeMain.java │ ├── SpongeMetrics.java │ ├── SpongePlayer.java │ ├── SpongeTaskMan.java │ └── v1_12 │ ├── MutableGenLayer.java │ ├── SpongeChunk_1_12.java │ ├── SpongeQueue_1_12.java │ └── SpongeQueue_ALL.java.unused └── sk89q └── worldedit └── sponge ├── SpongePlayer.java └── chat └── SpongeChatManager.java /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ### Bugs 2 | Please provide a proper title, description, console log, your FAWE configuration, and info about replicating the issue on your issue post. 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: FAWE 1.15+ Issue Tracker 4 | url: https://github.com/IntellectualSites/FastAsyncWorldEdit/issues 5 | about: Click here to move to our new issue tracker, DO NOT USE THIS ONE! YOUR ISSUE WILL BE IGNORED!!! -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.bat 2 | *.prefs 3 | *.class 4 | /target/classes 5 | /target/PlotSquared-Null.jar 6 | /target/PlotSquared-Uber.jar 7 | /target/maven-archiver 8 | *.project 9 | *.classpath 10 | /target/ 11 | /.gradle 12 | /.idea 13 | *.log 14 | gradle.log 15 | /lib 16 | /core/lib 17 | /bukkit/lib 18 | /core/build 19 | /forge189/build 20 | /forge1710/build 21 | /sponge/build 22 | /sponge111/build 23 | /bukkit/out 24 | /nukkit/out 25 | /sponge112/build 26 | /core/out 27 | /bukkit/build 28 | /bukkit0/build 29 | /bukkit19/build 30 | /bukkit18/build 31 | build 32 | /mvn 33 | spigot-1.10 34 | wiki_permissions.md 35 | /textures 36 | *.iml 37 | /obj 38 | docs/ 39 | 40 | bukkit/bin/ 41 | core/bin/ 42 | favs/bin/ 43 | forge110/bin/ 44 | forge189/bin/ 45 | forge194/bin/ 46 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/BukkitCommand.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit; 2 | 3 | import com.boydti.fawe.Fawe; 4 | import com.boydti.fawe.config.BBC; 5 | import com.boydti.fawe.object.FaweCommand; 6 | import com.boydti.fawe.object.FawePlayer; 7 | import org.bukkit.command.Command; 8 | import org.bukkit.command.CommandExecutor; 9 | import org.bukkit.command.CommandSender; 10 | 11 | public class BukkitCommand implements CommandExecutor { 12 | 13 | private final FaweCommand cmd; 14 | 15 | public BukkitCommand(final FaweCommand cmd) { 16 | this.cmd = cmd; 17 | } 18 | 19 | @Override 20 | public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) { 21 | final FawePlayer plr = Fawe.imp().wrap(sender); 22 | if (!sender.hasPermission(this.cmd.getPerm()) && !sender.isOp()) { 23 | BBC.NO_PERM.send(plr, this.cmd.getPerm()); 24 | return true; 25 | } 26 | this.cmd.executeSafe(plr, args); 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/chat/JsonRepresentedObject.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.chat; 2 | 3 | import com.google.gson.stream.JsonWriter; 4 | import java.io.IOException; 5 | 6 | /** 7 | * Represents an object that can be serialized to a JSON writer instance. 8 | */ 9 | interface JsonRepresentedObject { 10 | 11 | /** 12 | * Writes the JSON representation of this object to the specified writer. 13 | * @param writer The JSON writer which will receive the object. 14 | * @throws java.io.IOException If an error occurs writing to the stream. 15 | */ 16 | public void writeJson(JsonWriter writer) throws IOException; 17 | 18 | } 19 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/chat/JsonString.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.chat; 2 | 3 | import com.google.gson.stream.JsonWriter; 4 | import java.io.IOException; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | import org.bukkit.configuration.serialization.ConfigurationSerializable; 8 | 9 | /** 10 | * Represents a JSON string value. 11 | * Writes by this object will not write name values nor begin/end objects in the JSON stream. 12 | * All writes merely write the represented string value. 13 | */ 14 | final class JsonString implements JsonRepresentedObject, ConfigurationSerializable { 15 | 16 | private String _value; 17 | 18 | public JsonString(CharSequence value) { 19 | _value = value == null ? null : value.toString(); 20 | } 21 | 22 | @Override 23 | public void writeJson(JsonWriter writer) throws IOException { 24 | writer.value(getValue()); 25 | } 26 | 27 | public String getValue() { 28 | return _value; 29 | } 30 | 31 | public Map serialize() { 32 | HashMap theSingleValue = new HashMap(); 33 | theSingleValue.put("stringValue", _value); 34 | return theSingleValue; 35 | } 36 | 37 | public static JsonString deserialize(Map map) { 38 | return new JsonString(map.get("stringValue").toString()); 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return _value; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/regions/BukkitMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.regions; 2 | 3 | import com.boydti.fawe.regions.FaweMask; 4 | import com.sk89q.worldedit.BlockVector; 5 | import org.bukkit.Location; 6 | 7 | public class BukkitMask extends FaweMask { 8 | 9 | public BukkitMask(Location pos1, Location pos2) { 10 | this(pos1, pos2, null); 11 | } 12 | 13 | public BukkitMask(Location pos1, Location pos2, String name) { 14 | super(new BlockVector(pos1.getBlockX(), pos1.getBlockY(), pos1.getBlockZ()), new BlockVector(pos2.getBlockX(), pos2.getBlockY(), pos2.getBlockZ()), name); 15 | } 16 | } -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/regions/BukkitMaskManager.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.regions; 2 | 3 | import com.boydti.fawe.regions.FaweMaskManager; 4 | import org.bukkit.entity.Player; 5 | 6 | public abstract class BukkitMaskManager extends FaweMaskManager { 7 | 8 | public BukkitMaskManager(final String plugin) { 9 | super(plugin); 10 | } 11 | 12 | public boolean hasMemberPermission(Player player) { 13 | return player.hasPermission("fawe." + getKey() + ".member"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/util/VaultUtil.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.util; 2 | 3 | import net.milkbowl.vault.permission.Permission; 4 | import org.bukkit.Bukkit; 5 | import org.bukkit.plugin.RegisteredServiceProvider; 6 | 7 | public class VaultUtil { 8 | public final Permission permission; 9 | 10 | public VaultUtil() { 11 | final RegisteredServiceProvider permissionProvider = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class); 12 | if (permissionProvider != null) { 13 | this.permission = permissionProvider.getProvider(); 14 | } else { 15 | this.permission = null; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/util/cui/CUIListener.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.util.cui; 2 | 3 | import com.boydti.fawe.object.FawePlayer; 4 | import com.boydti.fawe.util.cui.CUI; 5 | import org.bukkit.Bukkit; 6 | import org.bukkit.Location; 7 | import org.bukkit.event.EventHandler; 8 | import org.bukkit.event.Listener; 9 | import org.bukkit.event.player.PlayerMoveEvent; 10 | import org.bukkit.plugin.Plugin; 11 | 12 | public class CUIListener implements Listener { 13 | 14 | public CUIListener(Plugin plugin) { 15 | Bukkit.getPluginManager().registerEvents(this, plugin); 16 | } 17 | 18 | @EventHandler 19 | public void onPlayerMove(PlayerMoveEvent event) { 20 | Location from = event.getFrom(); 21 | Location to = event.getTo(); 22 | if ((int) from.getX() >> 2 != (int) to.getX() >> 2 || (int) from.getZ() >> 2 != (int) to.getZ() >> 2 || (int) from.getY() >> 2 != (int) to.getY() >> 2) { 23 | FawePlayer player = FawePlayer.wrap(event.getPlayer()); 24 | CUI cui = player.getMeta("CUI"); 25 | if (cui instanceof StructureCUI) { 26 | StructureCUI sCui = (StructureCUI) cui; 27 | sCui.update(); 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/v0/ChunkListener_8.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.v0; 2 | 3 | import sun.misc.SharedSecrets; 4 | 5 | public class ChunkListener_8 extends ChunkListener { 6 | 7 | @Override 8 | protected int getDepth(Exception ex) { 9 | return SharedSecrets.getJavaLangAccess().getStackTraceDepth(ex); 10 | } 11 | 12 | @Override 13 | protected StackTraceElement getElement(Exception ex, int index) { 14 | return SharedSecrets.getJavaLangAccess().getStackTraceElement(ex, index); 15 | } 16 | } -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/v0/ChunkListener_8Plus.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.v0; 2 | 3 | import org.bukkit.event.EventHandler; 4 | import org.bukkit.event.EventPriority; 5 | import org.bukkit.event.Listener; 6 | import org.bukkit.event.block.BlockExplodeEvent; 7 | 8 | public class ChunkListener_8Plus implements Listener { 9 | private final ChunkListener listener; 10 | 11 | public ChunkListener_8Plus(ChunkListener listener) { 12 | this.listener = listener; 13 | } 14 | @EventHandler(priority = EventPriority.LOWEST) 15 | public void event(BlockExplodeEvent event) { 16 | listener.reset(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/v0/PaperChunkCallback.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.v0; 2 | 3 | import org.bukkit.Chunk; 4 | import org.bukkit.World; 5 | 6 | public abstract class PaperChunkCallback { 7 | public PaperChunkCallback(World world, int x, int z) { 8 | world.getChunkAtAsync(x, z, chunk -> PaperChunkCallback.this.onLoad(chunk)); 9 | } 10 | 11 | public abstract void onLoad(Chunk chunk); 12 | } 13 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/v1_10/MutableGenLayer.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.v1_10; 2 | 3 | import java.util.Arrays; 4 | import net.minecraft.server.v1_10_R1.GenLayer; 5 | import net.minecraft.server.v1_10_R1.IntCache; 6 | 7 | public class MutableGenLayer extends GenLayer { 8 | 9 | private int biome; 10 | 11 | public MutableGenLayer(long seed) { 12 | super(seed); 13 | } 14 | 15 | public MutableGenLayer set(int biome) { 16 | this.biome = biome; 17 | return this; 18 | } 19 | 20 | @Override 21 | public int[] a(int areaX, int areaY, int areaWidth, int areaHeight) { 22 | int[] biomes = IntCache.a(areaWidth * areaHeight); 23 | Arrays.fill(biomes, biome); 24 | return biomes; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/v1_11/MutableGenLayer.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.v1_11; 2 | 3 | import java.util.Arrays; 4 | import net.minecraft.server.v1_11_R1.GenLayer; 5 | import net.minecraft.server.v1_11_R1.IntCache; 6 | 7 | public class MutableGenLayer extends GenLayer { 8 | 9 | private int biome; 10 | 11 | public MutableGenLayer(long seed) { 12 | super(seed); 13 | } 14 | 15 | public MutableGenLayer set(int biome) { 16 | this.biome = biome; 17 | return this; 18 | } 19 | 20 | @Override 21 | public int[] a(int areaX, int areaY, int areaWidth, int areaHeight) { 22 | int[] biomes = IntCache.a(areaWidth * areaHeight); 23 | Arrays.fill(biomes, biome); 24 | return biomes; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/v1_12/MutableGenLayer.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.v1_12; 2 | 3 | import java.util.Arrays; 4 | import net.minecraft.server.v1_12_R1.GenLayer; 5 | import net.minecraft.server.v1_12_R1.IntCache; 6 | 7 | public class MutableGenLayer extends GenLayer { 8 | 9 | private int biome; 10 | 11 | public MutableGenLayer(long seed) { 12 | super(seed); 13 | } 14 | 15 | public MutableGenLayer set(int biome) { 16 | this.biome = biome; 17 | return this; 18 | } 19 | 20 | @Override 21 | public int[] a(int areaX, int areaY, int areaWidth, int areaHeight) { 22 | int[] biomes = IntCache.a(areaWidth * areaHeight); 23 | Arrays.fill(biomes, biome); 24 | return biomes; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/v1_7/MutableGenLayer.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.v1_7; 2 | 3 | import java.util.Arrays; 4 | import net.minecraft.server.v1_7_R4.GenLayer; 5 | import net.minecraft.server.v1_7_R4.IntCache; 6 | 7 | public class MutableGenLayer extends GenLayer { 8 | 9 | private int biome; 10 | 11 | public MutableGenLayer(long seed) { 12 | super(seed); 13 | } 14 | 15 | public MutableGenLayer set(int biome) { 16 | this.biome = biome; 17 | return this; 18 | } 19 | 20 | @Override 21 | public int[] a(int areaX, int areaY, int areaWidth, int areaHeight) { 22 | int[] biomes = IntCache.a(areaWidth * areaHeight); 23 | Arrays.fill(biomes, biome); 24 | return biomes; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/v1_8/MutableGenLayer.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.v1_8; 2 | 3 | import java.util.Arrays; 4 | import net.minecraft.server.v1_8_R3.GenLayer; 5 | import net.minecraft.server.v1_8_R3.IntCache; 6 | 7 | public class MutableGenLayer extends GenLayer { 8 | 9 | private int biome; 10 | 11 | public MutableGenLayer(long seed) { 12 | super(seed); 13 | } 14 | 15 | public MutableGenLayer set(int biome) { 16 | this.biome = biome; 17 | return this; 18 | } 19 | 20 | @Override 21 | public int[] a(int areaX, int areaY, int areaWidth, int areaHeight) { 22 | int[] biomes = IntCache.a(areaWidth * areaHeight); 23 | Arrays.fill(biomes, biome); 24 | return biomes; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/boydti/fawe/bukkit/v1_9/MutableGenLayer.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.v1_9; 2 | 3 | import java.util.Arrays; 4 | import net.minecraft.server.v1_9_R2.GenLayer; 5 | import net.minecraft.server.v1_9_R2.IntCache; 6 | 7 | public class MutableGenLayer extends GenLayer { 8 | 9 | private int biome; 10 | 11 | public MutableGenLayer(long seed) { 12 | super(seed); 13 | } 14 | 15 | public MutableGenLayer set(int biome) { 16 | this.biome = biome; 17 | return this; 18 | } 19 | 20 | @Override 21 | public int[] a(int areaX, int areaY, int areaWidth, int areaHeight) { 22 | int[] biomes = IntCache.a(areaWidth * areaHeight); 23 | Arrays.fill(biomes, biome); 24 | return biomes; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bukkit/src/main/java/com/sk89q/worldedit/bukkit/DelegateEntity.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.bukkit; 2 | 3 | import com.sk89q.worldedit.entity.BaseEntity; 4 | import com.sk89q.worldedit.entity.Entity; 5 | import com.sk89q.worldedit.extent.Extent; 6 | import com.sk89q.worldedit.util.Location; 7 | import javax.annotation.Nullable; 8 | 9 | public class DelegateEntity implements Entity { 10 | private final Entity parent; 11 | 12 | public DelegateEntity(Entity parent) { 13 | this.parent = parent; 14 | } 15 | 16 | public Entity getParent() { 17 | return parent; 18 | } 19 | 20 | @Override 21 | @Nullable 22 | public BaseEntity getState() { 23 | return parent.getState(); 24 | } 25 | 26 | @Override 27 | public Location getLocation() { 28 | return parent.getLocation(); 29 | } 30 | 31 | @Override 32 | public Extent getExtent() { 33 | return parent.getExtent(); 34 | } 35 | 36 | @Override 37 | public boolean remove() { 38 | return parent.remove(); 39 | } 40 | 41 | @Override 42 | @Nullable 43 | public T getFacet(Class cls) { 44 | return parent.getFacet(cls); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /bukkit/src/main/resources/config.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/bukkit/src/main/resources/config.yml -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/FaweVersion.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe; 2 | 3 | public class FaweVersion { 4 | public final int year, month, day, hash, build, major, minor, patch; 5 | 6 | public FaweVersion(String version) { 7 | String[] split = version.substring(version.indexOf('=') + 1).split("-"); 8 | if (split[0].equals("unknown")) { 9 | this.year = month = day = hash = build = major = minor = patch = 0; 10 | return; 11 | } 12 | String[] date = split[0].split("\\."); 13 | this.year = Integer.parseInt(date[0]); 14 | this.month = Integer.parseInt(date[1]); 15 | this.day = Integer.parseInt(date[2]); 16 | this.hash = Integer.parseInt(split[1], 16); 17 | this.build = Integer.parseInt(split[2]); 18 | String[] semver = split[3].split("\\."); 19 | this.major = Integer.parseInt(semver[0]); 20 | this.minor = Integer.parseInt(semver[1]); 21 | this.patch = Integer.parseInt(semver[2]); 22 | } 23 | 24 | @Override 25 | public String toString() { 26 | return "FastAsyncWorldEdit-" + year + "." + month + "." + day + "-" + Integer.toHexString(hash) + "-" + build; 27 | } 28 | 29 | public boolean isNewer(FaweVersion other) { 30 | return other.build < this.build && (this.major > other.major || (this.major == other.major && this.minor > other.minor) || (this.major == other.major && this.minor == other.minor && this.patch > other.patch)); 31 | } 32 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/command/Cancel.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.command; 2 | 3 | import com.boydti.fawe.config.BBC; 4 | import com.boydti.fawe.object.FaweCommand; 5 | import com.boydti.fawe.object.FawePlayer; 6 | import com.boydti.fawe.object.FaweQueue; 7 | import com.boydti.fawe.object.brush.visualization.VirtualWorld; 8 | import com.boydti.fawe.util.SetQueue; 9 | import com.sk89q.worldedit.EditSession; 10 | import java.util.Collection; 11 | import java.util.UUID; 12 | 13 | public class Cancel extends FaweCommand { 14 | 15 | public Cancel() { 16 | super("fawe.cancel", false); 17 | } 18 | 19 | @Override 20 | public boolean execute(final FawePlayer player, final String... args) { 21 | if (player == null) { 22 | return false; 23 | } 24 | int cancelled = player.cancel(false); 25 | BBC.WORLDEDIT_CANCEL_COUNT.send(player, cancelled); 26 | return true; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/command/FaweBinding.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.command; 2 | 3 | import com.sk89q.worldedit.WorldEdit; 4 | import com.sk89q.worldedit.internal.command.WorldEditBinding; 5 | 6 | public class FaweBinding extends WorldEditBinding { 7 | private final WorldEdit worldEdit; 8 | 9 | public FaweBinding(WorldEdit worldEdit) { 10 | super(worldEdit); 11 | this.worldEdit = worldEdit; 12 | } 13 | 14 | public WorldEdit getWorldEdit() { 15 | return worldEdit; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/configuration/MemoryConfigurationOptions.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.configuration; 2 | 3 | /** 4 | * Various settings for controlling the input and output of a {@link 5 | * com.boydti.fawe.configuration.MemoryConfiguration} 6 | */ 7 | public class MemoryConfigurationOptions extends ConfigurationOptions { 8 | protected MemoryConfigurationOptions(final MemoryConfiguration configuration) { 9 | super(configuration); 10 | } 11 | 12 | @Override 13 | public MemoryConfiguration configuration() { 14 | return (MemoryConfiguration) super.configuration(); 15 | } 16 | 17 | @Override 18 | public com.boydti.fawe.configuration.MemoryConfigurationOptions copyDefaults(final boolean value) { 19 | super.copyDefaults(value); 20 | return this; 21 | } 22 | 23 | @Override 24 | public com.boydti.fawe.configuration.MemoryConfigurationOptions pathSeparator(final char value) { 25 | super.pathSeparator(value); 26 | return this; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/configuration/serialization/DelegateDeserialization.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.configuration.serialization; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Applies to a {@link com.boydti.fawe.configuration.serialization.ConfigurationSerializable} that will delegate all 10 | * deserialization to another {@link com.boydti.fawe.configuration.serialization.ConfigurationSerializable}. 11 | */ 12 | @Retention(RetentionPolicy.RUNTIME) 13 | @Target(ElementType.TYPE) 14 | public @interface DelegateDeserialization { 15 | /** 16 | * Which class should be used as a delegate for this classes 17 | * deserialization 18 | * 19 | * @return Delegate class 20 | */ 21 | Class value(); 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/configuration/serialization/SerializableAs.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.configuration.serialization; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * Represents an "alias" that a {@link com.boydti.fawe.configuration.serialization.ConfigurationSerializable} may be 10 | * stored as. 11 | * If this is not present on a {@link com.boydti.fawe.configuration.serialization.ConfigurationSerializable} class, it 12 | * will use the fully qualified name of the class. 13 | *

14 | * This value will be stored in the configuration so that the configuration 15 | * deserialization can determine what type it is. 16 | *

17 | * Using this annotation on any other class than a {@link 18 | * com.boydti.fawe.configuration.serialization.ConfigurationSerializable} will have no effect. 19 | * 20 | * @see com.boydti.fawe.configuration.serialization.ConfigurationSerialization#registerClass(Class, String) 21 | */ 22 | @Retention(RetentionPolicy.RUNTIME) 23 | @Target(ElementType.TYPE) 24 | public @interface SerializableAs { 25 | /** 26 | * This is the name your class will be stored and retrieved as. 27 | *

28 | * This name MUST be unique. We recommend using names such as 29 | * "MyPluginThing" instead of "Thing". 30 | * 31 | * @return Name to serialize the class as. 32 | */ 33 | String value(); 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/example/IFaweQueueMap.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.example; 2 | 3 | import com.boydti.fawe.object.FaweChunk; 4 | import com.boydti.fawe.object.RunnableVal; 5 | import java.util.Collection; 6 | 7 | public interface IFaweQueueMap { 8 | 9 | Collection getFaweCunks(); 10 | 11 | void forEachChunk(RunnableVal onEach); 12 | 13 | FaweChunk getFaweChunk(int cx, int cz); 14 | 15 | FaweChunk getCachedFaweChunk(int cx, int cz); 16 | 17 | void add(FaweChunk chunk); 18 | 19 | void clear(); 20 | 21 | int size(); 22 | 23 | boolean next(int size, long time); 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/example/NullQueueCharFaweChunk.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.example; 2 | 3 | import com.boydti.fawe.object.FaweChunk; 4 | import com.boydti.fawe.util.MainUtil; 5 | 6 | public class NullQueueCharFaweChunk extends CharFaweChunk { 7 | 8 | public NullQueueCharFaweChunk(int cx, int cz) { 9 | super(null, cx, cz); 10 | } 11 | 12 | public NullQueueCharFaweChunk(int x, int z, char[][] ids, short[] count, short[] air, byte[] heightMap) { 13 | super(null, x, z, ids, count, air, heightMap); 14 | } 15 | 16 | @Override 17 | public Object getNewChunk() { 18 | return null; 19 | } 20 | 21 | @Override 22 | public CharFaweChunk copy(boolean shallow) { 23 | if (shallow) { 24 | return new NullQueueCharFaweChunk(getX(), getZ(), ids, count, air, heightMap); 25 | } else { 26 | return new NullQueueCharFaweChunk(getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone()); 27 | } 28 | } 29 | 30 | @Override 31 | public FaweChunk call() { 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/example/NullRelighter.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.example; 2 | 3 | public class NullRelighter implements Relighter { 4 | 5 | public static NullRelighter INSTANCE = new NullRelighter(); 6 | 7 | private NullRelighter() { 8 | } 9 | 10 | @Override 11 | public boolean addChunk(int cx, int cz, byte[] fix, int bitmask) { 12 | return false; 13 | } 14 | 15 | @Override 16 | public void addLightUpdate(int x, int y, int z) { 17 | 18 | } 19 | 20 | @Override 21 | public void fixLightingSafe(boolean sky) { 22 | 23 | } 24 | 25 | @Override 26 | public void clear() { 27 | 28 | } 29 | 30 | @Override 31 | public void removeLighting() { 32 | 33 | } 34 | 35 | @Override 36 | public void fixBlockLighting() { 37 | 38 | } 39 | 40 | @Override 41 | public void fixSkyLighting() { 42 | 43 | } 44 | 45 | @Override 46 | public boolean isEmpty() { 47 | return true; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/example/Relighter.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.example; 2 | 3 | public interface Relighter { 4 | boolean addChunk(int cx, int cz, byte[] skipReason, int bitmask); 5 | 6 | void addLightUpdate(int x, int y, int z); 7 | 8 | void fixLightingSafe(boolean sky); 9 | 10 | default void removeAndRelight(boolean sky) { 11 | removeLighting(); 12 | fixLightingSafe(sky); 13 | } 14 | 15 | void clear(); 16 | 17 | void removeLighting(); 18 | 19 | void fixBlockLighting(); 20 | 21 | void fixSkyLighting(); 22 | 23 | boolean isEmpty(); 24 | 25 | public static class SkipReason { 26 | public static final byte NONE = 0; 27 | public static final byte AIR = 1; 28 | public static final byte SOLID = 2; 29 | } 30 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/example/SimpleCharFaweChunk.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.example; 2 | 3 | import com.boydti.fawe.object.FaweChunk; 4 | import com.boydti.fawe.object.FaweQueue; 5 | import com.boydti.fawe.util.MainUtil; 6 | 7 | public class SimpleCharFaweChunk extends CharFaweChunk { 8 | 9 | public SimpleCharFaweChunk(FaweQueue parent, int x, int z) { 10 | super(parent, x, z); 11 | } 12 | 13 | public SimpleCharFaweChunk(FaweQueue parent, int x, int z, char[][] ids, short[] count, short[] air, byte[] heightMap) { 14 | super(parent, x, z, ids, count, air, heightMap); 15 | } 16 | 17 | @Override 18 | public Object getNewChunk() { 19 | return this; 20 | } 21 | 22 | @Override 23 | public CharFaweChunk copy(boolean shallow) { 24 | SimpleCharFaweChunk copy; 25 | if (shallow) { 26 | copy = new SimpleCharFaweChunk(getParent(), getX(), getZ(), ids, count, air, heightMap); 27 | copy.biomes = biomes; 28 | } else { 29 | copy = new SimpleCharFaweChunk(getParent(), getX(), getZ(), (char[][]) MainUtil.copyNd(ids), count.clone(), air.clone(), heightMap.clone()); 30 | copy.biomes = biomes != null ? biomes.clone() : null; 31 | } 32 | return copy; 33 | } 34 | 35 | @Override 36 | public FaweChunk call() { 37 | getParent().setChunk(this); 38 | return this; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/NBTException.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt; 2 | 3 | public class NBTException extends RuntimeException { 4 | public NBTException(String message) { 5 | super(message); 6 | } 7 | 8 | /** 9 | * Faster exception throwing if you don't fill the stacktrace 10 | * 11 | * @return 12 | */ 13 | @Override 14 | public Throwable fillInStackTrace() { 15 | return this; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/anvil/ChunkSimplifier.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt.anvil; 2 | 3 | public class ChunkSimplifier { 4 | private final HeightMapMCAGenerator gen; 5 | 6 | public ChunkSimplifier(HeightMapMCAGenerator gen) { 7 | this.gen = gen; 8 | } 9 | 10 | public void simplify(MCAChunk chunk) { 11 | // Copy biome 12 | // Calculate water level 13 | // Determine floor block 14 | // Determine overlay block 15 | // determine main block 16 | // Copy bedrock 17 | // copy anomalies to blocks 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAClipboard.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt.anvil; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.regions.CuboidRegion; 5 | 6 | public class MCAClipboard { 7 | private final MCAQueue queue; 8 | private final CuboidRegion region; 9 | private final Vector origin; 10 | 11 | public MCAClipboard(MCAQueue queue, CuboidRegion region, Vector origin) { 12 | this.queue = queue; 13 | this.region = region; 14 | this.origin = origin; 15 | } 16 | 17 | public MCAQueue getQueue() { 18 | return queue; 19 | } 20 | 21 | public CuboidRegion getRegion() { 22 | return region; 23 | } 24 | 25 | public Vector getOrigin() { 26 | return origin; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/anvil/MCAFilterCounter.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt.anvil; 2 | 3 | import com.boydti.fawe.object.number.MutableLong; 4 | 5 | public class MCAFilterCounter extends MCAFilter { 6 | @Override 7 | public void finishChunk(MCAChunk chunk, MutableLong cache) { 8 | cache.add(chunk.getModified()); 9 | } 10 | 11 | @Override 12 | public MutableLong init() { 13 | return new MutableLong(); 14 | } 15 | 16 | public long getTotal() { 17 | long total = 0; 18 | for (MutableLong value : getAll()) { 19 | total += value.get(); 20 | } 21 | return total; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/anvil/filters/CountIdFilter.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt.anvil.filters; 2 | 3 | import com.boydti.fawe.FaweCache; 4 | import com.boydti.fawe.jnbt.anvil.MCAChunk; 5 | import com.boydti.fawe.jnbt.anvil.MCAFilterCounter; 6 | import com.boydti.fawe.object.number.MutableLong; 7 | import com.sk89q.worldedit.blocks.BaseBlock; 8 | 9 | public class CountIdFilter extends MCAFilterCounter { 10 | private final boolean[] allowedId = new boolean[FaweCache.getId(Character.MAX_VALUE)]; 11 | 12 | public CountIdFilter() { 13 | } 14 | 15 | public CountIdFilter addBlock(int id) { 16 | allowedId[id] = true; 17 | return this; 18 | } 19 | 20 | public CountIdFilter addBlock(BaseBlock block) { 21 | allowedId[block.getId()] = true; 22 | return this; 23 | } 24 | 25 | @Override 26 | public MCAChunk applyChunk(MCAChunk chunk, MutableLong count) { 27 | for (int layer = 0; layer < chunk.ids.length; layer++) { 28 | byte[] ids = chunk.ids[layer]; 29 | if (ids != null) { 30 | for (byte i : ids) { 31 | if (allowedId[i & 0xFF]) { 32 | count.increment(); 33 | } 34 | } 35 | } 36 | } 37 | return null; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/anvil/filters/DeleteBiomeFilterSimple.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt.anvil.filters; 2 | 3 | import com.boydti.fawe.jnbt.anvil.MCAChunk; 4 | import com.boydti.fawe.jnbt.anvil.MCAFilterCounter; 5 | import com.boydti.fawe.object.number.MutableLong; 6 | import com.sk89q.worldedit.world.biome.BaseBiome; 7 | 8 | public class DeleteBiomeFilterSimple extends MCAFilterCounter { 9 | private final int id; 10 | 11 | public DeleteBiomeFilterSimple(BaseBiome biome) { 12 | this.id = biome.getId(); 13 | } 14 | 15 | @Override 16 | public MCAChunk applyChunk(MCAChunk chunk, MutableLong cache) { 17 | if ((chunk.biomes[0] & 0xFF) == id) { 18 | chunk.setDeleted(true); 19 | cache.add(Character.MAX_VALUE); 20 | } 21 | return null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/anvil/filters/DeleteOldFilter.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt.anvil.filters; 2 | 3 | import com.boydti.fawe.jnbt.anvil.MCAFilterCounter; 4 | import java.nio.file.Path; 5 | import java.nio.file.attribute.BasicFileAttributes; 6 | 7 | public class DeleteOldFilter extends MCAFilterCounter { 8 | private final long time; 9 | 10 | public DeleteOldFilter(long time) { 11 | this.time = time; 12 | if (time < 1) { 13 | throw new IllegalArgumentException("Time must be positive"); 14 | } 15 | } 16 | 17 | @Override 18 | public boolean appliesFile(Path path, BasicFileAttributes attr) { 19 | long modified = attr.lastModifiedTime().toMillis(); 20 | long access = attr.lastAccessTime().toMillis(); 21 | long last = Math.max(modified, access); 22 | if (last != 0 && System.currentTimeMillis() - last > this.time) { 23 | path.toFile().delete(); 24 | get().add(512 * 512 * 256); 25 | } 26 | return false; 27 | } 28 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/anvil/filters/ReplacePatternFilter.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt.anvil.filters; 2 | 3 | import com.boydti.fawe.FaweCache; 4 | import com.boydti.fawe.jnbt.anvil.MCAFilterCounter; 5 | import com.boydti.fawe.object.mask.FaweBlockMatcher; 6 | import com.boydti.fawe.object.number.MutableLong; 7 | import com.sk89q.worldedit.blocks.BaseBlock; 8 | import com.sk89q.worldedit.function.pattern.Pattern; 9 | 10 | public class ReplacePatternFilter extends MCAFilterCounter { 11 | private final FaweBlockMatcher matchFrom; 12 | private final Pattern to; 13 | 14 | public ReplacePatternFilter(FaweBlockMatcher from, Pattern to) { 15 | this.matchFrom = from; 16 | this.to = to; 17 | } 18 | 19 | @Override 20 | public void applyBlock(int x, int y, int z, BaseBlock block, MutableLong ignore) { 21 | if (matchFrom.apply(block)) { 22 | BaseBlock newBlock = to.apply(x, y, z); 23 | int currentId = block.getId(); 24 | if (FaweCache.hasNBT(currentId)) { 25 | block.setNbtData(null); 26 | } 27 | block.setId(newBlock.getId()); 28 | block.setData(newBlock.getData()); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/anvil/filters/ReplaceSimpleFilter.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt.anvil.filters; 2 | 3 | import com.boydti.fawe.jnbt.anvil.MCAFilterCounter; 4 | import com.boydti.fawe.object.mask.FaweBlockMatcher; 5 | import com.boydti.fawe.object.number.MutableLong; 6 | import com.sk89q.worldedit.blocks.BaseBlock; 7 | 8 | public class ReplaceSimpleFilter extends MCAFilterCounter { 9 | private final FaweBlockMatcher to; 10 | private final FaweBlockMatcher from; 11 | 12 | public ReplaceSimpleFilter(FaweBlockMatcher from, FaweBlockMatcher to) { 13 | this.from = from; 14 | this.to = to; 15 | } 16 | 17 | @Override 18 | public void applyBlock(int x, int y, int z, BaseBlock block, MutableLong count) { 19 | if (from.apply(block)) { 20 | to.apply(block); 21 | count.increment(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/anvil/filters/SetPatternFilter.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt.anvil.filters; 2 | 3 | import com.boydti.fawe.FaweCache; 4 | import com.boydti.fawe.jnbt.anvil.MCAFilterCounter; 5 | import com.boydti.fawe.object.number.MutableLong; 6 | import com.sk89q.worldedit.blocks.BaseBlock; 7 | import com.sk89q.worldedit.function.pattern.Pattern; 8 | 9 | public class SetPatternFilter extends MCAFilterCounter { 10 | private final Pattern to; 11 | 12 | public SetPatternFilter(Pattern to) { 13 | this.to = to; 14 | } 15 | 16 | @Override 17 | public void applyBlock(int x, int y, int z, BaseBlock block, MutableLong count) { 18 | BaseBlock newBlock = to.apply(x, y, z); 19 | int currentId = block.getId(); 20 | if (FaweCache.hasNBT(currentId)) { 21 | block.setNbtData(null); 22 | } 23 | block.setId(newBlock.getId()); 24 | block.setData(newBlock.getData()); 25 | count.increment(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/anvil/generator/Resource.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt.anvil.generator; 2 | 3 | import com.boydti.fawe.object.PseudoRandom; 4 | import com.sk89q.worldedit.WorldEditException; 5 | 6 | public abstract class Resource { 7 | public Resource() { 8 | } 9 | 10 | public abstract boolean spawn(PseudoRandom random, int x, int z) throws WorldEditException; 11 | } 12 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/anvil/history/IAnvilHistory.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt.anvil.history; 2 | 3 | import java.io.File; 4 | 5 | public interface IAnvilHistory { 6 | default boolean addFileChange(File originalMCAFile) { 7 | return originalMCAFile.delete(); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/jnbt/anvil/history/NullAnvilHistory.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.jnbt.anvil.history; 2 | 3 | public class NullAnvilHistory implements IAnvilHistory { 4 | } 5 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/logging/MutableBlockData.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.logging; 2 | 3 | import org.primesoft.blockshub.api.BlockData; 4 | 5 | public class MutableBlockData extends BlockData { 6 | public int data; 7 | public int id; 8 | 9 | public MutableBlockData() { 10 | super(0, 0); 11 | this.id = 0; 12 | this.data = 0; 13 | } 14 | 15 | @Override 16 | public int getType() { 17 | return id; 18 | } 19 | 20 | @Override 21 | public int getData() { 22 | return data; 23 | } 24 | 25 | @Override 26 | public boolean isAir() { 27 | return id == 0; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/logging/MutableVector.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.logging; 2 | 3 | import org.primesoft.blockshub.api.Vector; 4 | 5 | public class MutableVector extends Vector { 6 | 7 | public double x, y, z; 8 | 9 | public MutableVector() { 10 | super(0, 0, 0); 11 | this.x = 0; 12 | this.y = 0; 13 | this.z = 0; 14 | } 15 | 16 | @Override 17 | public double getX() { 18 | return x; 19 | } 20 | 21 | @Override 22 | public double getY() { 23 | return y; 24 | } 25 | 26 | @Override 27 | public double getZ() { 28 | return z; 29 | } 30 | 31 | public boolean equals(Object obj) { 32 | if (!(obj instanceof Vector)) { 33 | return false; 34 | } else { 35 | Vector v = (Vector) obj; 36 | return this.x == v.getX() && this.z == v.getZ() && this.y == v.getY(); 37 | } 38 | } 39 | 40 | public int hashCode() { 41 | byte hash = 3; 42 | int hash1 = 59 * hash + (int) (Double.doubleToLongBits(this.x) ^ Double.doubleToLongBits(this.x) >>> 32); 43 | hash1 = 59 * hash1 + (int) (Double.doubleToLongBits(this.y) ^ Double.doubleToLongBits(this.y) >>> 32); 44 | hash1 = 59 * hash1 + (int) (Double.doubleToLongBits(this.z) ^ Double.doubleToLongBits(this.z) >>> 32); 45 | return hash1; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/BytePair.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object; 2 | 3 | import com.boydti.fawe.util.MathMan; 4 | 5 | public class BytePair { 6 | public short pair; 7 | 8 | public BytePair(final byte x, final byte z) { 9 | this.pair = MathMan.pairByte(x, z); 10 | } 11 | 12 | public int get0x() { 13 | return MathMan.unpair16x((byte) get0()); 14 | } 15 | 16 | public int get0y() { 17 | return MathMan.unpair16y((byte) get0()); 18 | } 19 | 20 | public int get0() { 21 | return MathMan.unpairShortX(pair); 22 | } 23 | 24 | public int get1() { 25 | return MathMan.unpairShortY(pair); 26 | } 27 | 28 | @Override 29 | public int hashCode() { 30 | return pair; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return pair + ""; 36 | } 37 | 38 | @Override 39 | public boolean equals(final Object obj) { 40 | return obj.hashCode() == pair; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/DelegateConsumer.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object; 2 | 3 | import java.util.function.Consumer; 4 | 5 | public abstract class DelegateConsumer implements Consumer { 6 | private final Consumer parent; 7 | 8 | public DelegateConsumer(Consumer parent) { 9 | this.parent = parent; 10 | } 11 | 12 | @Override 13 | public void accept(T o) { 14 | parent.accept(o); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/FaweLocation.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object; 2 | 3 | import com.boydti.fawe.FaweAPI; 4 | import com.sk89q.worldedit.world.World; 5 | 6 | /** 7 | 8 | */ 9 | public class FaweLocation { 10 | 11 | public final int x; 12 | public final int y; 13 | public final int z; 14 | public final String world; 15 | 16 | public FaweLocation(final String world, final int x, final int y, final int z) { 17 | this.world = world; 18 | this.x = x; 19 | this.y = y; 20 | this.z = z; 21 | } 22 | 23 | @Override 24 | public boolean equals(final Object obj) { 25 | if (this == obj) { 26 | return true; 27 | } 28 | if (obj == null) { 29 | return false; 30 | } 31 | if (this.getClass() != obj.getClass()) { 32 | return false; 33 | } 34 | final FaweLocation other = (FaweLocation) obj; 35 | return ((this.x == other.x) && (this.y == other.y) && (this.z == other.z) && (this.world.equals(other.world))); 36 | } 37 | 38 | public World getWorld() { 39 | return FaweAPI.getWorld(world); 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return world + "," + x + "," + y + "," + z; 45 | } 46 | 47 | @Override 48 | public int hashCode() { 49 | return this.x << (8 + this.z) << (4 + this.y); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/HasFaweQueue.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object; 2 | 3 | public interface HasFaweQueue { 4 | FaweQueue getQueue(); 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/IntegerPair.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object; 2 | 3 | public class IntegerPair { 4 | public int x; 5 | public int z; 6 | 7 | public IntegerPair(final int x, final int z) { 8 | this.x = x; 9 | this.z = z; 10 | } 11 | 12 | @Override 13 | public int hashCode() { 14 | return (x << 16) | (z & 0xFFFF); 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return x + "," + z; 20 | } 21 | 22 | @Override 23 | public boolean equals(final Object obj) { 24 | if (this == obj) { 25 | return true; 26 | } 27 | if ((obj == null) || (this.getClass() != obj.getClass())) { 28 | return false; 29 | } 30 | final IntegerPair other = (IntegerPair) obj; 31 | return ((this.x == other.x) && (this.z == other.z)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/IntegerTrio.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object; 2 | 3 | public class IntegerTrio { 4 | public int x, y, z; 5 | 6 | public IntegerTrio(int x, int y, int z) { 7 | this.x = x; 8 | this.y = y; 9 | this.z = z; 10 | } 11 | 12 | public IntegerTrio(IntegerTrio node) { 13 | this.x = node.x; 14 | this.y = node.y; 15 | this.z = node.z; 16 | } 17 | 18 | public IntegerTrio() { 19 | } 20 | 21 | public final void set(int x, int y, int z) { 22 | this.x = x; 23 | this.y = y; 24 | this.z = z; 25 | } 26 | 27 | public final void set(IntegerTrio node) { 28 | this.x = node.x; 29 | this.y = node.y; 30 | this.z = node.z; 31 | } 32 | 33 | @Override 34 | public final int hashCode() { 35 | return (x ^ (z << 12)) ^ (y << 24); 36 | } 37 | 38 | public final int getX() { 39 | return x; 40 | } 41 | 42 | public final int getY() { 43 | return y; 44 | } 45 | 46 | public final int getZ() { 47 | return z; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | return x + "," + y + "," + z; 53 | } 54 | 55 | @Override 56 | public boolean equals(Object obj) { 57 | IntegerTrio other = (IntegerTrio) obj; 58 | return other.x == x && other.z == z && other.y == y; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/PseudoRandom.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object; 2 | 3 | @Deprecated 4 | /** 5 | * @Deprecated use ThreadLocalRandom instead 6 | */ 7 | public class PseudoRandom { 8 | public static PseudoRandom random = new PseudoRandom(); 9 | 10 | private long state; 11 | 12 | public PseudoRandom() { 13 | this.state = System.nanoTime(); 14 | } 15 | 16 | public PseudoRandom(final long state) { 17 | this.state = state; 18 | } 19 | 20 | public void setSeed(long state) { 21 | this.state = state; 22 | } 23 | 24 | public long nextLong() { 25 | final long a = this.state; 26 | this.state = this.xorShift64(a); 27 | return a; 28 | } 29 | 30 | public long xorShift64(long a) { 31 | a ^= (a << 21); 32 | a ^= (a >>> 35); 33 | a ^= (a << 4); 34 | return a; 35 | } 36 | 37 | public double nextDouble() { 38 | return 0x1.0p-63 * (((nextLong()) & 0x7FFFFFFFFFFFFFFFl)); 39 | } 40 | 41 | public int random(final int n) { 42 | if (n == 1) { 43 | return 0; 44 | } 45 | final long r = ((this.nextLong() >>> 32) * n) >> 32; 46 | return (int) r; 47 | } 48 | 49 | public int nextInt(int i) { 50 | return random(i); 51 | } 52 | 53 | public int nextInt(int start, int end) { 54 | return nextInt(end - start + 1) + start; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/RunnableVal.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object; 2 | 3 | import java.util.function.Consumer; 4 | import java.util.function.Supplier; 5 | 6 | public abstract class RunnableVal implements Runnable, Supplier, Consumer { 7 | public T value; 8 | 9 | public RunnableVal() { 10 | } 11 | 12 | public RunnableVal(T value) { 13 | this.value = value; 14 | } 15 | 16 | @Override 17 | public final void run() { 18 | run(this.value); 19 | } 20 | 21 | public final T runAndGet() { 22 | run(); 23 | return value; 24 | } 25 | 26 | public abstract void run(T value); 27 | 28 | @Override 29 | public T get() { 30 | return runAndGet(); 31 | } 32 | 33 | @Override 34 | public void accept(T t) { 35 | run(value); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/RunnableVal2.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object; 2 | 3 | public abstract class RunnableVal2 implements Runnable { 4 | public T value1; 5 | public U value2; 6 | 7 | public RunnableVal2() { 8 | } 9 | 10 | public RunnableVal2(T value1, U value2) { 11 | this.value1 = value1; 12 | this.value2 = value2; 13 | } 14 | 15 | @Override 16 | public void run() { 17 | run(this.value1, this.value2); 18 | } 19 | 20 | public abstract void run(T value1, U value2); 21 | 22 | public RunnableVal2 runAndGet(T value1, U value2) { 23 | run(value1, value2); 24 | return this; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/RunnableVal3.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object; 2 | 3 | public abstract class RunnableVal3 implements Runnable { 4 | public T value1; 5 | public U value2; 6 | public V value3; 7 | 8 | public RunnableVal3() { 9 | } 10 | 11 | public RunnableVal3(T value1, U value2, V value3) { 12 | this.value1 = value1; 13 | this.value2 = value2; 14 | this.value3 = value3; 15 | } 16 | 17 | @Override 18 | public void run() { 19 | run(value1, value2, value3); 20 | } 21 | 22 | public abstract void run(T value1, U value2, V value3); 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/RunnableVal4.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object; 2 | 3 | public abstract class RunnableVal4 implements Runnable { 4 | public T value1; 5 | public U value2; 6 | public V value3; 7 | public W value4; 8 | 9 | public RunnableVal4() { 10 | } 11 | 12 | public RunnableVal4(T value1, U value2, V value3, W value4) { 13 | this.value1 = value1; 14 | this.value2 = value2; 15 | this.value3 = value3; 16 | this.value4 = value4; 17 | } 18 | 19 | @Override 20 | public void run() { 21 | run(value1, value2, value3, value4); 22 | } 23 | 24 | public abstract void run(T value1, U value2, V value3, W value4); 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/AbstractBrush.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush; 2 | 3 | import com.sk89q.worldedit.command.tool.BrushTool; 4 | import com.sk89q.worldedit.command.tool.brush.Brush; 5 | 6 | public abstract class AbstractBrush implements Brush { 7 | private BrushTool tool; 8 | 9 | public AbstractBrush(BrushTool tool) { 10 | this.tool = tool; 11 | } 12 | 13 | public void setTool(BrushTool tool) { 14 | this.tool = tool; 15 | } 16 | 17 | public BrushTool getTool() { 18 | return tool; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/FlattenBrush.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush; 2 | 3 | import com.boydti.fawe.object.brush.heightmap.HeightMap; 4 | import com.boydti.fawe.object.brush.heightmap.ScalableHeightMap; 5 | import com.sk89q.worldedit.EditSession; 6 | import com.sk89q.worldedit.MaxChangedBlocksException; 7 | import com.sk89q.worldedit.Vector; 8 | import com.sk89q.worldedit.extent.clipboard.Clipboard; 9 | import com.sk89q.worldedit.function.mask.Mask; 10 | import com.sk89q.worldedit.function.mask.Masks; 11 | import com.sk89q.worldedit.function.pattern.Pattern; 12 | import java.io.InputStream; 13 | 14 | public class FlattenBrush extends HeightBrush { 15 | 16 | public FlattenBrush(InputStream stream, int rotation, double yscale, boolean layers, boolean smooth, Clipboard clipboard, ScalableHeightMap.Shape shape) { 17 | super(stream, rotation, yscale, layers, smooth, clipboard, shape); 18 | } 19 | 20 | @Override 21 | public void build(EditSession editSession, Vector position, Pattern pattern, double sizeDouble) throws MaxChangedBlocksException { 22 | int size = (int) sizeDouble; 23 | Mask mask = editSession.getMask(); 24 | if (mask == Masks.alwaysTrue() || mask == Masks.alwaysTrue2D()) { 25 | mask = null; 26 | } 27 | HeightMap map = getHeightMap(); 28 | map.setSize(size); 29 | map.perform(editSession, mask, position, size, rotation, yscale, smooth, true, layers); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/MovableTool.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush; 2 | 3 | import com.sk89q.worldedit.entity.Player; 4 | 5 | public interface MovableTool { 6 | public boolean move(Player player); 7 | } 8 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/RaiseBrush.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush; 2 | 3 | import com.sk89q.worldedit.EditSession; 4 | import com.sk89q.worldedit.MaxChangedBlocksException; 5 | import com.sk89q.worldedit.Vector; 6 | import com.sk89q.worldedit.function.pattern.Pattern; 7 | 8 | public class RaiseBrush extends ErodeBrush { 9 | @Override 10 | public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { 11 | this.erosion(editSession, 6, 0, 1, 1, position, size); 12 | } 13 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/ResettableTool.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush; 2 | 3 | public interface ResettableTool { 4 | boolean reset(); 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/ScatterOverlayBrush.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush; 2 | 3 | import com.boydti.fawe.object.collection.LocalBlockVectorSet; 4 | import com.sk89q.worldedit.EditSession; 5 | import com.sk89q.worldedit.MaxChangedBlocksException; 6 | import com.sk89q.worldedit.Vector; 7 | import com.sk89q.worldedit.function.pattern.Pattern; 8 | 9 | public class ScatterOverlayBrush extends ScatterBrush { 10 | public ScatterOverlayBrush(int count, int distance) { 11 | super(count, distance); 12 | } 13 | 14 | @Override 15 | public void apply(EditSession editSession, LocalBlockVectorSet placed, Vector pt, Pattern p, double size) throws MaxChangedBlocksException { 16 | int x = pt.getBlockX(); 17 | int y = pt.getBlockY(); 18 | int z = pt.getBlockZ(); 19 | Vector dir = getDirection(pt); 20 | dir.setComponents(x + dir.getBlockX(), y + dir.getBlockY(), z + dir.getBlockZ()); 21 | editSession.setBlock(dir, p); 22 | } 23 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/SpikeBrush.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush; 2 | 3 | import com.sk89q.worldedit.EditSession; 4 | import com.sk89q.worldedit.MaxChangedBlocksException; 5 | import com.sk89q.worldedit.Vector; 6 | import com.sk89q.worldedit.command.tool.brush.Brush; 7 | import com.sk89q.worldedit.function.pattern.Pattern; 8 | 9 | public class SpikeBrush implements Brush { 10 | 11 | @Override 12 | public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/TargetMode.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush; 2 | 3 | public enum TargetMode { 4 | TARGET_BLOCK_RANGE, 5 | FOWARD_POINT_PITCH, 6 | TARGET_POINT_HEIGHT, 7 | TARGET_FACE_RANGE, 8 | } 9 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/heightmap/AbstractDelegateHeightMap.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.heightmap; 2 | 3 | public class AbstractDelegateHeightMap implements HeightMap { 4 | 5 | private final HeightMap parent; 6 | 7 | public AbstractDelegateHeightMap(HeightMap parent) { 8 | this.parent = parent; 9 | } 10 | 11 | @Override 12 | public double getHeight(int x, int z) { 13 | return parent.getHeight(x, z); 14 | } 15 | 16 | @Override 17 | public void setSize(int size) { 18 | parent.setSize(size); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/heightmap/ArrayHeightMap.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.heightmap; 2 | 3 | public class ArrayHeightMap extends ScalableHeightMap { 4 | // The heights 5 | private final byte[][] height; 6 | // The height map width/length 7 | private final int width, length; 8 | // The size to width/length ratio 9 | private double rx, rz; 10 | 11 | public ArrayHeightMap(byte[][] height) { 12 | setSize(5); 13 | this.height = height; 14 | this.width = height.length; 15 | this.length = height[0].length; 16 | } 17 | 18 | @Override 19 | public void setSize(int size) { 20 | super.setSize(size); 21 | this.rx = (double) width / (size << 1); 22 | this.rz = (double) length / (size << 1); 23 | 24 | } 25 | 26 | @Override 27 | public double getHeight(int x, int z) { 28 | x = (int) Math.max(0, Math.min(width - 1, (x + size) * rx)); 29 | z = (int) Math.max(0, Math.min(length - 1, (z + size) * rz)); 30 | return ((height[x][z] & 0xFF) * size) / 256d; 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/heightmap/FlatScalableHeightMap.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.heightmap; 2 | 3 | public class FlatScalableHeightMap extends ScalableHeightMap { 4 | public FlatScalableHeightMap() { 5 | super(); 6 | } 7 | 8 | public double getHeight(int x, int z) { 9 | int dx = Math.abs(x); 10 | int dz = Math.abs(z); 11 | int d2 = dx * dx + dz * dz; 12 | if (d2 > size2) { 13 | return 0; 14 | } 15 | return size; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/heightmap/RotatableHeightMap.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.heightmap; 2 | 3 | import com.sk89q.worldedit.MutableBlockVector; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.math.transform.AffineTransform; 6 | 7 | public class RotatableHeightMap extends AbstractDelegateHeightMap { 8 | private AffineTransform transform; 9 | private MutableBlockVector mutable; 10 | 11 | public RotatableHeightMap(HeightMap parent) { 12 | super(parent); 13 | mutable = new MutableBlockVector(); 14 | this.transform = new AffineTransform(); 15 | } 16 | 17 | public void rotate(double angle) { 18 | this.transform = transform.rotateY(angle); 19 | } 20 | 21 | @Override 22 | public double getHeight(int x, int z) { 23 | mutable.mutX(x); 24 | mutable.mutZ(z); 25 | Vector pos = transform.apply(mutable.setComponents(x, 0, z)); 26 | return super.getHeight(pos.getBlockX(), pos.getBlockZ()); 27 | } 28 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollClipboard.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.scroll; 2 | 3 | import com.boydti.fawe.util.MathMan; 4 | import com.sk89q.worldedit.LocalSession; 5 | import com.sk89q.worldedit.command.tool.BrushTool; 6 | import com.sk89q.worldedit.entity.Player; 7 | import com.sk89q.worldedit.session.ClipboardHolder; 8 | import java.util.List; 9 | 10 | public class ScrollClipboard extends ScrollAction { 11 | private final List clipboards; 12 | private final LocalSession session; 13 | int index = 0; 14 | 15 | public ScrollClipboard(BrushTool tool, LocalSession session, List clipboards) { 16 | super(tool); 17 | this.clipboards = clipboards; 18 | this.session = session; 19 | } 20 | 21 | @Override 22 | public boolean increment(Player player, int amount) { 23 | index = MathMan.wrap(index + amount, 0, clipboards.size() - 1); 24 | ClipboardHolder clipboard = clipboards.get(index); 25 | session.setClipboard(clipboard); 26 | return true; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.scroll; 2 | 3 | import com.boydti.fawe.util.MathMan; 4 | import com.sk89q.worldedit.command.tool.BrushTool; 5 | import com.sk89q.worldedit.entity.Player; 6 | import com.sk89q.worldedit.function.mask.Mask; 7 | 8 | public class ScrollMask extends ScrollAction { 9 | private final Mask[] masks; 10 | private int index; 11 | 12 | public ScrollMask(BrushTool tool, Mask... masks) { 13 | super(tool); 14 | this.masks = masks; 15 | } 16 | 17 | 18 | @Override 19 | public boolean increment(Player player, int amount) { 20 | if (masks.length > 1) { 21 | getTool().setMask(masks[MathMan.wrap(index += amount, 0, masks.length - 1)]); 22 | return true; 23 | } 24 | return false; 25 | } 26 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollPattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.scroll; 2 | 3 | import com.boydti.fawe.util.MathMan; 4 | import com.sk89q.worldedit.command.tool.BrushTool; 5 | import com.sk89q.worldedit.entity.Player; 6 | import com.sk89q.worldedit.function.pattern.Pattern; 7 | 8 | public class ScrollPattern extends ScrollAction { 9 | private final Pattern[] patterns; 10 | private int index; 11 | 12 | public ScrollPattern(BrushTool tool, Pattern... patterns) { 13 | super(tool); 14 | this.patterns = patterns; 15 | } 16 | 17 | 18 | @Override 19 | public boolean increment(Player player, int amount) { 20 | if (patterns.length > 1) { 21 | getTool().setFill(patterns[MathMan.wrap(index += amount, 0, patterns.length - 1)]); 22 | return true; 23 | } 24 | return false; 25 | } 26 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollRange.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.scroll; 2 | 3 | import com.boydti.fawe.util.MathMan; 4 | import com.sk89q.worldedit.WorldEdit; 5 | import com.sk89q.worldedit.command.tool.BrushTool; 6 | import com.sk89q.worldedit.entity.Player; 7 | 8 | public class ScrollRange extends ScrollAction { 9 | public ScrollRange(BrushTool tool) { 10 | super(tool); 11 | } 12 | 13 | @Override 14 | public boolean increment(Player player, int amount) { 15 | int max = WorldEdit.getInstance().getConfiguration().maxBrushRadius; 16 | int newSize = MathMan.wrap(getTool().getRange() + amount, (int) (getTool().getSize() + 1), max); 17 | getTool().setRange(newSize); 18 | return true; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollSize.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.scroll; 2 | 3 | import com.sk89q.worldedit.WorldEdit; 4 | import com.sk89q.worldedit.command.tool.BrushTool; 5 | import com.sk89q.worldedit.entity.Player; 6 | 7 | public class ScrollSize extends ScrollAction { 8 | public ScrollSize(BrushTool tool) { 9 | super(tool); 10 | } 11 | 12 | @Override 13 | public boolean increment(Player player, int amount) { 14 | int max = WorldEdit.getInstance().getConfiguration().maxRadius; 15 | double newSize = Math.max(0, Math.min(max == -1 ? 4095 : max, getTool().getSize() + amount)); 16 | getTool().setSize(newSize); 17 | return true; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollTarget.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.scroll; 2 | 3 | import com.boydti.fawe.object.brush.TargetMode; 4 | import com.boydti.fawe.util.MathMan; 5 | import com.sk89q.worldedit.command.tool.BrushTool; 6 | import com.sk89q.worldedit.entity.Player; 7 | 8 | public class ScrollTarget extends ScrollAction { 9 | public ScrollTarget(BrushTool tool) { 10 | super(tool); 11 | } 12 | 13 | @Override 14 | public boolean increment(Player player, int amount) { 15 | TargetMode mode = getTool().getTargetMode(); 16 | int index = mode.ordinal() + amount; 17 | TargetMode[] modes = TargetMode.values(); 18 | TargetMode newMode = modes[MathMan.wrap(index, 0, modes.length - 1)]; 19 | getTool().setTargetMode(newMode); 20 | return true; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollTargetOffset.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.scroll; 2 | 3 | import com.boydti.fawe.util.MathMan; 4 | import com.sk89q.worldedit.WorldEdit; 5 | import com.sk89q.worldedit.command.tool.BrushTool; 6 | import com.sk89q.worldedit.entity.Player; 7 | 8 | public class ScrollTargetOffset extends ScrollAction { 9 | public ScrollTargetOffset(BrushTool tool) { 10 | super(tool); 11 | } 12 | 13 | @Override 14 | public boolean increment(Player player, int amount) { 15 | BrushTool tool = getTool(); 16 | tool.setTargetOffset(tool.getTargetOffset() + amount); 17 | return true; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/scroll/ScrollTool.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.scroll; 2 | 3 | import com.sk89q.worldedit.entity.Player; 4 | 5 | public interface ScrollTool { 6 | public boolean increment(Player player, int amount); 7 | } 8 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/visualization/VisualMode.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.visualization; 2 | 3 | public enum VisualMode { 4 | NONE, 5 | POINT, 6 | OUTLINE 7 | } 8 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/brush/visualization/VisualQueue.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.brush.visualization; 2 | 3 | import com.boydti.fawe.object.FawePlayer; 4 | import com.boydti.fawe.object.task.SingleThreadIntervalQueue; 5 | import com.sk89q.worldedit.LocalSession; 6 | import com.sk89q.worldedit.WorldEdit; 7 | import com.sk89q.worldedit.command.tool.BrushTool; 8 | import com.sk89q.worldedit.command.tool.Tool; 9 | import com.sk89q.worldedit.command.tool.brush.Brush; 10 | import com.sk89q.worldedit.entity.Player; 11 | 12 | public class VisualQueue extends SingleThreadIntervalQueue { 13 | 14 | public VisualQueue(int interval) { 15 | super(interval); 16 | } 17 | 18 | @Override 19 | public void operate(FawePlayer fp) { 20 | LocalSession session = fp.getSession(); 21 | Player player = fp.getPlayer(); 22 | Tool tool = session.getTool(player); 23 | Brush brush; 24 | if (tool instanceof BrushTool) { 25 | BrushTool brushTool = (BrushTool) tool; 26 | if (brushTool.getVisualMode() != VisualMode.NONE) { 27 | try { 28 | brushTool.visualize(BrushTool.BrushAction.PRIMARY, player); 29 | } catch (Throwable e) { 30 | WorldEdit.getInstance().getPlatformManager().handleThrowable(e, player); 31 | } 32 | } 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/change/MutableBiomeChange.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.change; 2 | 3 | import com.sk89q.worldedit.MutableBlockVector2D; 4 | import com.sk89q.worldedit.WorldEditException; 5 | import com.sk89q.worldedit.history.UndoContext; 6 | import com.sk89q.worldedit.history.change.Change; 7 | import com.sk89q.worldedit.world.biome.BaseBiome; 8 | 9 | public class MutableBiomeChange implements Change { 10 | 11 | private MutableBlockVector2D mutable = new MutableBlockVector2D(); 12 | private BaseBiome from; 13 | private BaseBiome to; 14 | 15 | public MutableBiomeChange() { 16 | this.from = new BaseBiome(0); 17 | this.to = new BaseBiome(0); 18 | } 19 | 20 | public void setBiome(int x, int z, int from, int to) { 21 | mutable.setComponents(x, z); 22 | this.from.setId(from); 23 | this.to.setId(to); 24 | } 25 | 26 | @Override 27 | public void undo(UndoContext context) throws WorldEditException { 28 | context.getExtent().setBiome(mutable, from); 29 | } 30 | 31 | @Override 32 | public void redo(UndoContext context) throws WorldEditException { 33 | context.getExtent().setBiome(mutable, to); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/clipboard/AbstractClipboardFormat.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.clipboard; 2 | 3 | import java.util.Arrays; 4 | import java.util.HashSet; 5 | 6 | public abstract class AbstractClipboardFormat implements IClipboardFormat { 7 | private final String name; 8 | private final HashSet aliases; 9 | 10 | public AbstractClipboardFormat(String name, String... aliases) { 11 | this.name = name; 12 | this.aliases = new HashSet<>(Arrays.asList(aliases)); 13 | } 14 | 15 | @Override 16 | public String getName() { 17 | return name; 18 | } 19 | 20 | @Override 21 | public HashSet getAliases() { 22 | return aliases; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/clipboard/URIClipboardHolder.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.clipboard; 2 | 3 | import com.sk89q.worldedit.extent.clipboard.Clipboard; 4 | import com.sk89q.worldedit.session.ClipboardHolder; 5 | import com.sk89q.worldedit.world.registry.WorldData; 6 | import java.net.URI; 7 | import java.util.Collections; 8 | import java.util.Set; 9 | 10 | 11 | import static com.google.common.base.Preconditions.checkNotNull; 12 | 13 | public class URIClipboardHolder extends ClipboardHolder { 14 | private final URI uri; 15 | 16 | public URIClipboardHolder(URI uri, Clipboard clipboard, WorldData worldData) { 17 | super(clipboard, worldData); 18 | checkNotNull(uri); 19 | this.uri = uri; 20 | } 21 | 22 | public boolean contains(URI uri) { 23 | checkNotNull(uri); 24 | return this.uri.equals(uri); 25 | } 26 | 27 | /** 28 | * @deprecated If a holder has multiple sources, this will return an empty URI 29 | * @return The original source of this clipboard (usually a file or url) 30 | */ 31 | @Deprecated 32 | public URI getUri() { 33 | return uri; 34 | } 35 | 36 | public Set getURIs() { 37 | return Collections.singleton(uri); 38 | } 39 | 40 | public URI getURI(Clipboard clipboard) { 41 | return getClipboard() == clipboard ? getUri() : null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/clipboard/WorldCutClipboard.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.clipboard; 2 | 3 | import com.sk89q.worldedit.EditSession; 4 | import com.sk89q.worldedit.blocks.BaseBlock; 5 | import com.sk89q.worldedit.regions.Region; 6 | 7 | public class WorldCutClipboard extends WorldCopyClipboard { 8 | public WorldCutClipboard(EditSession editSession, Region region, boolean copyEntities, boolean copyBiome) { 9 | super(editSession, region, copyEntities, copyBiome); 10 | } 11 | 12 | public WorldCutClipboard(EditSession editSession, Region region) { 13 | super(editSession, region); 14 | } 15 | 16 | @Override 17 | public BaseBlock getBlock(int x, int y, int z) { 18 | int xx = mx + x; 19 | int yy = my + y; 20 | int zz = mz + z; 21 | BaseBlock block = editSession.getLazyBlock(xx, yy, zz); 22 | editSession.setBlock(xx, yy, zz, EditSession.nullBlock); 23 | return block; 24 | } 25 | 26 | public BaseBlock getBlockAbs(int x, int y, int z) { 27 | BaseBlock block = editSession.getLazyBlock(x, y, z); 28 | editSession.setBlock(x, y, z, EditSession.nullBlock); 29 | return block; 30 | } 31 | 32 | @Override 33 | public void forEach(BlockReader task, boolean air) { 34 | super.forEach(task, air); 35 | editSession.flushQueue(); 36 | } 37 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/collection/ByteStore.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.collection; 2 | 3 | public class ByteStore extends IterableThreadLocal { 4 | private final int size; 5 | 6 | public ByteStore(int size) { 7 | this.size = size; 8 | } 9 | 10 | @Override 11 | public byte[] init() { 12 | return new byte[size]; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/collection/DifferentialCollection.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.collection; 2 | 3 | import com.boydti.fawe.object.change.StreamChange; 4 | 5 | public interface DifferentialCollection extends StreamChange { 6 | public T get(); 7 | } 8 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/collection/RandomCollection.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.collection; 2 | 3 | import com.boydti.fawe.object.random.SimpleRandom; 4 | import java.util.Map; 5 | 6 | 7 | import static com.google.common.base.Preconditions.checkNotNull; 8 | 9 | public abstract class RandomCollection { 10 | protected SimpleRandom random; 11 | 12 | public RandomCollection(Map weights, SimpleRandom random) { 13 | this.random = random; 14 | } 15 | 16 | public static RandomCollection of(Map weights, SimpleRandom random) { 17 | try { 18 | return new FastRandomCollection<>(weights, random); 19 | } catch (IllegalArgumentException ignore) { 20 | return new SimpleRandomCollection<>(weights, random); 21 | } 22 | } 23 | 24 | public void setRandom(SimpleRandom random) { 25 | checkNotNull(random); 26 | this.random = random; 27 | } 28 | 29 | public SimpleRandom getRandom() { 30 | return random; 31 | } 32 | 33 | public abstract T next(int x, int y, int z); 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/collection/SimpleRandomCollection.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.collection; 2 | 3 | import com.boydti.fawe.object.random.SimpleRandom; 4 | import java.util.Map; 5 | import java.util.NavigableMap; 6 | import java.util.TreeMap; 7 | 8 | public class SimpleRandomCollection extends RandomCollection { 9 | 10 | private final NavigableMap map = new TreeMap(); 11 | private double total = 0; 12 | 13 | public SimpleRandomCollection(Map weights, SimpleRandom random) { 14 | super(weights, random); 15 | for (Map.Entry entry : weights.entrySet()) { 16 | add(entry.getValue(), entry.getKey()); 17 | } 18 | } 19 | 20 | public void add(double weight, E result) { 21 | if (weight <= 0) return; 22 | total += weight; 23 | map.put(total, result); 24 | } 25 | 26 | public E next(int x, int y, int z) { 27 | return map.ceilingEntry(random.nextDouble(x, y, z)).getValue(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/collection/SparseBlockSet.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.collection; 2 | 3 | import java.io.Serializable; 4 | 5 | public class SparseBlockSet implements Serializable { 6 | private SparseBitSet[] sets; 7 | 8 | public SparseBlockSet(int depth) { 9 | sets = new SparseBitSet[depth]; 10 | for (int i = 0; i < sets.length; i++) { 11 | sets[i] = new SparseBitSet(); 12 | } 13 | } 14 | 15 | public void setBlock(int index, int id) { 16 | for (int i = 0; i < sets.length; i++) { 17 | SparseBitSet set = sets[i]; 18 | if (((id >> i) & 1) == 1) { 19 | set.set(index); 20 | } else { 21 | set.clear(index); 22 | } 23 | } 24 | } 25 | 26 | public int getBlock(int index) { 27 | int id = 0; 28 | for (int i = 0; i < sets.length; i++) { 29 | SparseBitSet set = sets[i]; 30 | if (set.get(index)) { 31 | id += 1 << i; 32 | } 33 | } 34 | return id; 35 | } 36 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/extent/HeightBoundExtent.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.extent; 2 | 3 | import com.boydti.fawe.object.FaweLimit; 4 | import com.boydti.fawe.object.RegionWrapper; 5 | import com.sk89q.worldedit.extent.Extent; 6 | import com.sk89q.worldedit.regions.Region; 7 | import java.util.Arrays; 8 | import java.util.Collection; 9 | 10 | public class HeightBoundExtent extends FaweRegionExtent { 11 | 12 | private final int min, max; 13 | private int lastY = -1; 14 | private boolean lastResult; 15 | 16 | public HeightBoundExtent(Extent extent, FaweLimit limit, int min, int max) { 17 | super(extent, limit); 18 | this.min = min; 19 | this.max = max; 20 | } 21 | 22 | @Override 23 | public boolean contains(int x, int z) { 24 | return true; 25 | } 26 | 27 | @Override 28 | public boolean contains(int x, int y, int z) { 29 | if (y == lastY) { 30 | return lastResult; 31 | } 32 | lastY = y; 33 | return lastResult = (y >= min && y <= max); 34 | } 35 | 36 | @Override 37 | public Collection getRegions() { 38 | return Arrays.asList(new RegionWrapper(Integer.MIN_VALUE, Integer.MAX_VALUE, min, max, Integer.MIN_VALUE, Integer.MAX_VALUE)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/extent/LightingExtent.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.extent; 2 | 3 | import com.sk89q.worldedit.extent.Extent; 4 | 5 | public interface LightingExtent extends Extent { 6 | int getLight(int x, int y, int z); 7 | 8 | int getSkyLight(int x, int y, int z); 9 | 10 | int getBlockLight(int x, int y, int z); 11 | 12 | int getOpacity(int x, int y, int z); 13 | 14 | int getBrightness(int x, int y, int z); 15 | } 16 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/extent/Linear3DTransform.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.extent; 2 | 3 | import com.sk89q.worldedit.extent.AbstractDelegateExtent; 4 | import com.sk89q.worldedit.extent.Extent; 5 | 6 | public class Linear3DTransform extends SelectTransform { 7 | 8 | private final ResettableExtent[] extentsArray; 9 | 10 | public Linear3DTransform(ResettableExtent[] extents) { 11 | this.extentsArray = extents; 12 | } 13 | 14 | @Override 15 | public ResettableExtent setExtent(Extent extent) { 16 | for (ResettableExtent cur : extentsArray) { 17 | cur.setExtent(extent); 18 | } 19 | return this; 20 | } 21 | 22 | @Override 23 | public AbstractDelegateExtent getExtent(int x, int y, int z) { 24 | int index = (x + y + z) % extentsArray.length; 25 | if (index < 0) { 26 | index += extentsArray.length; 27 | } 28 | return extentsArray[index]; 29 | } 30 | 31 | @Override 32 | public AbstractDelegateExtent getExtent(int x, int z) { 33 | return getExtent(x, 0, z); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/extent/LinearTransform.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.extent; 2 | 3 | import com.sk89q.worldedit.extent.AbstractDelegateExtent; 4 | import com.sk89q.worldedit.extent.Extent; 5 | 6 | public class LinearTransform extends SelectTransform { 7 | 8 | private final ResettableExtent[] extentsArray; 9 | private int index; 10 | 11 | public LinearTransform(ResettableExtent[] extents) { 12 | this.extentsArray = extents; 13 | } 14 | 15 | @Override 16 | public ResettableExtent setExtent(Extent extent) { 17 | for (ResettableExtent cur : extentsArray) { 18 | cur.setExtent(extent); 19 | } 20 | return this; 21 | } 22 | 23 | @Override 24 | public AbstractDelegateExtent getExtent(int x, int y, int z) { 25 | if (index == extentsArray.length) { 26 | index = 0; 27 | } 28 | return extentsArray[index]; 29 | } 30 | 31 | @Override 32 | public AbstractDelegateExtent getExtent(int x, int z) { 33 | return getExtent(x, 0, z); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/extent/PatternTransform.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.extent; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.WorldEditException; 5 | import com.sk89q.worldedit.blocks.BaseBlock; 6 | import com.sk89q.worldedit.extent.Extent; 7 | import com.sk89q.worldedit.function.pattern.Pattern; 8 | 9 | public class PatternTransform extends ResettableExtent { 10 | private final Pattern pattern; 11 | 12 | public PatternTransform(Extent parent, Pattern pattern) { 13 | super(parent); 14 | this.pattern = pattern; 15 | } 16 | 17 | @Override 18 | public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { 19 | return pattern.apply(getExtent(), location, location); 20 | } 21 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/extent/SingleRegionExtent.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.extent; 2 | 3 | import com.boydti.fawe.object.FaweLimit; 4 | import com.sk89q.worldedit.extent.Extent; 5 | import com.sk89q.worldedit.regions.Region; 6 | import java.util.Arrays; 7 | import java.util.Collection; 8 | 9 | public class SingleRegionExtent extends FaweRegionExtent { 10 | 11 | private final Region region; 12 | 13 | /** 14 | * Create a new instance. 15 | * 16 | * @param extent the extent 17 | */ 18 | public SingleRegionExtent(Extent extent, FaweLimit limit, Region region) { 19 | super(extent, limit); 20 | this.region = region; 21 | } 22 | 23 | @Override 24 | public boolean contains(int x, int y, int z) { 25 | return region.contains(x, y, z); 26 | } 27 | 28 | @Override 29 | public boolean contains(int x, int z) { 30 | return region.contains(x, z); 31 | } 32 | 33 | @Override 34 | public Collection getRegions() { 35 | return Arrays.asList(region); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/extent/SlowExtent.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.extent; 2 | 3 | import com.boydti.fawe.Fawe; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.WorldEditException; 6 | import com.sk89q.worldedit.blocks.BaseBlock; 7 | import com.sk89q.worldedit.extent.AbstractDelegateExtent; 8 | import com.sk89q.worldedit.extent.Extent; 9 | 10 | public class SlowExtent extends AbstractDelegateExtent { 11 | private final long sleep; 12 | 13 | public SlowExtent(Extent extent, long sleep) { 14 | super(extent); 15 | this.sleep = sleep; 16 | } 17 | 18 | @Override 19 | public boolean setBlock(Vector location, BaseBlock block) throws WorldEditException { 20 | if (!Fawe.isMainThread()) try { 21 | Thread.sleep(sleep); 22 | } catch (InterruptedException e) { 23 | e.printStackTrace(); 24 | } 25 | return super.setBlock(location, block); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/function/NullRegionFunction.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.function; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.WorldEditException; 5 | import com.sk89q.worldedit.function.RegionFunction; 6 | 7 | public class NullRegionFunction implements RegionFunction { 8 | @Override 9 | public boolean apply(Vector position) throws WorldEditException { 10 | return false; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/function/SurfaceRegionFunction.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.function; 2 | 3 | import com.sk89q.worldedit.MutableBlockVector; 4 | import com.sk89q.worldedit.Vector2D; 5 | import com.sk89q.worldedit.WorldEditException; 6 | import com.sk89q.worldedit.extent.Extent; 7 | import com.sk89q.worldedit.function.FlatRegionFunction; 8 | import com.sk89q.worldedit.function.RegionFunction; 9 | 10 | public class SurfaceRegionFunction implements FlatRegionFunction { 11 | private final Extent extent; 12 | private final RegionFunction function; 13 | private final int minY; 14 | private final int maxY; 15 | private int lastY; 16 | private MutableBlockVector mutable = new MutableBlockVector(); 17 | 18 | public SurfaceRegionFunction(Extent extent, RegionFunction function, int minY, int maxY) { 19 | this.extent = extent; 20 | this.minY = minY; 21 | this.maxY = maxY; 22 | this.lastY = maxY; 23 | this.function = function; 24 | } 25 | 26 | @Override 27 | public boolean apply(Vector2D position) throws WorldEditException { 28 | int x = position.getBlockX(); 29 | int z = position.getBlockZ(); 30 | int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY, false); 31 | if (layer != -1) { 32 | lastY = layer; 33 | return function.apply(mutable.setComponents(x, layer, z)); 34 | } 35 | return false; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/function/block/BiomeCopy.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.function.block; 2 | 3 | import com.sk89q.worldedit.MutableBlockVector2D; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.WorldEditException; 6 | import com.sk89q.worldedit.extent.Extent; 7 | import com.sk89q.worldedit.function.RegionFunction; 8 | 9 | public class BiomeCopy implements RegionFunction { 10 | protected final Extent source; 11 | protected final Extent destination; 12 | private final MutableBlockVector2D mPos2d; 13 | 14 | public BiomeCopy(Extent source, Extent destination) { 15 | this.source = source; 16 | this.destination = destination; 17 | this.mPos2d = new MutableBlockVector2D(); 18 | this.mPos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE); 19 | } 20 | 21 | @Override 22 | public boolean apply(Vector position) throws WorldEditException { 23 | int x = position.getBlockX(); 24 | int z = position.getBlockZ(); 25 | if (x != mPos2d.getBlockX() || z != mPos2d.getBlockZ()) { 26 | mPos2d.setComponents(x, z); 27 | return destination.setBiome(mPos2d, source.getBiome(mPos2d)); 28 | } 29 | return false; 30 | } 31 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/function/block/CombinedBlockCopy.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.function.block; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.WorldEditException; 5 | import com.sk89q.worldedit.blocks.BaseBlock; 6 | import com.sk89q.worldedit.extent.Extent; 7 | import com.sk89q.worldedit.function.RegionFunction; 8 | 9 | public class CombinedBlockCopy implements RegionFunction { 10 | 11 | protected final Extent source; 12 | protected final Extent destination; 13 | private final RegionFunction function; 14 | 15 | public CombinedBlockCopy(Extent source, Extent destination, RegionFunction combined) { 16 | this.source = source; 17 | this.destination = destination; 18 | this.function = combined; 19 | } 20 | 21 | @Override 22 | public boolean apply(Vector position) throws WorldEditException { 23 | BaseBlock block = source.getBlock(position); 24 | function.apply(position); 25 | return destination.setBlock(position, block); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/function/block/SimpleBlockCopy.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.function.block; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.WorldEditException; 5 | import com.sk89q.worldedit.extent.Extent; 6 | import com.sk89q.worldedit.function.RegionFunction; 7 | 8 | public class SimpleBlockCopy implements RegionFunction { 9 | 10 | protected final Extent source; 11 | protected final Extent destination; 12 | 13 | public SimpleBlockCopy(Extent source, Extent destination) { 14 | this.source = source; 15 | this.destination = destination; 16 | } 17 | 18 | @Override 19 | public boolean apply(Vector position) throws WorldEditException { 20 | return destination.setBlock(position, source.getBlock(position)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/function/mask/AbstractDelegateMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.function.mask; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.function.mask.AbstractMask; 5 | import com.sk89q.worldedit.function.mask.Mask; 6 | import com.sk89q.worldedit.function.mask.Mask2D; 7 | import javax.annotation.Nullable; 8 | 9 | public class AbstractDelegateMask extends AbstractMask { 10 | 11 | private final Mask mask; 12 | 13 | public AbstractDelegateMask(Mask parent) { 14 | this.mask = parent; 15 | } 16 | 17 | public final Mask getMask() { 18 | return mask; 19 | } 20 | 21 | @Override 22 | public boolean test(Vector vector) { 23 | return mask.test(vector); 24 | } 25 | 26 | @Nullable 27 | @Override 28 | public Mask2D toMask2D() { 29 | return mask.toMask2D(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/io/AbstractDelegateOutputStream.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.io; 2 | 3 | import java.io.IOException; 4 | import java.io.OutputStream; 5 | 6 | public class AbstractDelegateOutputStream extends OutputStream { 7 | private final OutputStream parent; 8 | 9 | @Override 10 | public void write(int b) throws IOException { 11 | parent.write(b); 12 | } 13 | 14 | @Override 15 | public void write(byte[] b) throws IOException { 16 | parent.write(b); 17 | } 18 | 19 | @Override 20 | public void write(byte[] b, int off, int len) throws IOException { 21 | parent.write(b, off, len); 22 | } 23 | 24 | @Override 25 | public void flush() throws IOException { 26 | parent.flush(); 27 | } 28 | 29 | @Override 30 | public void close() throws IOException { 31 | parent.close(); 32 | } 33 | 34 | public AbstractDelegateOutputStream(OutputStream os) { 35 | this.parent = os; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/io/NonClosableOutputStream.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.io; 2 | 3 | import java.io.IOException; 4 | import java.io.OutputStream; 5 | 6 | public class NonClosableOutputStream extends AbstractDelegateOutputStream { 7 | 8 | public NonClosableOutputStream(OutputStream os) { 9 | super(os); 10 | } 11 | 12 | @Override 13 | public void close() throws IOException { 14 | // Do nothing 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/io/NonCloseableInputStream.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.io; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | 6 | public class NonCloseableInputStream extends InputStream { 7 | 8 | private final InputStream parent; 9 | 10 | public NonCloseableInputStream(InputStream parent) { 11 | this.parent = parent; 12 | } 13 | @Override 14 | public int read() throws IOException { 15 | return parent.read(); 16 | } 17 | 18 | @Override 19 | public int read(byte[] b) throws IOException { 20 | return parent.read(b); 21 | } 22 | 23 | @Override 24 | public int read(byte[] b, int off, int len) throws IOException { 25 | return parent.read(b, off, len); 26 | } 27 | 28 | @Override 29 | public long skip(long n) throws IOException { 30 | return parent.skip(n); 31 | } 32 | 33 | @Override 34 | public int available() throws IOException { 35 | return parent.available(); 36 | } 37 | 38 | @Override 39 | public void close() throws IOException { 40 | } 41 | 42 | @Override 43 | public void mark(int readlimit) { 44 | parent.mark(readlimit); 45 | } 46 | 47 | @Override 48 | public void reset() throws IOException { 49 | parent.reset(); 50 | } 51 | 52 | @Override 53 | public boolean markSupported() { 54 | return parent.markSupported(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/io/PGZIPState.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.io; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.util.zip.Deflater; 5 | import java.util.zip.DeflaterOutputStream; 6 | 7 | public class PGZIPState { 8 | protected final DeflaterOutputStream str; 9 | protected final ByteArrayOutputStream buf; 10 | protected final Deflater def; 11 | 12 | public PGZIPState(PGZIPOutputStream parent) { 13 | this.def = parent.newDeflater(); 14 | this.buf = new ByteArrayOutputStream(PGZIPBlock.SIZE); 15 | this.str = parent.newDeflaterOutputStream(buf, def); 16 | } 17 | 18 | 19 | } 20 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/io/PGZIPThreadLocal.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.io; 2 | 3 | public class PGZIPThreadLocal extends ThreadLocal { 4 | 5 | private final PGZIPOutputStream parent; 6 | 7 | public PGZIPThreadLocal(PGZIPOutputStream parent) { 8 | this.parent = parent; 9 | } 10 | 11 | @Override 12 | protected PGZIPState initialValue() { 13 | return new PGZIPState(parent); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/io/RandomAccessInputStream.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.io; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.RandomAccessFile; 6 | 7 | public class RandomAccessInputStream extends InputStream { 8 | private final RandomAccessFile raf; 9 | 10 | public RandomAccessInputStream(RandomAccessFile raf) { 11 | this.raf = raf; 12 | } 13 | 14 | @Override 15 | public int read() throws IOException { 16 | return raf.read(); 17 | } 18 | 19 | @Override 20 | public int read(byte[] b, int off, int len) throws IOException { 21 | return raf.read(b, off, len); 22 | } 23 | 24 | @Override 25 | public int read(byte[] b) throws IOException { 26 | return raf.read(b); 27 | } 28 | 29 | @Override 30 | public int available() throws IOException { 31 | return (int) (raf.length() - raf.getFilePointer()); 32 | } 33 | 34 | @Override 35 | public void close() throws IOException { 36 | raf.close(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/io/ResettableFileInputStream.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.io; 2 | 3 | import java.io.FileInputStream; 4 | import java.io.FilterInputStream; 5 | import java.io.IOException; 6 | import java.nio.channels.FileChannel; 7 | 8 | public class ResettableFileInputStream extends FilterInputStream { 9 | private FileChannel myFileChannel; 10 | private long mark = 0; 11 | 12 | public ResettableFileInputStream(FileInputStream fis) { 13 | super(fis); 14 | myFileChannel = fis.getChannel(); 15 | } 16 | 17 | @Override 18 | public boolean markSupported() { 19 | return true; 20 | } 21 | 22 | @Override 23 | public synchronized void mark(int readlimit) { 24 | try { 25 | mark = myFileChannel.position(); 26 | } catch (IOException ex) { 27 | ex.printStackTrace(); 28 | mark = -1; 29 | } 30 | } 31 | 32 | @Override 33 | public synchronized void reset() throws IOException { 34 | if (mark == -1) { 35 | throw new IOException("not marked"); 36 | } 37 | myFileChannel.position(mark); 38 | } 39 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/io/serialize/Serialize.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.io.serialize; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | @Target({ElementType.FIELD}) 10 | public @interface Serialize { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/io/zstd/FrameHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.boydti.fawe.object.io.zstd; 15 | 16 | class FrameHeader 17 | { 18 | final long headerSize; 19 | final int windowSize; 20 | final long contentSize; 21 | final long dictionaryId; 22 | final boolean hasChecksum; 23 | 24 | public FrameHeader(long headerSize, int windowSize, long contentSize, long dictionaryId, boolean hasChecksum) 25 | { 26 | this.headerSize = headerSize; 27 | this.windowSize = windowSize; 28 | this.contentSize = contentSize; 29 | this.dictionaryId = dictionaryId; 30 | this.hasChecksum = hasChecksum; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/io/zstd/MalformedInputException.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.io.zstd; 2 | 3 | public class MalformedInputException 4 | extends RuntimeException 5 | { 6 | private final long offset; 7 | 8 | public MalformedInputException(long offset) 9 | { 10 | this(offset, "Malformed input"); 11 | } 12 | 13 | public MalformedInputException(long offset, String reason) 14 | { 15 | super(reason + ": offset=" + offset); 16 | this.offset = offset; 17 | } 18 | 19 | public long getOffset() 20 | { 21 | return offset; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/BiomeMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.sk89q.worldedit.MutableBlockVector2D; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.Vector2D; 6 | import com.sk89q.worldedit.extent.Extent; 7 | import com.sk89q.worldedit.function.mask.AbstractExtentMask; 8 | import com.sk89q.worldedit.world.biome.BaseBiome; 9 | 10 | public class BiomeMask extends AbstractExtentMask implements ResettableMask { 11 | private final BaseBiome biome; 12 | private transient MutableBlockVector2D mutable = new MutableBlockVector2D(); 13 | 14 | public BiomeMask(Extent extent, BaseBiome biome) { 15 | super(extent); 16 | this.biome = biome; 17 | } 18 | 19 | @Override 20 | public void reset() { 21 | mutable = new MutableBlockVector2D(); 22 | } 23 | 24 | @Override 25 | public boolean test(Vector vector) { 26 | Vector2D pos = mutable.setComponents(vector.getBlockX(), vector.getBlockZ()); 27 | return getExtent().getBiome(pos).getId() == biome.getId(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/BlockLightMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.boydti.fawe.object.extent.LightingExtent; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.extent.Extent; 6 | import com.sk89q.worldedit.function.mask.AbstractExtentMask; 7 | import com.sk89q.worldedit.function.mask.Mask2D; 8 | import javax.annotation.Nullable; 9 | 10 | public class BlockLightMask extends AbstractExtentMask { 11 | 12 | private final int min, max; 13 | 14 | public BlockLightMask(Extent extent, int min, int max) { 15 | super(extent); 16 | this.min = min; 17 | this.max = max; 18 | } 19 | 20 | @Override 21 | public boolean test(Vector vector) { 22 | Extent extent = getExtent(); 23 | if (extent instanceof LightingExtent) { 24 | int light = ((LightingExtent) extent).getBlockLight(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); 25 | return light >= min && light <= max; 26 | } 27 | return false; 28 | } 29 | 30 | @Nullable 31 | @Override 32 | public Mask2D toMask2D() { 33 | return null; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/BrightnessMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.boydti.fawe.object.extent.LightingExtent; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.extent.Extent; 6 | import com.sk89q.worldedit.function.mask.AbstractExtentMask; 7 | import com.sk89q.worldedit.function.mask.Mask2D; 8 | import javax.annotation.Nullable; 9 | 10 | public class BrightnessMask extends AbstractExtentMask { 11 | 12 | private final int min, max; 13 | 14 | public BrightnessMask(Extent extent, int min, int max) { 15 | super(extent); 16 | this.min = min; 17 | this.max = max; 18 | } 19 | 20 | @Override 21 | public boolean test(Vector vector) { 22 | Extent extent = getExtent(); 23 | if (extent instanceof LightingExtent) { 24 | int light = ((LightingExtent) extent).getBrightness(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); 25 | return light >= min && light <= max; 26 | } 27 | return false; 28 | } 29 | 30 | @Nullable 31 | @Override 32 | public Mask2D toMask2D() { 33 | return null; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/DataMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.extent.Extent; 5 | import com.sk89q.worldedit.function.mask.AbstractExtentMask; 6 | import com.sk89q.worldedit.function.mask.Mask2D; 7 | import javax.annotation.Nullable; 8 | 9 | public class DataMask extends AbstractExtentMask implements ResettableMask { 10 | 11 | public DataMask(Extent extent) { 12 | super(extent); 13 | } 14 | 15 | private transient int data = -1; 16 | 17 | @Override 18 | public boolean test(Vector vector) { 19 | Extent extent = getExtent(); 20 | if (data != -1) { 21 | return extent.getLazyBlock(vector).getData() == data; 22 | } else { 23 | data = extent.getLazyBlock(vector).getData(); 24 | return true; 25 | } 26 | } 27 | 28 | @Override 29 | public void reset() { 30 | this.data = -1; 31 | } 32 | 33 | @Nullable 34 | @Override 35 | public Mask2D toMask2D() { 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/IdDataMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.boydti.fawe.FaweCache; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.extent.Extent; 6 | import com.sk89q.worldedit.function.mask.AbstractExtentMask; 7 | import com.sk89q.worldedit.function.mask.Mask2D; 8 | import javax.annotation.Nullable; 9 | 10 | public class IdDataMask extends AbstractExtentMask implements ResettableMask { 11 | private transient int combined = -1; 12 | 13 | public IdDataMask(Extent extent) { 14 | super(extent); 15 | } 16 | 17 | @Override 18 | public boolean test(Vector vector) { 19 | Extent extent = getExtent(); 20 | if (combined != -1) { 21 | return FaweCache.getCombined(extent.getLazyBlock(vector)) == combined; 22 | } else { 23 | combined = FaweCache.getCombined(extent.getLazyBlock(vector)); 24 | return true; 25 | } 26 | } 27 | 28 | @Override 29 | public void reset() { 30 | this.combined = -1; 31 | } 32 | 33 | @Nullable 34 | @Override 35 | public Mask2D toMask2D() { 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/IdMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.extent.Extent; 5 | import com.sk89q.worldedit.function.mask.AbstractExtentMask; 6 | import com.sk89q.worldedit.function.mask.Mask2D; 7 | import javax.annotation.Nullable; 8 | 9 | public class IdMask extends AbstractExtentMask implements ResettableMask { 10 | 11 | private transient int id = -1; 12 | 13 | public IdMask(Extent extent) { 14 | super(extent); 15 | } 16 | 17 | @Override 18 | public boolean test(Vector vector) { 19 | Extent extent = getExtent(); 20 | if (id != -1) { 21 | return extent.getLazyBlock(vector).getId() == id; 22 | } else { 23 | id = extent.getLazyBlock(vector).getId(); 24 | return true; 25 | } 26 | } 27 | 28 | @Override 29 | public void reset() { 30 | this.id = -1; 31 | } 32 | 33 | @Nullable 34 | @Override 35 | public Mask2D toMask2D() { 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/LightMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.boydti.fawe.object.extent.LightingExtent; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.extent.Extent; 6 | import com.sk89q.worldedit.function.mask.AbstractExtentMask; 7 | import com.sk89q.worldedit.function.mask.Mask2D; 8 | import javax.annotation.Nullable; 9 | 10 | public class LightMask extends AbstractExtentMask { 11 | 12 | private final int min, max; 13 | 14 | public LightMask(Extent extent, int min, int max) { 15 | super(extent); 16 | this.min = min; 17 | this.max = max; 18 | } 19 | 20 | @Override 21 | public boolean test(Vector vector) { 22 | if (getExtent() instanceof LightingExtent) { 23 | int light = ((LightingExtent) getExtent()).getLight(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); 24 | return light >= min && light <= max; 25 | } 26 | return false; 27 | } 28 | 29 | @Nullable 30 | @Override 31 | public Mask2D toMask2D() { 32 | return null; 33 | } 34 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/OpacityMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.boydti.fawe.object.extent.LightingExtent; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.extent.Extent; 6 | import com.sk89q.worldedit.function.mask.AbstractExtentMask; 7 | import com.sk89q.worldedit.function.mask.Mask2D; 8 | import javax.annotation.Nullable; 9 | 10 | public class OpacityMask extends AbstractExtentMask { 11 | 12 | private final int min, max; 13 | 14 | public OpacityMask(Extent extent, int min, int max) { 15 | super(extent); 16 | this.min = min; 17 | this.max = max; 18 | } 19 | 20 | @Override 21 | public boolean test(Vector vector) { 22 | if (getExtent() instanceof LightingExtent) { 23 | int light = ((LightingExtent) getExtent()).getOpacity(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); 24 | return light >= min && light <= max; 25 | } 26 | return false; 27 | } 28 | 29 | @Nullable 30 | @Override 31 | public Mask2D toMask2D() { 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/ROCAngleMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.sk89q.worldedit.extent.Extent; 4 | 5 | public class ROCAngleMask extends AngleMask { 6 | 7 | public ROCAngleMask(Extent extent, double min, double max, boolean overlay, int distance) { 8 | super(extent, min, max, overlay, distance); 9 | } 10 | 11 | @Override 12 | protected boolean testSlope(int x, int y, int z) { 13 | double slope, tmp; 14 | boolean aboveMin; 15 | lastY = y; 16 | 17 | int base = getHeight(x, y, z); 18 | slope = ((getHeight(x + distance, y, z) - base) - (base - getHeight(x - distance, y, z))) * ADJACENT_MOD; 19 | 20 | tmp = ((getHeight(x, y, z + distance) - base) - (base - getHeight(x, y, z - distance))) * ADJACENT_MOD; 21 | if (Math.abs(tmp) > Math.abs(slope)) slope = tmp; 22 | 23 | tmp = ((getHeight(x + distance, y, z + distance) - base) - (base - getHeight(x - distance, y, z - distance))) * DIAGONAL_MOD; 24 | if (Math.abs(tmp) > Math.abs(slope)) slope = tmp; 25 | 26 | tmp = ((getHeight(x - distance, y, z + distance) - base) - (base - getHeight(x + distance, y, z - distance))) * DIAGONAL_MOD; 27 | if (Math.abs(tmp) > Math.abs(slope)) slope = tmp; 28 | 29 | return lastValue = (slope >= min && slope <= max); 30 | } 31 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/RandomMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.function.mask.AbstractMask; 5 | import java.util.SplittableRandom; 6 | 7 | public class RandomMask extends AbstractMask implements ResettableMask { 8 | private transient SplittableRandom random; 9 | private final double threshold; 10 | 11 | public RandomMask(double threshold) { 12 | this.random = new SplittableRandom(); 13 | this.threshold = (threshold - 0.5) * Integer.MAX_VALUE; 14 | } 15 | 16 | @Override 17 | public boolean test(Vector vector) { 18 | return random.nextInt() <= threshold; 19 | } 20 | 21 | @Override 22 | public void reset() { 23 | random = new SplittableRandom(); 24 | } 25 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/ResettableMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | public interface ResettableMask { 4 | void reset(); 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/SimplexMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.boydti.fawe.object.random.SimplexNoise; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.function.mask.AbstractMask; 6 | 7 | public class SimplexMask extends AbstractMask { 8 | private final double min, max, scale; 9 | 10 | public SimplexMask(double scale, double min, double max) { 11 | this.scale = scale; 12 | this.min = min; 13 | this.max = max; 14 | } 15 | 16 | @Override 17 | public boolean test(Vector vector) { 18 | double value = SimplexNoise.noise(vector.getBlockX() * scale, vector.getBlockY() * scale, vector.getBlockZ() * scale); 19 | return value >= min && value <= max; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/SkyLightMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.boydti.fawe.object.extent.LightingExtent; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.extent.Extent; 6 | import com.sk89q.worldedit.function.mask.AbstractExtentMask; 7 | import com.sk89q.worldedit.function.mask.Mask2D; 8 | import javax.annotation.Nullable; 9 | 10 | public class SkyLightMask extends AbstractExtentMask { 11 | 12 | private final int min, max; 13 | 14 | public SkyLightMask(Extent extent, int min, int max) { 15 | super(extent); 16 | this.min = min; 17 | this.max = max; 18 | } 19 | 20 | @Override 21 | public boolean test(Vector vector) { 22 | if (getExtent() instanceof LightingExtent) { 23 | int light = ((LightingExtent) getExtent()).getSkyLight(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); 24 | return light >= min && light <= max; 25 | } 26 | return false; 27 | } 28 | 29 | @Nullable 30 | @Override 31 | public Mask2D toMask2D() { 32 | return null; 33 | } 34 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/SurfaceMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.boydti.fawe.FaweCache; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.blocks.BaseBlock; 6 | import com.sk89q.worldedit.extent.Extent; 7 | import com.sk89q.worldedit.function.mask.BlockMask; 8 | 9 | public class SurfaceMask extends AdjacentAnyMask { 10 | private final transient Extent extent; 11 | 12 | public SurfaceMask(Extent extent) { 13 | super(new BlockMask(extent, new BaseBlock(0))); 14 | BlockMask mask = (BlockMask) getParentMask().getMask(); 15 | for (int id = 0; id < 256; id++) { 16 | if (FaweCache.canPassThrough(id, 0)) { 17 | mask.add(new BaseBlock(id, -1)); 18 | } 19 | } 20 | this.extent = extent; 21 | } 22 | 23 | @Override 24 | public boolean test(Vector v) { 25 | return !getParentMask().test(v.getBlockX(), v.getBlockY(), v.getBlockZ()) && super.test(v); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/WallMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.function.mask.AbstractMask; 5 | import com.sk89q.worldedit.function.mask.Mask; 6 | 7 | public class WallMask extends AbstractMask { 8 | private final int min, max; 9 | private final Mask mask; 10 | 11 | public WallMask(Mask mask, int requiredMin, int requiredMax) { 12 | this.mask = mask; 13 | this.min = requiredMin; 14 | this.max = requiredMax; 15 | } 16 | 17 | @Override 18 | public boolean test(Vector v) { 19 | int count = 0; 20 | double x = v.getX(); 21 | double y = v.getY(); 22 | double z = v.getZ(); 23 | v.mutX(x + 1); 24 | if (mask.test(v) && ++count == min && max >= 8) { 25 | v.mutX(x); 26 | return true; 27 | } 28 | v.mutX(x - 1); 29 | if (mask.test(v) && ++count == min && max >= 8) { 30 | v.mutX(x); 31 | return true; 32 | } 33 | v.mutX(x); 34 | v.mutZ(z + 1); 35 | if (mask.test(v) && ++count == min && max >= 8) { 36 | v.mutZ(z); 37 | return true; 38 | } 39 | v.mutZ(z - 1); 40 | if (mask.test(v) && ++count == min && max >= 8) { 41 | v.mutZ(z); 42 | return true; 43 | } 44 | v.mutZ(z); 45 | return count >= min && count <= max; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/XAxisMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.function.mask.AbstractMask; 5 | import com.sk89q.worldedit.function.mask.Mask2D; 6 | import javax.annotation.Nullable; 7 | 8 | /** 9 | * Restricts the 10 | */ 11 | public class XAxisMask extends AbstractMask implements ResettableMask { 12 | 13 | private transient int layer = -1; 14 | 15 | @Override 16 | public boolean test(Vector vector) { 17 | if (layer == -1) { 18 | layer = vector.getBlockX(); 19 | } 20 | return vector.getBlockX() == layer; 21 | } 22 | 23 | @Override 24 | public void reset() { 25 | this.layer = -1; 26 | } 27 | 28 | @Nullable 29 | @Override 30 | public Mask2D toMask2D() { 31 | return null; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/YAxisMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.function.mask.AbstractMask; 5 | import com.sk89q.worldedit.function.mask.Mask2D; 6 | import javax.annotation.Nullable; 7 | 8 | /** 9 | * Restricts the 10 | */ 11 | public class YAxisMask extends AbstractMask implements ResettableMask { 12 | 13 | private transient int layer = -1; 14 | 15 | @Override 16 | public boolean test(Vector vector) { 17 | if (layer == -1) { 18 | layer = vector.getBlockY(); 19 | } 20 | return vector.getBlockY() == layer; 21 | } 22 | 23 | @Override 24 | public void reset() { 25 | this.layer = -1; 26 | } 27 | 28 | @Nullable 29 | @Override 30 | public Mask2D toMask2D() { 31 | return null; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/mask/ZAxisMask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.mask; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.function.mask.AbstractMask; 5 | import com.sk89q.worldedit.function.mask.Mask2D; 6 | import javax.annotation.Nullable; 7 | 8 | /** 9 | * Restricts the 10 | */ 11 | public class ZAxisMask extends AbstractMask implements ResettableMask { 12 | 13 | private transient int layer = -1; 14 | 15 | @Override 16 | public boolean test(Vector vector) { 17 | if (layer == -1) { 18 | layer = vector.getBlockZ(); 19 | } 20 | return vector.getBlockZ() == layer; 21 | } 22 | 23 | @Override 24 | public void reset() { 25 | this.layer = -1; 26 | } 27 | 28 | @Nullable 29 | @Override 30 | public Mask2D toMask2D() { 31 | return null; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/number/MutableLong.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.number; 2 | 3 | public final class MutableLong { 4 | private long value; 5 | 6 | public final void increment() { 7 | value++; 8 | } 9 | 10 | public void set(long value) { 11 | this.value = value; 12 | } 13 | 14 | public long get() { 15 | return value; 16 | } 17 | 18 | public void add(long amount) { 19 | this.value += amount; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/AbstractExtentPattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.sk89q.worldedit.extent.Extent; 4 | import com.sk89q.worldedit.function.pattern.AbstractPattern; 5 | 6 | 7 | import static com.google.common.base.Preconditions.checkNotNull; 8 | 9 | public abstract class AbstractExtentPattern extends AbstractPattern { 10 | private transient final Extent extent; 11 | 12 | public AbstractExtentPattern(Extent extent) { 13 | checkNotNull(extent); 14 | this.extent = extent; 15 | } 16 | 17 | public final Extent getExtent() { 18 | return extent; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/BufferedPattern2D.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.boydti.fawe.object.FawePlayer; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.function.pattern.Pattern; 6 | 7 | public class BufferedPattern2D extends BufferedPattern { 8 | 9 | public BufferedPattern2D(FawePlayer fp, Pattern parent) { 10 | super(fp, parent); 11 | } 12 | 13 | @Override 14 | public boolean set(Vector pos) { 15 | return set.add(pos.getBlockX(), 0, pos.getBlockY()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/DataPattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.boydti.fawe.FaweCache; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.blocks.BaseBlock; 6 | import com.sk89q.worldedit.extent.Extent; 7 | import com.sk89q.worldedit.function.pattern.Pattern; 8 | 9 | 10 | import static com.google.common.base.Preconditions.checkNotNull; 11 | 12 | public class DataPattern extends AbstractExtentPattern { 13 | private final Pattern pattern; 14 | 15 | public DataPattern(Extent extent, Pattern parent) { 16 | super(extent); 17 | checkNotNull(parent); 18 | this.pattern = parent; 19 | } 20 | 21 | @Override 22 | public BaseBlock apply(Vector position) { 23 | BaseBlock oldBlock = getExtent().getBlock(position); 24 | BaseBlock newBlock = pattern.apply(position); 25 | return FaweCache.getBlock(oldBlock.getId(), newBlock.getData()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/ExistingPattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.WorldEditException; 5 | import com.sk89q.worldedit.blocks.BaseBlock; 6 | import com.sk89q.worldedit.extent.Extent; 7 | 8 | public class ExistingPattern extends AbstractExtentPattern { 9 | public ExistingPattern(Extent extent) { 10 | super(extent); 11 | } 12 | 13 | @Override 14 | public BaseBlock apply(Vector position) { 15 | return getExtent().getBlock(position); 16 | } 17 | 18 | @Override 19 | public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException { 20 | if (set.getBlockX() == get.getBlockX() && set.getBlockZ() == get.getBlockZ() && set.getBlockY() == get.getBlockY()) { 21 | return false; 22 | } 23 | return extent.setBlock(set, extent.getBlock(get)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/IdDataMaskPattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.boydti.fawe.FaweCache; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.blocks.BaseBlock; 6 | import com.sk89q.worldedit.extent.Extent; 7 | import com.sk89q.worldedit.function.pattern.Pattern; 8 | 9 | public class IdDataMaskPattern extends AbstractExtentPattern { 10 | private final Pattern pattern; 11 | private final int bitMask; 12 | 13 | public IdDataMaskPattern(Extent extent, Pattern parent, int bitMask) { 14 | super(extent); 15 | this.pattern = parent; 16 | this.bitMask = bitMask; 17 | } 18 | 19 | @Override 20 | public BaseBlock apply(Vector position) { 21 | BaseBlock oldBlock = getExtent().getBlock(position); 22 | BaseBlock newBlock = pattern.apply(position); 23 | int oldData = oldBlock.getData(); 24 | int newData = newBlock.getData() + oldData - (oldData & bitMask); 25 | return FaweCache.getBlock(newBlock.getId(), newData); 26 | } 27 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/IdPattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.boydti.fawe.FaweCache; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.blocks.BaseBlock; 6 | import com.sk89q.worldedit.extent.Extent; 7 | import com.sk89q.worldedit.function.pattern.Pattern; 8 | 9 | 10 | import static com.google.common.base.Preconditions.checkNotNull; 11 | 12 | public class IdPattern extends AbstractExtentPattern { 13 | private final Pattern pattern; 14 | 15 | public IdPattern(Extent extent, Pattern parent) { 16 | super(extent); 17 | checkNotNull(parent); 18 | this.pattern = parent; 19 | } 20 | 21 | @Override 22 | public BaseBlock apply(Vector position) { 23 | BaseBlock oldBlock = getExtent().getBlock(position); 24 | BaseBlock newBlock = pattern.apply(position); 25 | return FaweCache.getBlock(newBlock.getId(), oldBlock.getData()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/Linear2DBlockPattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.WorldEditException; 5 | import com.sk89q.worldedit.blocks.BaseBlock; 6 | import com.sk89q.worldedit.extent.Extent; 7 | import com.sk89q.worldedit.function.pattern.AbstractPattern; 8 | import com.sk89q.worldedit.function.pattern.Pattern; 9 | 10 | public class Linear2DBlockPattern extends AbstractPattern { 11 | 12 | private final Pattern[] patternsArray; 13 | 14 | public Linear2DBlockPattern(Pattern[] patterns) { 15 | this.patternsArray = patterns; 16 | } 17 | 18 | @Override 19 | public BaseBlock apply(Vector position) { 20 | int index = (position.getBlockX() + position.getBlockZ()) % patternsArray.length; 21 | if (index < 0) { 22 | index += patternsArray.length; 23 | } 24 | return patternsArray[index].apply(position); 25 | } 26 | 27 | @Override 28 | public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException { 29 | int index = (get.getBlockX() + get.getBlockZ()) % patternsArray.length; 30 | if (index < 0) { 31 | index += patternsArray.length; 32 | } 33 | return patternsArray[index].apply(extent, set, get); 34 | } 35 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/Linear3DBlockPattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.WorldEditException; 5 | import com.sk89q.worldedit.blocks.BaseBlock; 6 | import com.sk89q.worldedit.extent.Extent; 7 | import com.sk89q.worldedit.function.pattern.AbstractPattern; 8 | import com.sk89q.worldedit.function.pattern.Pattern; 9 | 10 | public class Linear3DBlockPattern extends AbstractPattern { 11 | 12 | private final Pattern[] patternsArray; 13 | 14 | public Linear3DBlockPattern(Pattern[] patterns) { 15 | this.patternsArray = patterns; 16 | } 17 | 18 | @Override 19 | public BaseBlock apply(Vector position) { 20 | int index = (position.getBlockX() + position.getBlockY() + position.getBlockZ()) % patternsArray.length; 21 | if (index < 0) { 22 | index += patternsArray.length; 23 | } 24 | return patternsArray[index].apply(position); 25 | } 26 | 27 | @Override 28 | public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException { 29 | int index = (get.getBlockX() + get.getBlockY() + get.getBlockZ()) % patternsArray.length; 30 | if (index < 0) { 31 | index += patternsArray.length; 32 | } 33 | return patternsArray[index].apply(extent, set, get); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/LinearBlockPattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.WorldEditException; 5 | import com.sk89q.worldedit.blocks.BaseBlock; 6 | import com.sk89q.worldedit.extent.Extent; 7 | import com.sk89q.worldedit.function.pattern.AbstractPattern; 8 | import com.sk89q.worldedit.function.pattern.Pattern; 9 | 10 | public class LinearBlockPattern extends AbstractPattern implements ResettablePattern { 11 | 12 | private final Pattern[] patternsArray; 13 | private transient int index; 14 | 15 | public LinearBlockPattern(Pattern[] patterns) { 16 | this.patternsArray = patterns; 17 | } 18 | 19 | @Override 20 | public BaseBlock apply(Vector position) { 21 | if (index == patternsArray.length) { 22 | index = 0; 23 | } 24 | return patternsArray[index++].apply(position); 25 | } 26 | 27 | @Override 28 | public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException { 29 | if (index == patternsArray.length) { 30 | index = 0; 31 | } 32 | return patternsArray[index++].apply(extent, set, get); 33 | } 34 | 35 | @Override 36 | public void reset() { 37 | index = 0; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/NoXPattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.sk89q.worldedit.MutableBlockVector; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.WorldEditException; 6 | import com.sk89q.worldedit.blocks.BaseBlock; 7 | import com.sk89q.worldedit.extent.Extent; 8 | import com.sk89q.worldedit.function.pattern.AbstractPattern; 9 | import com.sk89q.worldedit.function.pattern.Pattern; 10 | import java.io.IOException; 11 | 12 | public class NoXPattern extends AbstractPattern { 13 | 14 | private final Pattern pattern; 15 | private transient MutableBlockVector mutable = new MutableBlockVector(); 16 | 17 | public NoXPattern(Pattern pattern) { 18 | this.pattern = pattern; 19 | } 20 | 21 | @Override 22 | public BaseBlock apply(Vector pos) { 23 | mutable.mutY((pos.getY())); 24 | mutable.mutZ((pos.getZ())); 25 | return pattern.apply(mutable); 26 | } 27 | 28 | @Override 29 | public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException { 30 | mutable.mutY((get.getY())); 31 | mutable.mutZ((get.getZ())); 32 | return pattern.apply(extent, set, mutable); 33 | } 34 | 35 | private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { 36 | stream.defaultReadObject(); 37 | mutable = new MutableBlockVector(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/NoYPattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.sk89q.worldedit.MutableBlockVector; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.WorldEditException; 6 | import com.sk89q.worldedit.blocks.BaseBlock; 7 | import com.sk89q.worldedit.extent.Extent; 8 | import com.sk89q.worldedit.function.pattern.AbstractPattern; 9 | import com.sk89q.worldedit.function.pattern.Pattern; 10 | import java.io.IOException; 11 | 12 | public class NoYPattern extends AbstractPattern { 13 | 14 | private final Pattern pattern; 15 | 16 | public NoYPattern(Pattern pattern) { 17 | this.pattern = pattern; 18 | } 19 | 20 | private transient MutableBlockVector mutable = new MutableBlockVector(); 21 | 22 | @Override 23 | public BaseBlock apply(Vector pos) { 24 | mutable.mutX((pos.getX())); 25 | mutable.mutZ((pos.getZ())); 26 | return pattern.apply(mutable); 27 | } 28 | 29 | @Override 30 | public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException { 31 | mutable.mutX((get.getX())); 32 | mutable.mutZ((get.getZ())); 33 | return pattern.apply(extent, set, mutable); 34 | } 35 | 36 | private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { 37 | stream.defaultReadObject(); 38 | mutable = new MutableBlockVector(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/NoZPattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.sk89q.worldedit.MutableBlockVector; 4 | import com.sk89q.worldedit.Vector; 5 | import com.sk89q.worldedit.WorldEditException; 6 | import com.sk89q.worldedit.blocks.BaseBlock; 7 | import com.sk89q.worldedit.extent.Extent; 8 | import com.sk89q.worldedit.function.pattern.AbstractPattern; 9 | import com.sk89q.worldedit.function.pattern.Pattern; 10 | import java.io.IOException; 11 | 12 | public class NoZPattern extends AbstractPattern { 13 | 14 | private final Pattern pattern; 15 | 16 | public NoZPattern(Pattern pattern) { 17 | this.pattern = pattern; 18 | } 19 | 20 | private transient MutableBlockVector mutable = new MutableBlockVector(); 21 | 22 | @Override 23 | public BaseBlock apply(Vector pos) { 24 | mutable.mutX((pos.getX())); 25 | mutable.mutY((pos.getY())); 26 | return pattern.apply(mutable); 27 | } 28 | 29 | @Override 30 | public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException { 31 | mutable.mutX((get.getX())); 32 | mutable.mutY((get.getY())); 33 | return pattern.apply(extent, set, mutable); 34 | } 35 | 36 | private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { 37 | stream.defaultReadObject(); 38 | mutable = new MutableBlockVector(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/ResettablePattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | public interface ResettablePattern { 4 | void reset(); 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/pattern/ShadePattern.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.pattern; 2 | 3 | import com.boydti.fawe.Fawe; 4 | import com.boydti.fawe.util.TextureUtil; 5 | import com.sk89q.worldedit.Vector; 6 | import com.sk89q.worldedit.blocks.BaseBlock; 7 | import com.sk89q.worldedit.extent.Extent; 8 | import com.sk89q.worldedit.function.pattern.AbstractPattern; 9 | import java.io.IOException; 10 | 11 | 12 | import static com.google.common.base.Preconditions.checkNotNull; 13 | 14 | public class ShadePattern extends AbstractPattern { 15 | private transient TextureUtil util; 16 | private final Extent extent; 17 | private final boolean darken; 18 | 19 | public ShadePattern(Extent extent, boolean darken, TextureUtil util) { 20 | checkNotNull(extent); 21 | this.extent = extent; 22 | this.util = util; 23 | this.darken = darken; 24 | } 25 | 26 | @Override 27 | public BaseBlock apply(Vector position) { 28 | BaseBlock block = extent.getBlock(position); 29 | return darken ? util.getDarkerBlock(block) : util.getLighterBlock(block); 30 | } 31 | 32 | private void readObject(java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException { 33 | stream.defaultReadObject(); 34 | util = Fawe.get().getCachedTextureUtil(true, 0, 100); 35 | } 36 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/progress/ChatProgressTracker.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.progress; 2 | 3 | import com.boydti.fawe.config.BBC; 4 | import com.boydti.fawe.object.FawePlayer; 5 | 6 | public class ChatProgressTracker extends DefaultProgressTracker { 7 | public ChatProgressTracker(FawePlayer player) { 8 | super(player); 9 | setInterval(getDelay() / 50); 10 | } 11 | 12 | @Override 13 | public void sendTask() { 14 | super.sendTask(); 15 | } 16 | 17 | @Override 18 | public void doneTask() { 19 | super.doneTask(); 20 | } 21 | 22 | @Override 23 | public void sendTile(String title, String sub) { 24 | getPlayer().sendMessage(BBC.getPrefix() + title + sub); 25 | } 26 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/queue/DelegateFaweQueue.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.queue; 2 | 3 | import com.boydti.fawe.object.FaweQueue; 4 | 5 | public class DelegateFaweQueue implements IDelegateFaweQueue { 6 | private FaweQueue parent; 7 | 8 | public DelegateFaweQueue(FaweQueue parent) { 9 | this.parent = parent; 10 | } 11 | 12 | public FaweQueue getParent() { 13 | return parent; 14 | } 15 | 16 | public void setParent(FaweQueue parent) { 17 | this.parent = parent; 18 | setWorld(getQueue().getWorldName()); 19 | } 20 | 21 | @Override 22 | public FaweQueue getQueue() { 23 | return parent; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/random/SimpleRandom.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.random; 2 | 3 | public interface SimpleRandom { 4 | public double nextDouble(int x, int y, int z); 5 | 6 | public default int nextInt(int x, int y, int z, int len) { 7 | double val = nextDouble(x, y, z); 8 | return (int) (val * len); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/random/SimplexRandom.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.random; 2 | 3 | public class SimplexRandom implements SimpleRandom { 4 | private final double scale; 5 | 6 | public SimplexRandom(double scale) { 7 | this.scale = scale; 8 | } 9 | 10 | @Override 11 | public double nextDouble(int x, int y, int z) { 12 | return (SimplexNoise.noise(x * scale, y * scale, z * scale) + 1) * 0.5; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/random/TrueRandom.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.random; 2 | 3 | import java.util.SplittableRandom; 4 | 5 | public class TrueRandom implements SimpleRandom { 6 | private final SplittableRandom r; 7 | 8 | public TrueRandom() { 9 | this.r = new SplittableRandom(); 10 | } 11 | 12 | @Override 13 | public double nextDouble(int x, int y, int z) { 14 | return r.nextDouble(); 15 | } 16 | 17 | @Override 18 | public int nextInt(int x, int y, int z, int len) { 19 | return r.nextInt(len); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/task/AsyncNotifyQueue.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.task; 2 | 3 | import com.boydti.fawe.util.TaskManager; 4 | import java.util.concurrent.atomic.AtomicBoolean; 5 | 6 | public abstract class AsyncNotifyQueue { 7 | protected Object lock = new Object(); 8 | protected final Runnable task; 9 | protected final AtomicBoolean running = new AtomicBoolean(); 10 | 11 | public AsyncNotifyQueue() { 12 | this.task = new Runnable() { 13 | @Override 14 | public void run() { 15 | operate(); 16 | synchronized (lock) { 17 | if (hasQueued()) TaskManager.IMP.async(this); 18 | else running.set(false); 19 | } 20 | } 21 | }; 22 | } 23 | 24 | public abstract boolean hasQueued(); 25 | 26 | public void queue(Runnable queueTask) { 27 | synchronized (lock) { 28 | if (queueTask != null) queueTask.run(); 29 | if (!running.get()) { 30 | running.set(true); 31 | TaskManager.IMP.async(task); 32 | } 33 | } 34 | } 35 | 36 | public abstract void operate(); 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/task/ThrowableRunnable.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.task; 2 | 3 | import com.sk89q.worldedit.WorldEditException; 4 | 5 | public interface ThrowableRunnable { 6 | void run() throws T; 7 | } 8 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/task/ThrowableSupplier.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.task; 2 | 3 | public interface ThrowableSupplier { 4 | Object get() throws T; 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/visitor/DFSRecursiveVisitor.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.visitor; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.function.RegionFunction; 5 | import com.sk89q.worldedit.function.mask.Mask; 6 | import com.sk89q.worldedit.function.visitor.RecursiveVisitor; 7 | 8 | 9 | import static com.google.common.base.Preconditions.checkNotNull; 10 | 11 | /** 12 | * An implementation of an {@link com.sk89q.worldedit.function.visitor.BreadthFirstSearch} that uses a mask to 13 | * determine where a block should be visited. 14 | */ 15 | public class DFSRecursiveVisitor extends DFSVisitor { 16 | 17 | private final Mask mask; 18 | 19 | public DFSRecursiveVisitor(final Mask mask, final RegionFunction function) { 20 | this(mask, function, Integer.MAX_VALUE, Integer.MAX_VALUE); 21 | } 22 | 23 | /** 24 | * Create a new recursive visitor. 25 | * 26 | * @param mask the mask 27 | * @param function the function 28 | */ 29 | public DFSRecursiveVisitor(final Mask mask, final RegionFunction function, int maxDepth, int maxBranching) { 30 | super(function, maxDepth, maxBranching); 31 | checkNotNull(mask); 32 | this.mask = mask; 33 | } 34 | 35 | @Override 36 | public boolean isVisitable(final Vector from, final Vector to) { 37 | return this.mask.test(to); 38 | } 39 | 40 | public static Class inject() { 41 | return RecursiveVisitor.class; 42 | } 43 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/object/visitor/FaweChunkVisitor.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.object.visitor; 2 | 3 | public abstract class FaweChunkVisitor { 4 | /** 5 | * The will run for each set block in the chunk 6 | * 7 | * @param localX The x position in the chunk (0-15) 8 | * @param y The y position (0 - 255) 9 | * @param localZ The z position in the chunk (0-15) 10 | * @param combined The combined id 11 | */ 12 | public abstract void run(int localX, int y, int localZ, int combined); 13 | } 14 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/regions/SimpleRegion.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.regions; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.regions.AbstractRegion; 5 | import com.sk89q.worldedit.regions.RegionOperationException; 6 | import com.sk89q.worldedit.world.World; 7 | 8 | public abstract class SimpleRegion extends AbstractRegion { 9 | private final Vector max; 10 | private final Vector min; 11 | 12 | public SimpleRegion(World world, Vector min, Vector max) { 13 | super(world); 14 | this.min = min; 15 | this.max = max; 16 | } 17 | 18 | @Override 19 | public Vector getMinimumPoint() { 20 | return min; 21 | } 22 | 23 | @Override 24 | public Vector getMaximumPoint() { 25 | return max; 26 | } 27 | 28 | @Override 29 | public void expand(Vector... changes) throws RegionOperationException { 30 | throw new UnsupportedOperationException("Region is immutable"); 31 | } 32 | 33 | @Override 34 | public void contract(Vector... changes) throws RegionOperationException { 35 | throw new UnsupportedOperationException("Region is immutable"); 36 | } 37 | 38 | @Override 39 | public boolean contains(Vector p) { 40 | return contains(p.getBlockX(), p.getBlockY(), p.getBlockZ()); 41 | } 42 | 43 | @Override 44 | public abstract boolean contains(int x, int y, int z); 45 | 46 | @Override 47 | public abstract boolean contains(int x, int z); 48 | } 49 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/regions/general/RedProtectFeature.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.regions.general; 2 | 3 | import com.boydti.fawe.object.FawePlayer; 4 | import com.boydti.fawe.regions.FaweMask; 5 | import com.boydti.fawe.regions.FaweMaskManager; 6 | 7 | public class RedProtectFeature extends FaweMaskManager { 8 | public RedProtectFeature(String plugin) { 9 | super(plugin); 10 | } 11 | 12 | @Override 13 | public FaweMask getMask(FawePlayer player) { 14 | return null; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/regions/general/RegionFilter.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.regions.general; 2 | 3 | public interface RegionFilter { 4 | public boolean containsRegion(int mcaX, int mcaZ); 5 | 6 | public boolean containsChunk(int chunkX, int chunkZ); 7 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/regions/general/plot/PlotRegionFilter.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.regions.general.plot; 2 | 3 | import com.boydti.fawe.regions.general.CuboidRegionFilter; 4 | import com.intellectualcrafters.plot.object.Location; 5 | import com.intellectualcrafters.plot.object.Plot; 6 | import com.intellectualcrafters.plot.object.PlotArea; 7 | import com.sk89q.worldedit.BlockVector2D; 8 | import java.util.ArrayList; 9 | 10 | 11 | import static com.google.common.base.Preconditions.checkNotNull; 12 | 13 | public class PlotRegionFilter extends CuboidRegionFilter { 14 | private final PlotArea area; 15 | 16 | public PlotRegionFilter(PlotArea area) { 17 | checkNotNull(area); 18 | this.area = area; 19 | } 20 | @Override 21 | public void calculateRegions() { 22 | ArrayList plots = new ArrayList<>(area.getPlots()); 23 | for (Plot plot : plots) { 24 | Location pos1 = plot.getBottom(); 25 | Location pos2 = plot.getTop(); 26 | add(new BlockVector2D(pos1.getX(), pos1.getZ()), new BlockVector2D(pos2.getX(), pos2.getZ())); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/ArrayUtil.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util; 2 | 3 | import java.util.Arrays; 4 | 5 | public class ArrayUtil { 6 | public static final void fill(byte[] a, int fromIndex, int toIndex, byte val) { 7 | for (int i = fromIndex; i < toIndex; i++) a[i] = val; 8 | } 9 | 10 | public static final void fill(char[] a, int fromIndex, int toIndex, char val) { 11 | for (int i = fromIndex; i < toIndex; i++) a[i] = val; 12 | } 13 | 14 | public static T[] concatAll(T[] first, T[]... rest) { 15 | int totalLength = first.length; 16 | for (T[] array : rest) { 17 | totalLength += array.length; 18 | } 19 | T[] result = Arrays.copyOf(first, totalLength); 20 | int offset = first.length; 21 | for (T[] array : rest) { 22 | System.arraycopy(array, 0, result, offset, array.length); 23 | offset += array.length; 24 | } 25 | return result; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/Perm.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util; 2 | 3 | import com.boydti.fawe.object.FawePlayer; 4 | 5 | public enum Perm { 6 | /* 7 | * Permission related functions 8 | */ 9 | ADMIN("fawe.admin", "admin"); 10 | 11 | public String s; 12 | public String cat; 13 | 14 | Perm(final String perm, final String cat) { 15 | this.s = perm; 16 | this.cat = cat; 17 | } 18 | 19 | public boolean has(final FawePlayer player) { 20 | return this.hasPermission(player, this); 21 | } 22 | 23 | public boolean hasPermission(final FawePlayer player, final Perm perm) { 24 | return hasPermission(player, perm.s); 25 | } 26 | 27 | public static boolean hasPermission(final FawePlayer player, final String perm) { 28 | if ((player == null) || player.hasPermission(ADMIN.s)) { 29 | return true; 30 | } 31 | if (player.hasPermission(perm)) { 32 | return true; 33 | } 34 | final String[] nodes = perm.split("\\."); 35 | final StringBuilder n = new StringBuilder(); 36 | for (int i = 0; i < (nodes.length - 1); i++) { 37 | n.append(nodes[i] + (".")); 38 | if (player.hasPermission(n + "*")) { 39 | return true; 40 | } 41 | } 42 | return false; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/TextureHolder.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util; 2 | 3 | public interface TextureHolder { 4 | TextureUtil getTextureUtil(); 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/chat/ChatManager.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util.chat; 2 | 3 | import com.boydti.fawe.object.FawePlayer; 4 | 5 | public interface ChatManager { 6 | T builder(); 7 | 8 | void color(Message message, String color); 9 | 10 | void tooltip(Message message, Message... tooltip); 11 | 12 | void command(Message message, String command); 13 | 14 | void text(Message message, String text); 15 | 16 | void send(Message message, FawePlayer player); 17 | 18 | void suggest(Message message, String command); 19 | 20 | void link(Message message, String url); 21 | } 22 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/chat/PlainChatManager.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util.chat; 2 | 3 | 4 | import com.boydti.fawe.config.BBC; 5 | import com.boydti.fawe.object.FawePlayer; 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | public class PlainChatManager implements ChatManager> { 10 | 11 | @Override 12 | public List builder() { 13 | return new ArrayList<>(); 14 | } 15 | 16 | @Override 17 | public void color(Message message, String color) { 18 | List parts = message.$(this); 19 | parts.get(parts.size() - 1).insert(0, color); 20 | } 21 | 22 | @Override 23 | public void tooltip(Message message, Message... tooltips) {} 24 | 25 | @Override 26 | public void command(Message message, String command) {} 27 | 28 | @Override 29 | public void text(Message message, String text) { 30 | message.$(this).add(new StringBuilder(BBC.color(text))); 31 | } 32 | 33 | @Override 34 | public void send(Message plotMessage, FawePlayer player) { 35 | StringBuilder built = new StringBuilder(); 36 | for (StringBuilder sb : plotMessage.$(this)) { 37 | built.append(sb); 38 | } 39 | player.sendMessage(built.toString()); 40 | } 41 | 42 | @Override 43 | public void suggest(Message plotMessage, String command) {} 44 | 45 | @Override 46 | public void link(Message message, String url) {} 47 | } -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/cui/CUI.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util.cui; 2 | 3 | import com.boydti.fawe.object.FawePlayer; 4 | import com.sk89q.worldedit.internal.cui.CUIEvent; 5 | 6 | public abstract class CUI { 7 | private final FawePlayer player; 8 | 9 | public CUI(FawePlayer player) { 10 | this.player = player; 11 | } 12 | 13 | public FawePlayer getPlayer() { 14 | return player; 15 | } 16 | 17 | public abstract void dispatchCUIEvent(CUIEvent event); 18 | } 19 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/gui/FormBuilder.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util.gui; 2 | 3 | import com.boydti.fawe.object.FawePlayer; 4 | import java.net.URL; 5 | import java.util.Map; 6 | import java.util.function.Consumer; 7 | import javax.annotation.Nullable; 8 | 9 | public interface FormBuilder { 10 | FormBuilder setTitle(String text); 11 | 12 | FormBuilder setIcon(URL icon); 13 | 14 | FormBuilder addButton(String text, @Nullable URL image); 15 | 16 | FormBuilder addDropdown(String text, int def, String... options); 17 | 18 | FormBuilder addInput(String text, String placeholder, String def); 19 | 20 | FormBuilder addLabel(String text); 21 | 22 | FormBuilder addSlider(String text, double min, double max, int step, double def); 23 | 24 | FormBuilder addStepSlider(String text, int def, String... options); 25 | 26 | FormBuilder addToggle(String text, boolean def); 27 | 28 | FormBuilder setResponder(Consumer> handler); 29 | 30 | void display(FawePlayer fp); 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/image/Drawable.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util.image; 2 | 3 | import java.awt.image.BufferedImage; 4 | 5 | public interface Drawable { 6 | public BufferedImage draw(); 7 | } 8 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/image/ImageViewer.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util.image; 2 | 3 | import java.io.Closeable; 4 | 5 | public interface ImageViewer extends Closeable{ 6 | public void view(Drawable drawable); 7 | } 8 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/task/DelayedTask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util.task; 2 | 3 | public interface DelayedTask { 4 | int getDelay(T previousResult); 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/task/ReceiveTask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util.task; 2 | 3 | public interface ReceiveTask { 4 | void run(T previous); 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/task/ReturnTask.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util.task; 2 | 3 | public interface ReturnTask { 4 | T run(); 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/task/Task.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util.task; 2 | 3 | public interface Task { 4 | T run(V previousResult); 5 | } 6 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/util/terrain/Erosion.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.util.terrain; 2 | 3 | import java.util.Arrays; 4 | 5 | 6 | import static com.boydti.fawe.util.MathMan.pairInt; 7 | 8 | public final class Erosion { 9 | private final int area; 10 | private float[][] terrainHeight; 11 | private float[][] waterHeight; 12 | 13 | private long[] queue_2; 14 | private long[] queue; 15 | private int queueIndex; 16 | 17 | public Erosion(int width, int length) { 18 | this.area = width * length; 19 | queue = new long[area]; 20 | Arrays.fill(queue, -1); 21 | 22 | } 23 | 24 | public void addWater(int x, int z, float amt) { 25 | waterHeight[x][z] += amt; 26 | queue[queueIndex++] = pairInt(x, z); 27 | } 28 | 29 | public void propogateWater() { 30 | 31 | } 32 | 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /core/src/main/java/com/boydti/fawe/wrappers/SilentPlayerWrapper.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.wrappers; 2 | 3 | import com.sk89q.worldedit.entity.Player; 4 | 5 | /** 6 | * Still prints error messages 7 | */ 8 | public class SilentPlayerWrapper extends PlayerWrapper { 9 | public SilentPlayerWrapper(Player parent) { 10 | super(parent); 11 | } 12 | 13 | @Override 14 | public void print(String msg) { 15 | } 16 | 17 | @Override 18 | public void printDebug(String msg) { 19 | } 20 | 21 | @Override 22 | public void printRaw(String msg) { 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/jnbt/NamedData.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.jnbt; 2 | 3 | import static com.google.common.base.Preconditions.checkNotNull; 4 | 5 | /** 6 | * Some data with a name 7 | */ 8 | public class NamedData { 9 | private final String name; 10 | private final T data; 11 | 12 | /** 13 | * Create a new named tag. 14 | * 15 | * @param name the name 16 | * @param data the data 17 | */ 18 | public NamedData(String name, T data) { 19 | checkNotNull(name); 20 | this.name = name; 21 | this.data = data; 22 | } 23 | 24 | /** 25 | * Get the name of the tag. 26 | * 27 | * @return the name 28 | */ 29 | public String getName() { 30 | return name; 31 | } 32 | 33 | /** 34 | * Get the tag. 35 | * 36 | * @return the tag 37 | */ 38 | public T getValue() { 39 | return data; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/jnbt/Tag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WorldEdit, a Minecraft world manipulation toolkit 3 | * Copyright (C) sk89q 4 | * Copyright (C) WorldEdit team and contributors 5 | * 6 | * This program is free software: you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as published by the 8 | * Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 14 | * for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | package com.sk89q.jnbt; 21 | 22 | /** 23 | * Represents a NBT tag. 24 | */ 25 | public abstract class Tag { 26 | 27 | /** 28 | * Gets the value of this tag. 29 | * 30 | * @return the value 31 | */ 32 | public abstract Object getValue(); 33 | 34 | public Object getRaw() { 35 | return getValue(); 36 | } 37 | 38 | public static Class inject() { 39 | return Tag.class; 40 | } 41 | 42 | 43 | } -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/minecraft/util/commands/Link.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.minecraft.util.commands; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface Link { 8 | 9 | Class clazz() default Link.class; 10 | String value(); 11 | } 12 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/minecraft/util/commands/Step.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.minecraft.util.commands; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface Step { 8 | Class clazz() default Link.class; 9 | 10 | double value() default 1; 11 | } 12 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/minecraft/util/commands/SuggestedRange.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.minecraft.util.commands; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | @Retention(RetentionPolicy.RUNTIME) 7 | public @interface SuggestedRange { 8 | Class clazz() default Link.class; 9 | String value(); 10 | 11 | 12 | /** 13 | * The minimum value that the number can be at, inclusive. 14 | * 15 | * @return the minimum value 16 | */ 17 | double min() default Double.MIN_VALUE; 18 | 19 | /** 20 | * The maximum value that the number can be at, inclusive. 21 | * 22 | * @return the maximum value 23 | */ 24 | double max() default Double.MAX_VALUE; 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/blocks/ImmutableBlock.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.blocks; 2 | 3 | import com.sk89q.worldedit.CuboidClipboard; 4 | 5 | public class ImmutableBlock extends BaseBlock { 6 | private final int combined; 7 | 8 | public ImmutableBlock(int id, int data) { 9 | super(id, data); 10 | this.combined = super.getCombined(); 11 | } 12 | 13 | @Override 14 | public final int getCombined() { 15 | return combined; 16 | } 17 | 18 | @Override 19 | public void setData(int data) { 20 | throw new IllegalStateException("Cannot set data"); 21 | } 22 | 23 | @Override 24 | public void setId(int id) { 25 | throw new IllegalStateException("Cannot set id"); 26 | } 27 | 28 | @Override 29 | public BaseBlock flip() { 30 | BaseBlock clone = new BaseBlock(getId(), getData(), getNbtData()); 31 | return clone.flip(); 32 | } 33 | 34 | @Override 35 | public BaseBlock flip(CuboidClipboard.FlipDirection direction) { 36 | BaseBlock clone = new BaseBlock(getId(), getData(), getNbtData()); 37 | return clone.flip(direction); 38 | } 39 | 40 | @Override 41 | public boolean canStoreNBTData() { 42 | return false; 43 | } 44 | 45 | @Override 46 | public boolean isImmutable() { 47 | return true; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/blocks/ImmutableDatalessBlock.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.blocks; 2 | 3 | public class ImmutableDatalessBlock extends ImmutableBlock { 4 | public ImmutableDatalessBlock(int id) { 5 | super(id, 0); 6 | } 7 | 8 | @Override 9 | public int getData() { 10 | return 0; 11 | } 12 | 13 | @Override 14 | public boolean equals(BaseBlock block) { 15 | return block.getId() == this.getId(); 16 | } 17 | 18 | @Override 19 | public boolean equals(Object o) { 20 | if (o instanceof BaseBlock) { 21 | return ((BaseBlock) o).getId() == this.getId(); 22 | } else { 23 | return false; 24 | } 25 | } 26 | 27 | @Override 28 | public boolean canStoreNBTData() { 29 | return false; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/blocks/ImmutableNBTBlock.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.blocks; 2 | 3 | public class ImmutableNBTBlock extends ImmutableBlock { 4 | public ImmutableNBTBlock(int id, int data) { 5 | super(id, data); 6 | } 7 | 8 | @Override 9 | public boolean canStoreNBTData() { 10 | return true; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/command/tool/BrushHolder.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.command.tool; 2 | 3 | public interface BrushHolder { 4 | BrushTool getTool(); 5 | 6 | BrushTool setTool(BrushTool tool); 7 | } -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/event/extent/FaweEvent.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.event.extent; 2 | 3 | import com.sk89q.worldedit.WorldEdit; 4 | import com.sk89q.worldedit.event.Cancellable; 5 | import com.sk89q.worldedit.event.Event; 6 | 7 | public abstract class FaweEvent extends Event implements Cancellable { 8 | /** 9 | * Returns true if this event was called and not cancelled 10 | * @return !isCancelled 11 | */ 12 | public boolean call() { 13 | WorldEdit.getInstance().getEventBus().post(this); 14 | return !this.isCancelled(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/event/extent/PlayerSaveClipboardEvent.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.event.extent; 2 | 3 | import com.sk89q.worldedit.entity.Player; 4 | import com.sk89q.worldedit.event.Cancellable; 5 | import com.sk89q.worldedit.event.Event; 6 | import com.sk89q.worldedit.extent.clipboard.Clipboard; 7 | import com.sk89q.worldedit.session.ClipboardHolder; 8 | 9 | import java.net.URI; 10 | 11 | public class PlayerSaveClipboardEvent extends FaweEvent { 12 | private final Player player; 13 | private final Clipboard clipboard; 14 | private final URI source, destination; 15 | private boolean cancelled; 16 | 17 | public PlayerSaveClipboardEvent(Player player, Clipboard clipboard, URI source, URI destination) { 18 | this.player = player; 19 | this.clipboard = clipboard; 20 | this.source = source; 21 | this.destination = destination; 22 | } 23 | 24 | @Override 25 | public boolean isCancelled() { 26 | return cancelled; 27 | } 28 | 29 | @Override 30 | public void setCancelled(boolean cancelled) { 31 | this.cancelled = cancelled; 32 | } 33 | 34 | public URI getSourceURI() { 35 | return source; 36 | } 37 | 38 | public URI getDestinationURI() { 39 | return destination; 40 | } 41 | 42 | public Clipboard getClipboard() { 43 | return clipboard; 44 | } 45 | 46 | public Player getPlayer() { 47 | return player; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/extent/inventory/SlottableBlockBag.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.extent.inventory; 2 | 3 | import com.sk89q.worldedit.blocks.BaseItem; 4 | 5 | public interface SlottableBlockBag { 6 | BaseItem getItem(int slot); 7 | 8 | void setItem(int slot, BaseItem block); 9 | 10 | default int size() { 11 | return 36; 12 | } 13 | 14 | default int getSelectedSlot() { 15 | return -1; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/function/mask/AbstractExtentMask.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.function.mask; 2 | 3 | import com.google.common.base.Preconditions; 4 | import com.sk89q.worldedit.extent.Extent; 5 | 6 | public abstract class AbstractExtentMask extends AbstractMask { 7 | private transient Extent extent; 8 | 9 | protected AbstractExtentMask(Extent extent) { 10 | this.setExtent(extent); 11 | } 12 | 13 | public Extent getExtent() { 14 | return this.extent; 15 | } 16 | 17 | public void setExtent(Extent extent) { 18 | Preconditions.checkNotNull(extent); 19 | this.extent = extent; 20 | } 21 | 22 | public static Class inject() { 23 | return AbstractExtentMask.class; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/function/mask/AbstractMask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * WorldEdit, a Minecraft world manipulation toolkit 3 | * Copyright (C) sk89q 4 | * Copyright (C) WorldEdit team and contributors 5 | * 6 | * This program is free software: you can redistribute it and/or modify it 7 | * under the terms of the GNU Lesser General Public License as published by the 8 | * Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 14 | * for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | package com.sk89q.worldedit.function.mask; 21 | 22 | import java.io.Serializable; 23 | 24 | /** 25 | * A base class of {@link Mask} that all masks should inherit from. 26 | */ 27 | public abstract class AbstractMask implements Mask, Serializable { 28 | public static Class inject() { 29 | return AbstractMask.class; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/function/mask/ConditionalMask.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.function.mask; 2 | 3 | import com.boydti.fawe.FaweCache; 4 | import com.sk89q.worldedit.blocks.BaseBlock; 5 | import com.sk89q.worldedit.extent.Extent; 6 | 7 | public abstract class ConditionalMask extends BlockMask { 8 | public ConditionalMask(Extent extent) { 9 | super(extent); 10 | for (BaseBlock block : FaweCache.CACHE_BLOCK) { 11 | if (applies(block)) { 12 | add(block); 13 | } 14 | } 15 | } 16 | 17 | public abstract boolean applies(BaseBlock block); 18 | } 19 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/function/mask/FuzzyBlockMask.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.function.mask; 2 | 3 | import com.sk89q.worldedit.blocks.BaseBlock; 4 | import com.sk89q.worldedit.extent.Extent; 5 | import java.util.Collection; 6 | 7 | public class FuzzyBlockMask extends BlockMask { 8 | 9 | public FuzzyBlockMask(Extent extent, Collection blocks) { 10 | super(extent, blocks); 11 | } 12 | 13 | public FuzzyBlockMask(Extent extent, BaseBlock... block) { 14 | super(extent, block); 15 | } 16 | 17 | public static Class inject() { 18 | return FuzzyBlockMask.class; 19 | } 20 | } -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/function/mask/SolidBlockMask.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.function.mask; 2 | 3 | import com.sk89q.worldedit.blocks.BaseBlock; 4 | import com.sk89q.worldedit.blocks.BlockType; 5 | import com.sk89q.worldedit.extent.Extent; 6 | import javax.annotation.Nullable; 7 | 8 | public class SolidBlockMask extends BlockMask { 9 | 10 | public SolidBlockMask(Extent extent) { 11 | super(extent); 12 | for (int id = 0; id < 4096; id++) { 13 | for (int data = 0; data < 16; data++) { 14 | if (!BlockType.canPassThrough(id, data)) { 15 | add(new BaseBlock(id, data)); 16 | } 17 | } 18 | } 19 | } 20 | 21 | @Nullable 22 | @Override 23 | public Mask2D toMask2D() { 24 | return null; // 9751418 25 | } 26 | 27 | public static Class inject() { 28 | return SolidBlockMask.class; 29 | } 30 | } -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/function/pattern/AbstractPattern.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.function.pattern; 2 | 3 | import java.io.Serializable; 4 | 5 | public abstract class AbstractPattern implements Pattern, Serializable { 6 | public AbstractPattern() { 7 | } 8 | 9 | public static Class inject() { 10 | return AbstractPattern.class; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/function/pattern/Patterns.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.function.pattern; 2 | 3 | /** 4 | * Utility methods related to {@link Pattern}s. 5 | */ 6 | public final class Patterns { 7 | 8 | private Patterns() { 9 | } 10 | 11 | /** 12 | * Wrap an old-style pattern and return a new pattern. 13 | * 14 | * @param pattern the pattern 15 | * @return a new-style pattern 16 | */ 17 | public static Pattern wrap(final com.sk89q.worldedit.patterns.Pattern pattern) { 18 | if (pattern instanceof Pattern) { 19 | return (Pattern) pattern; 20 | } 21 | return position -> pattern.next(position); 22 | } 23 | 24 | /** 25 | * Wrap a new-style pattern and return an old-style pattern. 26 | * 27 | * @param pattern the pattern 28 | * @return an old-style pattern 29 | */ 30 | public static com.sk89q.worldedit.patterns.Pattern wrap(final Pattern pattern) { 31 | return pattern; 32 | } 33 | 34 | public static Class inject() { 35 | return Patterns.class; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/function/visitor/IntersectRegionFunction.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.function.visitor; 2 | 3 | import com.sk89q.worldedit.Vector; 4 | import com.sk89q.worldedit.WorldEditException; 5 | import com.sk89q.worldedit.function.RegionFunction; 6 | 7 | public class IntersectRegionFunction implements RegionFunction { 8 | private final RegionFunction[] functions; 9 | 10 | public IntersectRegionFunction(RegionFunction... functions) { 11 | this.functions = functions; 12 | } 13 | 14 | 15 | @Override 16 | public boolean apply(Vector position) throws WorldEditException { 17 | boolean ret = false; 18 | for (RegionFunction function : functions) { 19 | if (!function.apply(position)) { 20 | return ret; 21 | } else { 22 | ret = true; 23 | } 24 | } 25 | return ret; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/math/transform/RoundedTransform.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.math.transform; 2 | 3 | import com.sk89q.worldedit.MutableBlockVector; 4 | import com.sk89q.worldedit.Vector; 5 | 6 | public class RoundedTransform implements Transform{ 7 | private final Transform transform; 8 | private MutableBlockVector mutable = new MutableBlockVector(); 9 | 10 | public RoundedTransform(Transform transform) { 11 | this.transform = transform; 12 | } 13 | 14 | @Override 15 | public boolean isIdentity() { 16 | return transform.isIdentity(); 17 | } 18 | 19 | @Override 20 | public Vector apply(Vector input) { 21 | Vector val = transform.apply(input); 22 | mutable.mutX((int) Math.floor(val.getX() + 0.5)); 23 | mutable.mutY((int) Math.floor(val.getY() + 0.5)); 24 | mutable.mutZ((int) Math.floor(val.getZ() + 0.5)); 25 | return mutable; 26 | } 27 | 28 | @Override 29 | public RoundedTransform inverse() { 30 | return new RoundedTransform(transform.inverse()); 31 | } 32 | 33 | @Override 34 | public RoundedTransform combine(Transform other) { 35 | return new RoundedTransform(transform.combine(other)); 36 | } 37 | 38 | public Transform getTransform() { 39 | return transform; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/session/DelegateClipboardHolder.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.session; 2 | 3 | import com.sk89q.worldedit.extent.Extent; 4 | import com.sk89q.worldedit.extent.clipboard.Clipboard; 5 | import com.sk89q.worldedit.math.transform.Transform; 6 | import com.sk89q.worldedit.world.registry.WorldData; 7 | 8 | public class DelegateClipboardHolder extends ClipboardHolder { 9 | private final ClipboardHolder parent; 10 | 11 | public DelegateClipboardHolder(ClipboardHolder holder) { 12 | super(holder.getClipboard(), holder.getWorldData()); 13 | this.parent = holder; 14 | } 15 | 16 | @Override 17 | public WorldData getWorldData() { 18 | return parent.getWorldData(); 19 | } 20 | 21 | @Override 22 | public Clipboard getClipboard() { 23 | return parent.getClipboard(); 24 | } 25 | 26 | @Override 27 | public void setTransform(Transform transform) { 28 | parent.setTransform(transform); 29 | } 30 | 31 | @Override 32 | public Transform getTransform() { 33 | return parent.getTransform(); 34 | } 35 | 36 | @Override 37 | public PasteBuilder createPaste(Extent targetExtent, WorldData targetWorldData) { 38 | return parent.createPaste(targetExtent, targetWorldData); 39 | } 40 | 41 | @Override 42 | public void close() { 43 | parent.close(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/util/command/CallableProcessor.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.util.command; 2 | 3 | import com.sk89q.minecraft.util.commands.CommandException; 4 | import com.sk89q.minecraft.util.commands.CommandLocals; 5 | import com.sk89q.worldedit.WorldEditException; 6 | 7 | public interface CallableProcessor { 8 | public Object process(CommandLocals locals, T value) throws CommandException, WorldEditException; 9 | 10 | 11 | 12 | } 13 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/util/command/DelegateCallable.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.util.command; 2 | 3 | import com.sk89q.minecraft.util.commands.CommandException; 4 | import com.sk89q.minecraft.util.commands.CommandLocals; 5 | import java.util.List; 6 | 7 | public class DelegateCallable implements CommandCallable { 8 | private final CommandCallable parent; 9 | 10 | public CommandCallable getParent() { 11 | return parent; 12 | } 13 | 14 | public DelegateCallable(CommandCallable parent) { 15 | this.parent = parent; 16 | } 17 | 18 | @Override 19 | public Object call(String arguments, CommandLocals locals, String[] parentCommands) throws CommandException { 20 | return parent.call(arguments, locals, parentCommands); 21 | } 22 | 23 | @Override 24 | public Description getDescription() { 25 | return parent.getDescription(); 26 | } 27 | 28 | @Override 29 | public boolean testPermission(CommandLocals locals) { 30 | return parent.testPermission(locals); 31 | } 32 | 33 | @Override 34 | public List getSuggestions(String arguments, CommandLocals locals) throws CommandException { 35 | return parent.getSuggestions(arguments, locals); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /core/src/main/java/com/sk89q/worldedit/util/command/ProcessedCallable.java: -------------------------------------------------------------------------------- 1 | package com.sk89q.worldedit.util.command; 2 | 3 | import com.sk89q.minecraft.util.commands.CommandException; 4 | import com.sk89q.minecraft.util.commands.CommandLocals; 5 | import com.sk89q.worldedit.WorldEditException; 6 | 7 | 8 | import static com.google.common.base.Preconditions.checkNotNull; 9 | 10 | public class ProcessedCallable extends DelegateCallable { 11 | private final CallableProcessor processor; 12 | 13 | public ProcessedCallable(CommandCallable parent, CallableProcessor processor) { 14 | super(parent); 15 | checkNotNull(processor); 16 | this.processor = processor; 17 | } 18 | 19 | @Override 20 | public Object call(String arguments, CommandLocals locals, String[] parentCommands) throws CommandException { 21 | try { 22 | return processor.process(locals, super.call(arguments, locals, parentCommands)); 23 | } catch (WorldEditException e) { 24 | throw new RuntimeException(e); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /core/src/main/java/net/jpountz/lz4/LZ4Decompressor.java: -------------------------------------------------------------------------------- 1 | package net.jpountz.lz4; 2 | 3 | /* 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @deprecated Use {@link LZ4FastDecompressor} instead. 19 | */ 20 | @Deprecated 21 | public interface LZ4Decompressor { 22 | 23 | int decompress(byte[] src, int srcOff, byte[] dest, int destOff, int destLen); 24 | 25 | } -------------------------------------------------------------------------------- /core/src/main/java/net/jpountz/lz4/LZ4Exception.java: -------------------------------------------------------------------------------- 1 | package net.jpountz.lz4; 2 | 3 | /* 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * LZ4 compression or decompression error. 19 | */ 20 | public class LZ4Exception extends RuntimeException { 21 | 22 | private static final long serialVersionUID = 1L; 23 | 24 | public LZ4Exception(String msg, Throwable t) { 25 | super(msg, t); 26 | } 27 | 28 | public LZ4Exception(String msg) { 29 | super(msg); 30 | } 31 | 32 | public LZ4Exception() { 33 | super(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/java/net/jpountz/lz4/LZ4StreamHelper.java: -------------------------------------------------------------------------------- 1 | package net.jpountz.lz4; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.io.OutputStream; 6 | 7 | public class LZ4StreamHelper { 8 | static void writeLength(int length, OutputStream os) throws IOException { 9 | int b1 = ((length & 0xff000000) >> 24); 10 | int b2 = ((length & 0x00ff0000) >> 16); 11 | int b3 = ((length & 0x0000ff00) >> 8); 12 | int b4 = (length & 0xff0000ff); 13 | os.write(b1); 14 | os.write(b2); 15 | os.write(b3); 16 | os.write(b4); 17 | } 18 | 19 | // network order, big endian, most significant byte first 20 | // package scope 21 | static int readLength(InputStream is) throws IOException { 22 | int b1 = is.read(); 23 | int b2 = is.read(); 24 | int b3 = is.read(); 25 | int b4 = is.read(); 26 | 27 | int length; 28 | if ((-1 == b1) || (-1 == b2) || (-1 == b3) || (-1 == b4)) { 29 | length = -1; 30 | } else { 31 | length = ((b1 << 24) | (b2 << 16) | (b3 << 8) | b4); 32 | } 33 | return length; 34 | } 35 | } -------------------------------------------------------------------------------- /core/src/main/java/net/jpountz/lz4/LZ4UnknownSizeDecompressor.java: -------------------------------------------------------------------------------- 1 | package net.jpountz.lz4; 2 | 3 | /* 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | /** 18 | * @deprecated Use {@link LZ4SafeDecompressor} instead. 19 | */ 20 | @Deprecated 21 | public interface LZ4UnknownSizeDecompressor { 22 | 23 | int decompress(byte[] src, int srcOff, int srcLen, byte[] dest, int destOff, int maxDestLen); 24 | 25 | int decompress(byte[] src, int srcOff, int srcLen, byte[] dest, int destOff); 26 | 27 | } -------------------------------------------------------------------------------- /core/src/main/java/net/jpountz/util/Utils.java: -------------------------------------------------------------------------------- 1 | package net.jpountz.util; 2 | 3 | /* 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import java.nio.ByteOrder; 18 | 19 | public enum Utils { 20 | ; 21 | 22 | public static final ByteOrder NATIVE_BYTE_ORDER = ByteOrder.nativeOrder(); 23 | 24 | private static final boolean unalignedAccessAllowed; 25 | 26 | static { 27 | String arch = System.getProperty("os.arch"); 28 | unalignedAccessAllowed = arch.equals("i386") || arch.equals("x86") 29 | || arch.equals("amd64") || arch.equals("x86_64"); 30 | } 31 | 32 | public static boolean isUnalignedAccessAllowed() { 33 | return unalignedAccessAllowed; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /core/src/main/resources/darwin/x86_64/liblz4-java.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/core/src/main/resources/darwin/x86_64/liblz4-java.dylib -------------------------------------------------------------------------------- /core/src/main/resources/extrablocks.json: -------------------------------------------------------------------------------- 1 | // Add blocks here if you need block names, rotation and textures to work 2 | // The following blocks are already bundled with FAWE: https://github.com/sk89q/WorldEdit/blob/master/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.json 3 | // To generating the blocks from forge mods see: 4 | // - https://github.com/wizjany/ForgeUtils 5 | // 6 | // Help with ForgeUtils: wizjany @ http://webchat.esper.net/?nick=&channels=sk89q 7 | [ 8 | 9 | ] -------------------------------------------------------------------------------- /core/src/main/resources/fawe.properties: -------------------------------------------------------------------------------- 1 | version=${version} 2 | -------------------------------------------------------------------------------- /core/src/main/resources/linux/amd64/liblz4-java.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/core/src/main/resources/linux/amd64/liblz4-java.so -------------------------------------------------------------------------------- /core/src/main/resources/linux/arm/liblz4-java.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/core/src/main/resources/linux/arm/liblz4-java.so -------------------------------------------------------------------------------- /core/src/main/resources/linux/i386/liblz4-java.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/core/src/main/resources/linux/i386/liblz4-java.so -------------------------------------------------------------------------------- /core/src/main/resources/linux/ppc64le/liblz4-java.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/core/src/main/resources/linux/ppc64le/liblz4-java.so -------------------------------------------------------------------------------- /core/src/main/resources/linux/s390x/liblz4-java.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/core/src/main/resources/linux/s390x/liblz4-java.so -------------------------------------------------------------------------------- /core/src/main/resources/win32/amd64/liblz4-java.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/core/src/main/resources/win32/amd64/liblz4-java.so -------------------------------------------------------------------------------- /core/src/main/resources/win32/x86/liblz4-java.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/core/src/main/resources/win32/x86/liblz4-java.so -------------------------------------------------------------------------------- /favs/build.gradle: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':bukkit') 3 | } 4 | 5 | clean { delete "../target" } 6 | 7 | processResources { 8 | from('src/main/resources') { 9 | include 'plugin.yml' 10 | expand( 11 | name: project.parent.name, 12 | version: project.parent.version 13 | ) 14 | } 15 | } 16 | 17 | jar.destinationDir = file '../target' 18 | jar.archiveName = "FastAsyncVoxelSniper-${project.name}-${parent.version}.jar" 19 | jar.doLast { task -> 20 | ant.checksum file: task.archivePath 21 | } -------------------------------------------------------------------------------- /favs/src/main/java/com/boydti/fawe/bukkit/favs/PatternUtil.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.bukkit.favs; 2 | 3 | import com.boydti.fawe.config.BBC; 4 | import com.boydti.fawe.object.FawePlayer; 5 | import com.sk89q.worldedit.WorldEdit; 6 | import com.sk89q.worldedit.extension.input.InputParseException; 7 | import com.sk89q.worldedit.extension.input.ParserContext; 8 | import com.sk89q.worldedit.function.pattern.Pattern; 9 | import com.thevoxelbox.voxelsniper.SnipeData; 10 | import org.bukkit.ChatColor; 11 | import org.bukkit.entity.Player; 12 | 13 | public class PatternUtil { 14 | public static Pattern parsePattern(Player player, SnipeData snipeData, String arg) { 15 | ParserContext context = new ParserContext(); 16 | FawePlayer fp = FawePlayer.wrap(player); 17 | context.setActor(fp.getPlayer()); 18 | context.setWorld(fp.getWorld()); 19 | context.setSession(fp.getSession()); 20 | try { 21 | Pattern pattern = WorldEdit.getInstance().getPatternFactory().parseFromInput(arg, context); 22 | snipeData.setPattern(pattern, arg); 23 | snipeData.sendMessage(ChatColor.GOLD + "Voxel: " + ChatColor.RED + arg); 24 | return pattern; 25 | } catch (InputParseException e) { 26 | fp.sendMessage(BBC.getPrefix() + e.getMessage()); 27 | return null; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /forge110/src/main/java/com/boydti/fawe/forge/ForgeCommand.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.forge; 2 | 3 | import com.boydti.fawe.object.FaweCommand; 4 | import com.boydti.fawe.object.FawePlayer; 5 | import net.minecraft.command.CommandBase; 6 | import net.minecraft.command.CommandException; 7 | import net.minecraft.command.ICommandSender; 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | import net.minecraft.server.MinecraftServer; 10 | 11 | public class ForgeCommand extends CommandBase { 12 | 13 | private final String name; 14 | private final FaweCommand cmd; 15 | 16 | public ForgeCommand(String name, FaweCommand cmd) { 17 | this.name = name; 18 | this.cmd = cmd; 19 | } 20 | 21 | @Override 22 | public String getCommandName() { 23 | return name; 24 | } 25 | 26 | @Override 27 | public String getCommandUsage(ICommandSender iCommandSender) { 28 | return "/" + name; 29 | } 30 | 31 | @Override 32 | public void execute(MinecraftServer minecraftServer, ICommandSender sender, String[] args) throws CommandException { 33 | if ((sender instanceof EntityPlayerMP)) { 34 | EntityPlayerMP player = (EntityPlayerMP) sender; 35 | if (player.worldObj.isRemote) { 36 | return; 37 | } 38 | FawePlayer fp = FawePlayer.wrap(player); 39 | cmd.executeSafe(fp, args); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /forge110/src/main/resources/config.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/forge110/src/main/resources/config.yml -------------------------------------------------------------------------------- /forge111/src/main/java/com/boydti/fawe/forge/ForgeCommand.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.forge; 2 | 3 | import com.boydti.fawe.object.FaweCommand; 4 | import com.boydti.fawe.object.FawePlayer; 5 | import net.minecraft.command.CommandBase; 6 | import net.minecraft.command.CommandException; 7 | import net.minecraft.command.ICommandSender; 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | import net.minecraft.server.MinecraftServer; 10 | 11 | public class ForgeCommand extends CommandBase { 12 | 13 | private final String name; 14 | private final FaweCommand cmd; 15 | 16 | public ForgeCommand(String name, FaweCommand cmd) { 17 | this.name = name; 18 | this.cmd = cmd; 19 | } 20 | 21 | @Override 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | @Override 27 | public String getUsage(ICommandSender iCommandSender) { 28 | return "/" + name; 29 | } 30 | 31 | @Override 32 | public void execute(MinecraftServer minecraftServer, ICommandSender sender, String[] args) throws CommandException { 33 | if ((sender instanceof EntityPlayerMP)) { 34 | EntityPlayerMP player = (EntityPlayerMP) sender; 35 | if (player.world.isRemote) { 36 | return; 37 | } 38 | FawePlayer fp = FawePlayer.wrap(player); 39 | cmd.executeSafe(fp, args); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /forge111/src/main/java/com/boydti/fawe/forge/MutableGenLayer.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.forge; 2 | 3 | import java.util.Arrays; 4 | import net.minecraft.world.gen.layer.GenLayer; 5 | import net.minecraft.world.gen.layer.IntCache; 6 | 7 | public class MutableGenLayer extends GenLayer { 8 | 9 | private int biome; 10 | 11 | public MutableGenLayer(long seed) { 12 | super(seed); 13 | } 14 | 15 | public MutableGenLayer set(int biome) { 16 | this.biome = biome; 17 | return this; 18 | } 19 | 20 | @Override 21 | public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { 22 | int[] biomes = IntCache.getIntCache(areaWidth * areaHeight); 23 | Arrays.fill(biomes, biome); 24 | return biomes; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /forge112/src/main/java/com/boydti/fawe/forge/ForgeCommand.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.forge; 2 | 3 | import com.boydti.fawe.object.FaweCommand; 4 | import com.boydti.fawe.object.FawePlayer; 5 | import net.minecraft.command.CommandBase; 6 | import net.minecraft.command.CommandException; 7 | import net.minecraft.command.ICommandSender; 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | import net.minecraft.server.MinecraftServer; 10 | 11 | public class ForgeCommand extends CommandBase { 12 | 13 | private final String name; 14 | private final FaweCommand cmd; 15 | 16 | public ForgeCommand(String name, FaweCommand cmd) { 17 | this.name = name; 18 | this.cmd = cmd; 19 | } 20 | 21 | @Override 22 | public String getName() { 23 | return name; 24 | } 25 | 26 | @Override 27 | public String getUsage(ICommandSender iCommandSender) { 28 | return "/" + name; 29 | } 30 | 31 | @Override 32 | public void execute(MinecraftServer minecraftServer, ICommandSender sender, String[] args) throws CommandException { 33 | if ((sender instanceof EntityPlayerMP)) { 34 | EntityPlayerMP player = (EntityPlayerMP) sender; 35 | if (player.world.isRemote) { 36 | return; 37 | } 38 | FawePlayer fp = FawePlayer.wrap(player); 39 | cmd.executeSafe(fp, args); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /forge112/src/main/java/com/boydti/fawe/forge/MutableGenLayer.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.forge; 2 | 3 | import java.util.Arrays; 4 | import net.minecraft.world.gen.layer.GenLayer; 5 | import net.minecraft.world.gen.layer.IntCache; 6 | 7 | public class MutableGenLayer extends GenLayer { 8 | 9 | private int biome; 10 | 11 | public MutableGenLayer(long seed) { 12 | super(seed); 13 | } 14 | 15 | public MutableGenLayer set(int biome) { 16 | this.biome = biome; 17 | return this; 18 | } 19 | 20 | @Override 21 | public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { 22 | int[] biomes = IntCache.getIntCache(areaWidth * areaHeight); 23 | Arrays.fill(biomes, biome); 24 | return biomes; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /forge1710/src/main/java/com/boydti/fawe/forge/ForgeCommand.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.forge; 2 | 3 | import com.boydti.fawe.object.FaweCommand; 4 | import com.boydti.fawe.object.FawePlayer; 5 | import net.minecraft.command.CommandBase; 6 | import net.minecraft.command.CommandException; 7 | import net.minecraft.command.ICommandSender; 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | 10 | public class ForgeCommand extends CommandBase { 11 | 12 | private final String name; 13 | private final FaweCommand cmd; 14 | 15 | public ForgeCommand(String name, FaweCommand cmd) { 16 | this.name = name; 17 | this.cmd = cmd; 18 | } 19 | 20 | @Override 21 | public String getCommandName() { 22 | return name; 23 | } 24 | 25 | @Override 26 | public String getCommandUsage(ICommandSender iCommandSender) { 27 | return "/" + name; 28 | } 29 | 30 | @Override 31 | public void processCommand(ICommandSender sender, String[] args) throws CommandException { 32 | if ((sender instanceof EntityPlayerMP)) { 33 | EntityPlayerMP player = (EntityPlayerMP) sender; 34 | if (player.worldObj.isRemote) { 35 | return; 36 | } 37 | FawePlayer fp = FawePlayer.wrap(player); 38 | cmd.executeSafe(fp, args); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /forge1710/src/main/resources/config.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/forge1710/src/main/resources/config.yml -------------------------------------------------------------------------------- /forge1710/src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [{ 2 | "modid": "com.boydti.fawe", 3 | "name": "FastAsyncWorldEdit", 4 | "description": "Extreme WorldEdit optimizations, no lag, low memory usage, area + tile + entity limits, block logging + rollback", 5 | "version": "3.5.1", 6 | "mcVersion": "1.7.10", 7 | "dependencies": [ 8 | "WorldEdit" 9 | ] 10 | }] -------------------------------------------------------------------------------- /forge189/src/main/java/com/boydti/fawe/forge/ForgeCommand.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.forge; 2 | 3 | import com.boydti.fawe.object.FaweCommand; 4 | import com.boydti.fawe.object.FawePlayer; 5 | import net.minecraft.command.CommandBase; 6 | import net.minecraft.command.CommandException; 7 | import net.minecraft.command.ICommandSender; 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | 10 | public class ForgeCommand extends CommandBase { 11 | 12 | private final String name; 13 | private final FaweCommand cmd; 14 | 15 | public ForgeCommand(String name, FaweCommand cmd) { 16 | this.name = name; 17 | this.cmd = cmd; 18 | } 19 | 20 | @Override 21 | public String getCommandName() { 22 | return name; 23 | } 24 | 25 | @Override 26 | public String getCommandUsage(ICommandSender iCommandSender) { 27 | return "/" + name; 28 | } 29 | 30 | @Override 31 | public void processCommand(ICommandSender sender, String[] args) throws CommandException { 32 | if ((sender instanceof EntityPlayerMP)) { 33 | EntityPlayerMP player = (EntityPlayerMP) sender; 34 | if (player.worldObj.isRemote) { 35 | return; 36 | } 37 | FawePlayer fp = FawePlayer.wrap(player); 38 | cmd.executeSafe(fp, args); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /forge189/src/main/resources/config.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/forge189/src/main/resources/config.yml -------------------------------------------------------------------------------- /forge194/src/main/java/com/boydti/fawe/forge/ForgeCommand.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.forge; 2 | 3 | import com.boydti.fawe.object.FaweCommand; 4 | import com.boydti.fawe.object.FawePlayer; 5 | import net.minecraft.command.CommandBase; 6 | import net.minecraft.command.CommandException; 7 | import net.minecraft.command.ICommandSender; 8 | import net.minecraft.entity.player.EntityPlayerMP; 9 | import net.minecraft.server.MinecraftServer; 10 | 11 | public class ForgeCommand extends CommandBase { 12 | 13 | private final String name; 14 | private final FaweCommand cmd; 15 | 16 | public ForgeCommand(String name, FaweCommand cmd) { 17 | this.name = name; 18 | this.cmd = cmd; 19 | } 20 | 21 | @Override 22 | public String getCommandName() { 23 | return name; 24 | } 25 | 26 | @Override 27 | public String getCommandUsage(ICommandSender iCommandSender) { 28 | return "/" + name; 29 | } 30 | 31 | @Override 32 | public void execute(MinecraftServer minecraftServer, ICommandSender sender, String[] args) throws CommandException { 33 | if ((sender instanceof EntityPlayerMP)) { 34 | EntityPlayerMP player = (EntityPlayerMP) sender; 35 | if (player.worldObj.isRemote) { 36 | return; 37 | } 38 | FawePlayer fp = FawePlayer.wrap(player); 39 | cmd.executeSafe(fp, args); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /forge194/src/main/resources/config.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/forge194/src/main/resources/config.yml -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | #org.gradle.java.home=C:/PROGRA~2/Java/jdk1.7.0_79 2 | #org.gradle.java.home=C:/PROGRA~1/Java/jdk1.8.0_51 3 | org.gradle.daemon=true 4 | org.gradle.configureondemand=true 5 | org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Feb 26 14:36:53 CET 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /nukkit/lib/leveldb.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/nukkit/lib/leveldb.jar -------------------------------------------------------------------------------- /nukkit/lib/nukkit-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/nukkit/lib/nukkit-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /nukkit/lib/worldedit-core-6.1.4-SNAPSHOT-dist.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/nukkit/lib/worldedit-core-6.1.4-SNAPSHOT-dist.jar -------------------------------------------------------------------------------- /nukkit/src/main/java/com/boydti/fawe/nukkit/core/CommandInfo.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.nukkit.core; 2 | 3 | 4 | public class CommandInfo { 5 | 6 | private final String[] aliases; 7 | private final String usage, desc; 8 | private final String[] permissions; 9 | 10 | public CommandInfo(String usage, String desc, String[] aliases) { 11 | this(usage, desc, aliases, null); 12 | } 13 | 14 | public CommandInfo(String usage, String desc, String[] aliases, String[] permissions) { 15 | this.usage = usage; 16 | this.desc = desc; 17 | this.aliases = aliases; 18 | this.permissions = permissions; 19 | } 20 | 21 | public String[] getAliases() { 22 | return aliases; 23 | } 24 | 25 | public String getName() { 26 | return aliases[0]; 27 | } 28 | 29 | public String getUsage() { 30 | return usage; 31 | } 32 | 33 | public String getDesc() { 34 | return desc; 35 | } 36 | 37 | public String[] getPermissions() { 38 | return permissions; 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /nukkit/src/main/java/com/boydti/fawe/nukkit/core/NukkitCommandManager.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.nukkit.core; 2 | 3 | import cn.nukkit.command.CommandExecutor; 4 | import cn.nukkit.command.SimpleCommandMap; 5 | import cn.nukkit.plugin.Plugin; 6 | 7 | public class NukkitCommandManager { 8 | private final SimpleCommandMap commandMap; 9 | 10 | public NukkitCommandManager(SimpleCommandMap map) { 11 | this.commandMap = map; 12 | } 13 | 14 | public boolean register(CommandInfo command, Plugin plugin, CommandExecutor executor) { 15 | if (command == null || commandMap == null) { 16 | return false; 17 | } 18 | DynamicPluginCommand cmd = new DynamicPluginCommand( 19 | command.getAliases(), 20 | command.getDesc(), "/" + command.getAliases()[0] + " " + command.getUsage(), 21 | executor, 22 | plugin); 23 | cmd.setPermissions(command.getPermissions()); 24 | for (String alias : command.getAliases()) { 25 | commandMap.register(alias, cmd); 26 | } 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /nukkit/src/main/java/com/boydti/fawe/nukkit/core/gui/DelegateFormWindow.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.nukkit.core.gui; 2 | 3 | import cn.nukkit.form.response.FormResponse; 4 | import cn.nukkit.form.window.FormWindow; 5 | 6 | public class DelegateFormWindow extends FormWindow { 7 | private final FormWindow parent; 8 | 9 | public DelegateFormWindow(FormWindow parent) { 10 | this.parent = parent; 11 | } 12 | @Override 13 | public String getJSONData() { 14 | return parent.getJSONData(); 15 | } 16 | 17 | @Override 18 | public void setResponse(String s) { 19 | parent.setResponse(s); 20 | } 21 | 22 | @Override 23 | public FormResponse getResponse() { 24 | return parent.getResponse(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /nukkit/src/main/java/com/boydti/fawe/nukkit/core/gui/ResponseFormWindow.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.nukkit.core.gui; 2 | 3 | import cn.nukkit.form.window.FormWindow; 4 | import java.util.Map; 5 | import java.util.function.Consumer; 6 | 7 | 8 | import static com.google.common.base.Preconditions.checkNotNull; 9 | 10 | public class ResponseFormWindow extends DelegateFormWindow { 11 | private final Consumer> task; 12 | 13 | public ResponseFormWindow(FormWindow parent, Consumer> onResponse) { 14 | super(parent); 15 | checkNotNull(onResponse); 16 | this.task = onResponse; 17 | } 18 | 19 | public void respond(Map response) { 20 | if (task != null) task.accept(response); 21 | } 22 | } -------------------------------------------------------------------------------- /nukkit/src/main/java/com/boydti/fawe/nukkit/optimization/NukkitCommand.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.nukkit.optimization; 2 | 3 | import cn.nukkit.command.Command; 4 | import cn.nukkit.command.CommandSender; 5 | import com.boydti.fawe.Fawe; 6 | import com.boydti.fawe.config.BBC; 7 | import com.boydti.fawe.object.FaweCommand; 8 | import com.boydti.fawe.object.FawePlayer; 9 | 10 | public class NukkitCommand extends Command { 11 | 12 | private final FaweCommand cmd; 13 | 14 | public NukkitCommand(String lavel, final FaweCommand cmd) { 15 | super(lavel); 16 | this.cmd = cmd; 17 | } 18 | 19 | @Override 20 | public boolean execute(CommandSender sender, String label, String[] args) { 21 | final FawePlayer plr = Fawe.imp().wrap(sender); 22 | if (!sender.hasPermission(this.cmd.getPerm()) && !sender.isOp()) { 23 | BBC.NO_PERM.send(plr, this.cmd.getPerm()); 24 | return true; 25 | } 26 | this.cmd.executeSafe(plr, args); 27 | return true; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /nukkit/src/main/resources/axe-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/nukkit/src/main/resources/axe-logo.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'FastAsyncWorldEdit' 2 | 3 | include 'core', 'bukkit', 'favs'//, 'nukkit', 'forge189', 'forge194', 'forge110', 'forge111', 'forge112', 'sponge111', 'sponge112'//, 'forge1710' 4 | -------------------------------------------------------------------------------- /sponge111/.gitignore: -------------------------------------------------------------------------------- 1 | /.gradle/ 2 | /bin/ 3 | -------------------------------------------------------------------------------- /sponge111/lib/worldedit-core-6.1.7-SNAPSHOT-dist.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/sponge111/lib/worldedit-core-6.1.7-SNAPSHOT-dist.jar -------------------------------------------------------------------------------- /sponge111/src/main/java/com/boydti/fawe/sponge/v1_11/MutableGenLayer.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.sponge.v1_11; 2 | 3 | import java.util.Arrays; 4 | import net.minecraft.world.gen.layer.GenLayer; 5 | import net.minecraft.world.gen.layer.IntCache; 6 | 7 | public class MutableGenLayer extends GenLayer { 8 | 9 | private int biome; 10 | 11 | public MutableGenLayer(long seed) { 12 | super(seed); 13 | } 14 | 15 | public MutableGenLayer set(int biome) { 16 | this.biome = biome; 17 | return this; 18 | } 19 | 20 | @Override 21 | public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { 22 | int[] biomes = IntCache.getIntCache(areaWidth * areaHeight); 23 | Arrays.fill(biomes, biome); 24 | return biomes; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sponge111/src/main/resources/config.yml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/sponge111/src/main/resources/config.yml -------------------------------------------------------------------------------- /sponge112/lib/worldedit-core-6.1.9-SNAPSHOT-dist.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/sponge112/lib/worldedit-core-6.1.9-SNAPSHOT-dist.jar -------------------------------------------------------------------------------- /sponge112/lib/worldedit-sponge-6.1.9-SNAPSHOT-dist.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/boy0001/FastAsyncWorldedit/a693d23489da13f2a59fe31794abd9c74b4ac352/sponge112/lib/worldedit-sponge-6.1.9-SNAPSHOT-dist.jar -------------------------------------------------------------------------------- /sponge112/src/main/java/com/boydti/fawe/sponge/v1_12/MutableGenLayer.java: -------------------------------------------------------------------------------- 1 | package com.boydti.fawe.sponge.v1_12; 2 | 3 | import java.util.Arrays; 4 | import net.minecraft.world.gen.layer.GenLayer; 5 | import net.minecraft.world.gen.layer.IntCache; 6 | 7 | public class MutableGenLayer extends GenLayer { 8 | 9 | private int biome; 10 | 11 | public MutableGenLayer(long seed) { 12 | super(seed); 13 | } 14 | 15 | public MutableGenLayer set(int biome) { 16 | this.biome = biome; 17 | return this; 18 | } 19 | 20 | @Override 21 | public int[] getInts(int areaX, int areaY, int areaWidth, int areaHeight) { 22 | int[] biomes = IntCache.getIntCache(areaWidth * areaHeight); 23 | Arrays.fill(biomes, biome); 24 | return biomes; 25 | } 26 | } 27 | --------------------------------------------------------------------------------