├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yml └── workflows │ └── gradle.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENCE.txt ├── LICENSE_TC_OLD.txt ├── README.md ├── build.gradle ├── common ├── common-config │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── pg85 │ │ └── otg │ │ └── config │ │ ├── ConfigFile.java │ │ ├── ConfigFunction.java │ │ ├── ErroredFunction.java │ │ ├── biome │ │ ├── BiomeConfigFinder.java │ │ ├── BiomeGroup.java │ │ ├── BiomeGroupManager.java │ │ ├── BiomeResourceBase.java │ │ ├── BiomeResourcesManager.java │ │ └── TemplateBiome.java │ │ ├── io │ │ ├── FileSettingsReader.java │ │ ├── FileSettingsWriter.java │ │ ├── IConfigFunctionProvider.java │ │ ├── RawSettingValue.java │ │ ├── SettingsMap.java │ │ └── SimpleSettingsMap.java │ │ ├── settingType │ │ ├── BooleanSetting.java │ │ ├── ColorSetSetting.java │ │ ├── ColorSetting.java │ │ ├── DoubleArraySetting.java │ │ ├── DoubleSetting.java │ │ ├── EnumSetting.java │ │ ├── FloatSetting.java │ │ ├── IntSetting.java │ │ ├── LongSetting.java │ │ ├── MaterialListSetting.java │ │ ├── MaterialSetSetting.java │ │ ├── MaterialSetting.java │ │ ├── MobGroupListSetting.java │ │ ├── ReplaceBlocksListSetting.java │ │ ├── ReplacedBlocksSetting.java │ │ ├── RotationSetting.java │ │ ├── Setting.java │ │ ├── Settings.java │ │ ├── StringListSetting.java │ │ └── StringSetting.java │ │ └── standard │ │ ├── BiomeStandardValues.java │ │ ├── PluginConfigStandardValues.java │ │ └── WorldStandardValues.java ├── common-core │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── pg85 │ │ └── otg │ │ ├── OTG.java │ │ ├── OTGEngine.java │ │ ├── config │ │ ├── PluginConfig.java │ │ ├── PluginConfigBase.java │ │ ├── biome │ │ │ ├── BiomeConfig.java │ │ │ └── BiomeConfigBase.java │ │ ├── dimensions │ │ │ └── DimensionConfig.java │ │ └── world │ │ │ ├── WorldConfig.java │ │ │ └── WorldConfigBase.java │ │ ├── gen │ │ ├── OTGChunkDecorator.java │ │ └── OTGChunkGenerator.java │ │ └── presets │ │ ├── LocalPresetLoader.java │ │ └── Preset.java ├── common-customobject │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── pg85 │ │ └── otg │ │ └── customobject │ │ ├── CustomObject.java │ │ ├── CustomObjectCollection.java │ │ ├── CustomObjectLoader.java │ │ ├── CustomObjectManager.java │ │ ├── SpawnableObject.java │ │ ├── TreeObject.java │ │ ├── bo2 │ │ ├── BO2.java │ │ ├── BO2Loader.java │ │ ├── BO2Settings.java │ │ └── ObjectCoordinate.java │ │ ├── bo3 │ │ ├── BO3.java │ │ ├── BO3Config.java │ │ ├── BO3Loader.java │ │ ├── BO3Settings.java │ │ ├── ObjectExtrusionHelper.java │ │ ├── bo3function │ │ │ ├── BO3BlockFunction.java │ │ │ ├── BO3BranchFunction.java │ │ │ ├── BO3EntityFunction.java │ │ │ ├── BO3MinecraftObjectFunction.java │ │ │ ├── BO3RandomBlockFunction.java │ │ │ └── BO3WeightedBranchFunction.java │ │ └── checks │ │ │ ├── BO3Check.java │ │ │ ├── BlockCheck.java │ │ │ ├── BlockCheckNot.java │ │ │ ├── LightCheck.java │ │ │ ├── ModCheck.java │ │ │ └── ModCheckNot.java │ │ ├── bo4 │ │ ├── BO4.java │ │ ├── BO4Config.java │ │ ├── BO4Data.java │ │ ├── BO4Loader.java │ │ ├── BO4Settings.java │ │ └── bo4function │ │ │ ├── BO4BlockFunction.java │ │ │ ├── BO4BranchFunction.java │ │ │ ├── BO4BranchNode.java │ │ │ ├── BO4EntityFunction.java │ │ │ ├── BO4RandomBlockFunction.java │ │ │ └── BO4WeightedBranchFunction.java │ │ ├── bofunctions │ │ ├── BlockFunction.java │ │ ├── BranchFunction.java │ │ ├── BranchNode.java │ │ ├── EntityFunction.java │ │ └── MinecraftObjectFunction.java │ │ ├── config │ │ ├── CustomObjectConfigFile.java │ │ ├── CustomObjectConfigFunction.java │ │ ├── CustomObjectErroredFunction.java │ │ ├── CustomObjectResourcesManager.java │ │ └── io │ │ │ ├── FileSettingsReaderBO4.java │ │ │ ├── FileSettingsWriterBO4.java │ │ │ ├── SettingsReaderBO4.java │ │ │ └── SettingsWriterBO4.java │ │ ├── creator │ │ ├── Extractor.java │ │ ├── ObjectCreator.java │ │ └── ObjectType.java │ │ ├── resource │ │ ├── CustomObjectResource.java │ │ ├── CustomStructureResource.java │ │ ├── ICustomObjectResource.java │ │ ├── ICustomStructureResource.java │ │ ├── SaplingResource.java │ │ └── TreeResource.java │ │ ├── structures │ │ ├── Branch.java │ │ ├── CustomStructure.java │ │ ├── CustomStructureCache.java │ │ ├── CustomStructureCoordinate.java │ │ ├── CustomStructureFileManager.java │ │ ├── EntitiesManager.java │ │ ├── PlottedChunksRegion.java │ │ ├── StructureDataRegion.java │ │ ├── StructuredCustomObject.java │ │ ├── bo3 │ │ │ ├── BO3CustomStructure.java │ │ │ └── BO3CustomStructureCoordinate.java │ │ └── bo4 │ │ │ ├── BO4CustomStructure.java │ │ │ ├── BO4CustomStructureCoordinate.java │ │ │ ├── BranchDataItem.java │ │ │ ├── CustomStructurePlaceHolder.java │ │ │ ├── CustomStructurePlotter.java │ │ │ └── smoothing │ │ │ ├── BlockCoordsAndNeighbours.java │ │ │ ├── SmoothingAreaBlock.java │ │ │ ├── SmoothingAreaColumn.java │ │ │ ├── SmoothingAreaGenerator.java │ │ │ └── SmoothingAreaLine.java │ │ └── util │ │ ├── BO3Enums.java │ │ ├── BoundingBox.java │ │ └── Corner.java ├── common-generator │ ├── build.gradle │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── pg85 │ │ └── otg │ │ └── gen │ │ ├── biome │ │ ├── BiomeData.java │ │ ├── CachedBiomeProvider.java │ │ └── layers │ │ │ ├── AddIslandsLayer.java │ │ │ ├── ApplyOceanLayer.java │ │ │ ├── BeforeGroupsLayer.java │ │ │ ├── BiomeBorderLayer.java │ │ │ ├── BiomeGroupLayer.java │ │ │ ├── BiomeIsleLayer.java │ │ │ ├── BiomeLayer.java │ │ │ ├── BiomeLayerBase.java │ │ │ ├── BiomeLayerData.java │ │ │ ├── BiomeLayers.java │ │ │ ├── FinalizeLayer.java │ │ │ ├── FinalizeWithRiverLayer.java │ │ │ ├── FromImageLayer.java │ │ │ ├── FuzzyScaleLayer.java │ │ │ ├── IceLayer.java │ │ │ ├── InitializationLayer.java │ │ │ ├── LandLayer.java │ │ │ ├── MergeOceanTemperatureLayer.java │ │ │ ├── NewBiomeGroup.java │ │ │ ├── OceanTemperatureLayer.java │ │ │ ├── RiverInitLayer.java │ │ │ ├── RiverLayer.java │ │ │ ├── ScaleLayer.java │ │ │ ├── type │ │ │ ├── CrossSamplingLayer.java │ │ │ ├── DiagonalCrossSamplingLayer.java │ │ │ ├── InitLayer.java │ │ │ ├── MergingLayer.java │ │ │ └── ParentedLayer.java │ │ │ └── util │ │ │ ├── CachingLayerContext.java │ │ │ ├── CachingLayerSampler.java │ │ │ ├── LayerFactory.java │ │ │ ├── LayerOperator.java │ │ │ ├── LayerRandomnessSource.java │ │ │ └── LayerSampleContext.java │ │ ├── carver │ │ ├── Carver.java │ │ ├── CaveCarver.java │ │ └── RavineCarver.java │ │ ├── noise │ │ ├── OctavePerlinNoiseSampler.java │ │ ├── OctaveSimplexNoiseSampler.java │ │ ├── PerlinNoiseSampler.java │ │ ├── SimplexNoiseSampler.java │ │ └── legacy │ │ │ ├── NoiseGeneratorPerlin.java │ │ │ ├── NoiseGeneratorPerlinMesaBlocks.java │ │ │ ├── NoiseGeneratorPerlinOctaves.java │ │ │ ├── NoiseGeneratorSimplex.java │ │ │ ├── NoiseGeneratorSurfacePatch.java │ │ │ └── NoiseGeneratorSurfacePatchOctaves.java │ │ ├── resource │ │ ├── AboveWaterResource.java │ │ ├── BambooResource.java │ │ ├── BasaltColumnResource.java │ │ ├── BoulderResource.java │ │ ├── CactusResource.java │ │ ├── CoralClawResource.java │ │ ├── CoralMushroomResource.java │ │ ├── CoralTreeResource.java │ │ ├── DungeonResource.java │ │ ├── FossilResource.java │ │ ├── FrequencyResourceBase.java │ │ ├── GrassResource.java │ │ ├── IBasicResource.java │ │ ├── IceSpikeResource.java │ │ ├── IcebergResource.java │ │ ├── KelpResource.java │ │ ├── LiquidResource.java │ │ ├── OreResource.java │ │ ├── PlantResource.java │ │ ├── ReedResource.java │ │ ├── RegistryResource.java │ │ ├── SeaGrassResource.java │ │ ├── SeaPickleResource.java │ │ ├── SmallLakeResource.java │ │ ├── SurfacePatchResource.java │ │ ├── UnderWaterOreResource.java │ │ ├── UnderWaterPlantResource.java │ │ ├── UndergroundLakeResource.java │ │ ├── Vein.java │ │ ├── VeinResource.java │ │ ├── VinesResource.java │ │ ├── WellResource.java │ │ └── util │ │ │ ├── BerryBush.java │ │ │ ├── CoralHelper.java │ │ │ └── PositionHelper.java │ │ └── surface │ │ ├── FrozenSurfaceHelper.java │ │ ├── IcebergSurfaceGenerator.java │ │ ├── MesaSurfaceGenerator.java │ │ ├── MultipleLayersSurfaceGenerator.java │ │ ├── MultipleLayersSurfaceGeneratorLayer.java │ │ ├── SimpleSurfaceGenerator.java │ │ ├── SurfaceGenerator.java │ │ └── SurfaceGeneratorSetting.java └── common-util │ ├── build.gradle │ └── src │ └── main │ └── java │ └── com │ └── pg85 │ └── otg │ ├── constants │ ├── Constants.java │ └── SettingsEnums.java │ ├── exceptions │ └── InvalidConfigException.java │ ├── interfaces │ ├── IBiome.java │ ├── IBiomeConfig.java │ ├── IBiomeRegistryProvider.java │ ├── IBiomeResourceLocation.java │ ├── ICachedBiomeProvider.java │ ├── IChunkDecorator.java │ ├── ICustomObject.java │ ├── ICustomObjectManager.java │ ├── ICustomObjectResourcesManager.java │ ├── ICustomStructureGen.java │ ├── IEntityFunction.java │ ├── ILayerSampler.java │ ├── ILayerSource.java │ ├── ILogger.java │ ├── IMaterialReader.java │ ├── IModLoadedChecker.java │ ├── IPluginConfig.java │ ├── ISaplingSpawner.java │ ├── IStructuredCustomObject.java │ ├── ISurfaceGeneratorNoiseProvider.java │ ├── IWorldConfig.java │ └── IWorldGenRegion.java │ └── util │ ├── BlockPos2D.java │ ├── ChunkCoordinate.java │ ├── CompressionUtils.java │ ├── FifoMap.java │ ├── MutableBoolean.java │ ├── OTGDirection.java │ ├── Pair.java │ ├── biome │ ├── ColorSet.java │ ├── ColorThreshold.java │ ├── MCBiomeResourceLocation.java │ ├── OTGBiomeResourceLocation.java │ ├── ReplaceBlockMatrix.java │ ├── ReplaceBlocks.java │ ├── SimpleColorSet.java │ └── WeightedMobSpawnGroup.java │ ├── bo3 │ └── Rotation.java │ ├── gen │ ├── ChunkBuffer.java │ ├── DecorationArea.java │ ├── DecorationBiomeCache.java │ ├── GeneratingChunk.java │ ├── JigsawStructureData.java │ └── LocalWorldGenRegion.java │ ├── helpers │ ├── MathHelper.java │ ├── RandomHelper.java │ ├── StreamHelper.java │ └── StringHelper.java │ ├── logging │ ├── LogCategory.java │ ├── LogLevel.java │ └── Logger.java │ ├── materials │ ├── LocalMaterialBase.java │ ├── LocalMaterialData.java │ ├── LocalMaterialTag.java │ ├── LocalMaterials.java │ ├── MaterialProperties.java │ ├── MaterialProperty.java │ ├── MaterialSet.java │ └── MaterialSetEntry.java │ ├── minecraft │ ├── BiomeRegistryNames.java │ ├── BlockNames.java │ ├── DefaultStructurePart.java │ ├── EntityCategory.java │ ├── EntityNames.java │ ├── PlantType.java │ ├── SaplingType.java │ └── TreeType.java │ └── nbt │ ├── LocalNBTHelper.java │ ├── NBTHelper.java │ └── NamedBinaryTag.java ├── extra └── eclipse │ └── terraincontrol_eclipse_formatter.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── logo.png ├── platforms ├── fabric │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── pg85 │ │ │ └── otg │ │ │ └── fabric │ │ │ └── OTGPlugin.java │ │ └── resources │ │ ├── OTGlogo.png │ │ ├── fabric.mod.json │ │ └── otg-fabric.mixins.json ├── forge │ ├── .gitattributes │ ├── LICENSE.txt │ ├── README.txt │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── pg85 │ │ │ └── otg │ │ │ └── forge │ │ │ ├── ForgeEngine.java │ │ │ ├── OTGPlugin.java │ │ │ ├── api │ │ │ └── OTGForgeAPI.java │ │ │ ├── biome │ │ │ ├── ForgeBiome.java │ │ │ └── OTGBiomeProvider.java │ │ │ ├── client │ │ │ └── MultipleColorHandler.java │ │ │ ├── commands │ │ │ ├── BaseCommand.java │ │ │ ├── BiomeCommand.java │ │ │ ├── DataCommand.java │ │ │ ├── EditCommand.java │ │ │ ├── ExportBO4DataCommand.java │ │ │ ├── ExportCommand.java │ │ │ ├── FlushCommand.java │ │ │ ├── HelpCommand.java │ │ │ ├── MapCommand.java │ │ │ ├── OTGCommand.java │ │ │ ├── ObjectUtils.java │ │ │ ├── PresetCommand.java │ │ │ ├── RegionCommand.java │ │ │ ├── SpawnCommand.java │ │ │ ├── StructureCommand.java │ │ │ ├── TpCommand.java │ │ │ ├── UpdateCommand.java │ │ │ ├── WorldEditUtil.java │ │ │ └── arguments │ │ │ │ ├── BiomeObjectArgument.java │ │ │ │ ├── FlagsArgument.java │ │ │ │ └── PresetArgument.java │ │ │ ├── dimensions │ │ │ ├── OTGChunkGeneratorFactory.java │ │ │ ├── OTGDimensionType.java │ │ │ ├── OTGWorldType.java │ │ │ └── portals │ │ │ │ ├── OTGCapabilities.java │ │ │ │ ├── OTGPlayer.java │ │ │ │ ├── OTGPlayerProvider.java │ │ │ │ ├── OTGPortalBlock.java │ │ │ │ ├── OTGPortalBlocks.java │ │ │ │ ├── OTGPortalColors.java │ │ │ │ ├── OTGPortalPois.java │ │ │ │ └── OTGTeleporter.java │ │ │ ├── event │ │ │ ├── BlockHandler.java │ │ │ ├── ClientFogHandler.java │ │ │ ├── GuiHandler.java │ │ │ ├── PlayerHandler.java │ │ │ ├── SaplingHandler.java │ │ │ └── WorldHandler.java │ │ │ ├── gen │ │ │ ├── ForgeChunkBuffer.java │ │ │ ├── ForgeWorldGenRegion.java │ │ │ ├── MCWorldGenRegion.java │ │ │ ├── OTGNoiseChunkGenerator.java │ │ │ └── ShadowChunkGenerator.java │ │ │ ├── gui │ │ │ ├── OTGGui.java │ │ │ └── screens │ │ │ │ ├── CreateOTGDimensionsScreen.java │ │ │ │ ├── ModpackCreateWorldScreen.java │ │ │ │ ├── OTGCustomiseOverworldScreen.java │ │ │ │ ├── OTGDimensionSettingsContainer.java │ │ │ │ ├── OTGWorldOptionsScreen.java │ │ │ │ └── SelectOTGPresetScreen.java │ │ │ ├── materials │ │ │ ├── ForgeLegacyMaterials.java │ │ │ ├── ForgeMaterialData.java │ │ │ ├── ForgeMaterialReader.java │ │ │ ├── ForgeMaterialTag.java │ │ │ └── ForgeMaterials.java │ │ │ ├── mixin │ │ │ ├── MixinChunkManager.java │ │ │ ├── MixinConfigPlugin.java │ │ │ ├── MixinSpawnLocationHelper.java │ │ │ └── MixinStructure.java │ │ │ ├── network │ │ │ ├── AcknowledgeOTGMessage.java │ │ │ ├── BiomeSettingSyncWrapper.java │ │ │ ├── OTGClientSyncManager.java │ │ │ ├── OTGLoginMessage.java │ │ │ └── PacketSyncBiomeSettings.java │ │ │ ├── presets │ │ │ └── ForgePresetLoader.java │ │ │ └── util │ │ │ ├── ForgeLogger.java │ │ │ ├── ForgeModLoadedChecker.java │ │ │ └── ForgeNBTHelper.java │ │ └── resources │ │ ├── META-INF │ │ ├── accesstransformer.cfg │ │ └── mods.toml │ │ ├── OTGlogo.png │ │ ├── assets │ │ └── otg │ │ │ ├── blockstates │ │ │ ├── portalotg.json │ │ │ ├── portalotg_beige.json │ │ │ ├── portalotg_black.json │ │ │ ├── portalotg_blue.json │ │ │ ├── portalotg_crystalblue.json │ │ │ ├── portalotg_darkblue.json │ │ │ ├── portalotg_darkgreen.json │ │ │ ├── portalotg_darkred.json │ │ │ ├── portalotg_emerald.json │ │ │ ├── portalotg_flame.json │ │ │ ├── portalotg_gold.json │ │ │ ├── portalotg_green.json │ │ │ ├── portalotg_grey.json │ │ │ ├── portalotg_lightblue.json │ │ │ ├── portalotg_lightgreen.json │ │ │ ├── portalotg_orange.json │ │ │ ├── portalotg_pink.json │ │ │ ├── portalotg_red.json │ │ │ ├── portalotg_white.json │ │ │ └── portalotg_yellow.json │ │ │ ├── lang │ │ │ └── en_us.json │ │ │ ├── models │ │ │ └── block │ │ │ │ ├── portalotg_beige_ew.json │ │ │ │ ├── portalotg_beige_ns.json │ │ │ │ ├── portalotg_black_ew.json │ │ │ │ ├── portalotg_black_ns.json │ │ │ │ ├── portalotg_blue_ew.json │ │ │ │ ├── portalotg_blue_ns.json │ │ │ │ ├── portalotg_crystalblue_ew.json │ │ │ │ ├── portalotg_crystalblue_ns.json │ │ │ │ ├── portalotg_darkblue_ew.json │ │ │ │ ├── portalotg_darkblue_ns.json │ │ │ │ ├── portalotg_darkgreen_ew.json │ │ │ │ ├── portalotg_darkgreen_ns.json │ │ │ │ ├── portalotg_darkred_ew.json │ │ │ │ ├── portalotg_darkred_ns.json │ │ │ │ ├── portalotg_emerald_ew.json │ │ │ │ ├── portalotg_emerald_ns.json │ │ │ │ ├── portalotg_ew.json │ │ │ │ ├── portalotg_flame_ew.json │ │ │ │ ├── portalotg_flame_ns.json │ │ │ │ ├── portalotg_gold_ew.json │ │ │ │ ├── portalotg_gold_ns.json │ │ │ │ ├── portalotg_green_ew.json │ │ │ │ ├── portalotg_green_ns.json │ │ │ │ ├── portalotg_grey_ew.json │ │ │ │ ├── portalotg_grey_ns.json │ │ │ │ ├── portalotg_lightblue_ew.json │ │ │ │ ├── portalotg_lightblue_ns.json │ │ │ │ ├── portalotg_lightgreen_ew.json │ │ │ │ ├── portalotg_lightgreen_ns.json │ │ │ │ ├── portalotg_ns.json │ │ │ │ ├── portalotg_orange_ew.json │ │ │ │ ├── portalotg_orange_ns.json │ │ │ │ ├── portalotg_pink_ew.json │ │ │ │ ├── portalotg_pink_ns.json │ │ │ │ ├── portalotg_red_ew.json │ │ │ │ ├── portalotg_red_ns.json │ │ │ │ ├── portalotg_white_ew.json │ │ │ │ ├── portalotg_white_ns.json │ │ │ │ ├── portalotg_yellow_ew.json │ │ │ │ └── portalotg_yellow_ns.json │ │ │ └── textures │ │ │ └── blocks │ │ │ ├── portalotg.png │ │ │ ├── portalotg.png.mcmeta │ │ │ ├── portalotg_beige.png │ │ │ ├── portalotg_beige.png.mcmeta │ │ │ ├── portalotg_black.png │ │ │ ├── portalotg_black.png.mcmeta │ │ │ ├── portalotg_blue.png │ │ │ ├── portalotg_blue.png.mcmeta │ │ │ ├── portalotg_crystalblue.png │ │ │ ├── portalotg_crystalblue.png.mcmeta │ │ │ ├── portalotg_darkblue.png │ │ │ ├── portalotg_darkblue.png.mcmeta │ │ │ ├── portalotg_darkgreen.png │ │ │ ├── portalotg_darkgreen.png.mcmeta │ │ │ ├── portalotg_darkred.png │ │ │ ├── portalotg_darkred.png.mcmeta │ │ │ ├── portalotg_emerald.png │ │ │ ├── portalotg_emerald.png.mcmeta │ │ │ ├── portalotg_flame.png │ │ │ ├── portalotg_flame.png.mcmeta │ │ │ ├── portalotg_gold.png │ │ │ ├── portalotg_gold.png.mcmeta │ │ │ ├── portalotg_green.png │ │ │ ├── portalotg_green.png.mcmeta │ │ │ ├── portalotg_grey.png │ │ │ ├── portalotg_grey.png.mcmeta │ │ │ ├── portalotg_lightblue.png │ │ │ ├── portalotg_lightblue.png.mcmeta │ │ │ ├── portalotg_lightgreen.png │ │ │ ├── portalotg_lightgreen.png.mcmeta │ │ │ ├── portalotg_orange.png │ │ │ ├── portalotg_orange.png.mcmeta │ │ │ ├── portalotg_pink.png │ │ │ ├── portalotg_pink.png.mcmeta │ │ │ ├── portalotg_red.png │ │ │ ├── portalotg_red.png.mcmeta │ │ │ ├── portalotg_white.png │ │ │ ├── portalotg_white.png.mcmeta │ │ │ ├── portalotg_yellow.png │ │ │ └── portalotg_yellow.png.mcmeta │ │ ├── otg.mixins.json │ │ └── pack.mcmeta └── spigot │ ├── build.gradle │ └── src │ └── main │ ├── java │ └── com │ │ └── pg85 │ │ └── otg │ │ └── spigot │ │ ├── OTGPlugin.java │ │ ├── SpigotEngine.java │ │ ├── api │ │ └── OTGSpigotAPI.java │ │ ├── biome │ │ ├── OTGBiomeProvider.java │ │ └── SpigotBiome.java │ │ ├── commands │ │ ├── BaseCommand.java │ │ ├── BiomeCommand.java │ │ ├── CancelEditCommand.java │ │ ├── CommandUtil.java │ │ ├── DataCommand.java │ │ ├── EditCommand.java │ │ ├── ExportBO4DataCommand.java │ │ ├── ExportCommand.java │ │ ├── FinishEditCommand.java │ │ ├── FlushCommand.java │ │ ├── HelpCommand.java │ │ ├── MapCommand.java │ │ ├── OTGCommandExecutor.java │ │ ├── ObjectUtils.java │ │ ├── PresetCommand.java │ │ ├── RegionCommand.java │ │ ├── SpawnCommand.java │ │ ├── StructureCommand.java │ │ ├── TpCommand.java │ │ └── WorldEditUtil.java │ │ ├── events │ │ ├── OTGHandler.java │ │ └── SaplingHandler.java │ │ ├── gen │ │ ├── MCWorldGenRegion.java │ │ ├── OTGNoiseChunkGenerator.java │ │ ├── OTGSpigotChunkGen.java │ │ ├── ShadowChunkGenerator.java │ │ ├── SpigotChunkBuffer.java │ │ └── SpigotWorldGenRegion.java │ │ ├── materials │ │ ├── SpigotLegacyMaterials.java │ │ ├── SpigotMaterialData.java │ │ ├── SpigotMaterialReader.java │ │ ├── SpigotMaterialTag.java │ │ └── SpigotMaterials.java │ │ ├── networking │ │ ├── BiomeSettingSyncWrapper.java │ │ ├── NetworkingListener.java │ │ └── OTGClientSyncManager.java │ │ ├── presets │ │ └── SpigotPresetLoader.java │ │ └── util │ │ ├── JsonToNBT.java │ │ ├── MobSpawnGroupHelper.java │ │ ├── SpigotLogger.java │ │ ├── SpigotNBTHelper.java │ │ └── SpigotPluginLoadedChecker.java │ └── resources │ └── plugin.yml ├── resources ├── DimensionConfigs │ ├── Example 1.yaml │ ├── Example 2.yaml │ ├── Example 3.yaml │ └── Example 4.yaml └── Presets │ └── Default │ ├── WorldBiomes │ ├── Hell.bc │ ├── Sky.bc │ ├── The Void.bc │ ├── beach │ │ ├── Beach.bc │ │ ├── Snowy Beach.bc │ │ └── Stone Shore.bc │ ├── desert │ │ ├── Desert Hills.bc │ │ ├── Desert Lakes.bc │ │ └── Desert.bc │ ├── extreme_hills │ │ ├── Gravelly Mountains+.bc │ │ ├── Gravelly Mountains.bc │ │ ├── Mountain Edge.bc │ │ ├── Mountains.bc │ │ └── Wooded Mountains.bc │ ├── forest │ │ ├── Birch Forest Hills.bc │ │ ├── Birch Forest.bc │ │ ├── Dark Forest Hills.bc │ │ ├── Dark Forest.bc │ │ ├── Flower Forest.bc │ │ ├── Forest.bc │ │ ├── Tall Birch Forest.bc │ │ ├── Tall Birch Hills.bc │ │ └── Wooded Hills.bc │ ├── icy │ │ ├── Ice Spikes.bc │ │ ├── Snowy Mountains.bc │ │ └── Snowy Tundra.bc │ ├── jungle │ │ ├── Bamboo Jungle Hills.bc │ │ ├── Bamboo Jungle.bc │ │ ├── Jungle Edge.bc │ │ ├── Jungle Hills.bc │ │ ├── Jungle.bc │ │ ├── Modified Jungle Edge.bc │ │ └── Modified Jungle.bc │ ├── mesa │ │ ├── Badlands Plateau.bc │ │ ├── Badlands.bc │ │ ├── Eroded Badlands.bc │ │ ├── Modified Badlands Plateau.bc │ │ ├── Modified Wooded Badlands Plateau.bc │ │ └── Wooded Badlands Plateau.bc │ ├── mushroom │ │ ├── Mushroom Fields Shore.bc │ │ └── Mushroom Fields.bc │ ├── ocean │ │ ├── Cold Ocean.bc │ │ ├── Deep Cold Ocean.bc │ │ ├── Deep Frozen Ocean.bc │ │ ├── Deep Lukewarm Ocean.bc │ │ ├── Deep Ocean.bc │ │ ├── Deep Warm Ocean.bc │ │ ├── Frozen Ocean.bc │ │ ├── Lukewarm Ocean.bc │ │ ├── Ocean.bc │ │ └── Warm Ocean.bc │ ├── plains │ │ ├── Plains.bc │ │ └── Sunflower Plains.bc │ ├── river │ │ ├── Frozen River.bc │ │ └── River.bc │ ├── savanna │ │ ├── Savanna Plateau.bc │ │ ├── Savanna.bc │ │ ├── Shattered Savanna Plateau.bc │ │ └── Shattered Savanna.bc │ ├── swamp │ │ ├── Swamp Hills.bc │ │ └── Swamp.bc │ ├── taiga │ │ ├── Giant Spruce Taiga Hills.bc │ │ ├── Giant Spruce Taiga.bc │ │ ├── Giant Tree Taiga Hills.bc │ │ ├── Giant Tree Taiga.bc │ │ ├── Snowy Taiga Hills.bc │ │ ├── Snowy Taiga Mountains.bc │ │ ├── Snowy Taiga.bc │ │ ├── Taiga Hills.bc │ │ ├── Taiga Mountains.bc │ │ └── Taiga.bc │ └── templates │ │ ├── Snowy │ │ ├── tagForestSnowy.bc │ │ ├── tagHillsSnowy.bc │ │ ├── tagLushSnowy.bc │ │ ├── tagMountainSnowy.bc │ │ ├── tagPlainsSnowy.bc │ │ ├── tagSandySnowy.bc │ │ └── tagWaterSnowy.bc │ │ ├── tagForest.bc │ │ ├── tagHills.bc │ │ ├── tagJungle.bc │ │ ├── tagLush.bc │ │ ├── tagMountain.bc │ │ ├── tagPlains.bc │ │ ├── tagSandy.bc │ │ └── tagWater.bc │ └── WorldConfig.ini └── settings.gradle /.gitattributes: -------------------------------------------------------------------------------- 1 | *.jpg binary 2 | *.png binary 3 | *.gif binary 4 | 5 | *.txt text eol=lf 6 | *.java text eol=lf 7 | *.yml text eol=lf 8 | *.info text eol=lf 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Wiki 4 | about: Read about how to use OpenTerrainGenerator on our Wiki. 5 | url: https://openterraingen.fandom.com/wiki/Home 6 | - name: Discord 7 | about: Join our Discord server for help using OpenTerrainGenerator, contribution inquiries, and more. 8 | url: https://discord.gg/UXzdVTH 9 | - name: Downloads 10 | about: Download the latest published builds of OpenTerrainGenerator that are suitable for use on live servers from CurseForge. 11 | url: https://www.curseforge.com/minecraft/mc-mods/open-terrain-generator/ 12 | - name: Developer Builds 13 | about: Download the latest bleeding-edge builds of OpenTerrainGenerator for use in bug testing and preset development. These builds are not recommended for use on live servers. Please ensure you download your build from the correct branch. 14 | url: https://github.com/PG85/OpenTerrainGenerator/actions/workflows/gradle.yml -------------------------------------------------------------------------------- /.github/workflows/gradle.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time 6 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle 7 | 8 | name: Java CI with Gradle 9 | 10 | on: 11 | push: 12 | branches: [ 1.16.4 ] 13 | pull_request: 14 | branches: [ 1.16.4 ] 15 | 16 | jobs: 17 | build: 18 | 19 | runs-on: ubuntu-latest 20 | 21 | steps: 22 | - uses: actions/checkout@v2 23 | - name: Set up JDK 8 24 | uses: actions/setup-java@v2 25 | with: 26 | java-version: '8' 27 | distribution: 'zulu' 28 | - name: Build with Gradle 29 | uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021 30 | with: 31 | arguments: createReleaseJar 32 | - uses: actions/upload-artifact@v2 33 | with: 34 | name: OpenTerrainGenerator 35 | path: build/releases 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Eclipse stuff 2 | .classpath 3 | .project 4 | .settings 5 | .metadata 6 | .recommenders 7 | .ucdetector_reports 8 | 9 | # NetBeans 10 | nbproject 11 | .nb-gradle* 12 | build.xml 13 | nbbuild 14 | 15 | # Idea stuff 16 | /.idea 17 | *.iml 18 | 19 | # Various IDEs like to add child .gitignore files 20 | **/.gitignore 21 | 22 | # vim 23 | .*.sw[a-p] 24 | 25 | # various other potential build files 26 | target 27 | build 28 | .gradle 29 | bin 30 | dist 31 | out 32 | localexport.jardesc 33 | forgeInfo 34 | /platforms/forge/gradle/wrapper/*.jar 35 | 36 | # Minecraft, Bukkit and Forge files 37 | # (Eclipse uses ./plaftforms/forge/ as the root when running Forge, IntelliJ uses ./) 38 | /config/ 39 | /logs/ 40 | /mods/ 41 | /saves/ 42 | /run/ 43 | /banned-players.txt 44 | /banned-ips.txt 45 | /crash-reports 46 | /eula.txt 47 | /config 48 | /options.txt 49 | /ops.txt 50 | /server.properties 51 | /white-list.txt 52 | level.dat_old 53 | session.lock 54 | *.dat 55 | *.mca 56 | /platforms/bukkit/logs 57 | /platforms/forge/.factorypath 58 | /platforms/forge/banned-players.txt 59 | /platforms/forge/banned-ips.txt 60 | /platforms/forge/crash-reports 61 | /platforms/forge/eula.txt 62 | /platforms/forge/logs/ 63 | /platforms/forge/mods/ 64 | /platforms/forge/config/ 65 | /platforms/forge/options.txt 66 | /platforms/forge/ops.txt 67 | /platforms/forge/saves/ 68 | /platforms/forge/server.properties 69 | /platforms/forge/white-list.txt 70 | /platforms/forge/run/ 71 | 72 | # Filesystem dust 73 | Thumbs.db 74 | .DS_Store 75 | *.lock 76 | *.launch -------------------------------------------------------------------------------- /LICENCE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) contributors of OpenTerrainGenerator 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LICENSE_TC_OLD.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) contributors of TerrainControl 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /common/common-config/build.gradle: -------------------------------------------------------------------------------- 1 | // Build script for the Common parts of OpenTerrainGenerator 2 | 3 | plugins { 4 | id 'java' 5 | } 6 | 7 | // Project properties 8 | archivesBaseName = "openterraingenerator-common-config" 9 | description = "Core files of OpenTerrainGenerator" 10 | 11 | repositories 12 | { 13 | jcenter() 14 | mavenLocal() 15 | mavenCentral() 16 | } 17 | 18 | dependencies 19 | { 20 | compile project(':common:common-util') 21 | } 22 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/ErroredFunction.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config; 2 | 3 | import com.pg85.otg.util.helpers.StringHelper; 4 | 5 | import java.util.List; 6 | 7 | public final class ErroredFunction extends ConfigFunction 8 | { 9 | private final String name; 10 | private final List args; 11 | public final String error; 12 | public boolean isLogged = false; 13 | 14 | public ErroredFunction(String name, List args, String error) 15 | { 16 | this.name = name; 17 | this.args = args; 18 | this.error = error; 19 | } 20 | 21 | @Override 22 | public String toString() 23 | { 24 | return "## INVALID " + name.toUpperCase() + " - " + error + " ##" + System.getProperty("line.separator") + name + "(" + StringHelper.join(args, ",") + ")"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/biome/BiomeResourceBase.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.biome; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import com.pg85.otg.config.ConfigFunction; 7 | import com.pg85.otg.interfaces.IBiomeConfig; 8 | import com.pg85.otg.interfaces.ILogger; 9 | import com.pg85.otg.interfaces.IMaterialReader; 10 | 11 | /** Represents a BiomeConfig ResourceQueue resource. */ 12 | public abstract class BiomeResourceBase extends ConfigFunction 13 | { 14 | static BiomeResourceBase createResource(IBiomeConfig config, ILogger logger, IMaterialReader materialReader, Class clazz, Object... args) 15 | { 16 | List stringArgs = new ArrayList(args.length); 17 | for (Object arg : args) 18 | { 19 | stringArgs.add("" + arg); 20 | } 21 | 22 | try 23 | { 24 | return clazz.getConstructor(IBiomeConfig.class, List.class, ILogger.class, IMaterialReader.class).newInstance(config, stringArgs, logger, materialReader); 25 | } catch (Exception e) { 26 | throw new RuntimeException(e); 27 | } 28 | } 29 | 30 | // We're using reflection to match constructors for resources, so resource classes must implement this 31 | // constructor or createResource / com.pg85.otg.config.biome.BiomeResourcesManager.getConfigFunction() will fail. 32 | public BiomeResourceBase(IBiomeConfig biomeConfig, List args, ILogger logger, IMaterialReader materialReader) { } 33 | } 34 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/io/IConfigFunctionProvider.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.io; 2 | 3 | import java.util.List; 4 | import com.pg85.otg.config.ConfigFunction; 5 | import com.pg85.otg.interfaces.ILogger; 6 | import com.pg85.otg.interfaces.IMaterialReader; 7 | 8 | public interface IConfigFunctionProvider 9 | { 10 | public ConfigFunction getConfigFunction(String name, T holder, List args, ILogger logger, IMaterialReader materialReader); 11 | } 12 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/BooleanSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | 6 | /** 7 | * Reads and writes booleans. 8 | * 9 | *

It can read the values true and false, case insensitive. It will write 10 | * "true" or "false", always in lowercase. 11 | */ 12 | class BooleanSetting extends Setting 13 | { 14 | private final boolean defaultValue; 15 | 16 | BooleanSetting(String name, boolean defaultValue) 17 | { 18 | super(name); 19 | this.defaultValue = Boolean.valueOf(defaultValue); 20 | } 21 | 22 | @Override 23 | public Boolean getDefaultValue(IMaterialReader materialReader) 24 | { 25 | return defaultValue; 26 | } 27 | 28 | @Override 29 | public Boolean read(String string, IMaterialReader materialReader) throws InvalidConfigException 30 | { 31 | if (string.equalsIgnoreCase("true")) 32 | { 33 | return Boolean.TRUE; 34 | } 35 | if (string.equalsIgnoreCase("false")) 36 | { 37 | return Boolean.FALSE; 38 | } 39 | throw new InvalidConfigException(string + " is not a boolean"); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/ColorSetSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | import com.pg85.otg.util.biome.ColorSet; 6 | import com.pg85.otg.util.biome.SimpleColorSet; 7 | import com.pg85.otg.util.helpers.StringHelper; 8 | 9 | public class ColorSetSetting extends Setting 10 | { 11 | 12 | protected ColorSetSetting(String name) 13 | { 14 | super(name); 15 | } 16 | 17 | @Override 18 | public ColorSet getDefaultValue(IMaterialReader materialReader) 19 | { 20 | return new ColorSet(); 21 | } 22 | 23 | @Override 24 | public ColorSet read(String string, IMaterialReader materialReader) throws InvalidConfigException 25 | { 26 | return new SimpleColorSet(StringHelper.readCommaSeperatedString(string), materialReader); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/ColorSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | 6 | /** 7 | * Reads and writes colors. The colors are represented as integers internally, 8 | * but are written as hexadecimal colors in upper case, starting with a #. 9 | * 10 | *

Color reading allows multiple formats. Colors starting with 0x or 11 | * # are interpreted as hexadecimal numbers, colors starting with 0 as octal 12 | * numbers and other colors as decimal numbers. Colors are case insensitive. 13 | * 14 | */ 15 | class ColorSetting extends Setting 16 | { 17 | private int defaultValue; 18 | 19 | ColorSetting(String name, String defaultValue) 20 | { 21 | super(name); 22 | this.defaultValue = Integer.decode(defaultValue); 23 | } 24 | 25 | @Override 26 | public Integer getDefaultValue(IMaterialReader materialReader) 27 | { 28 | return defaultValue; 29 | } 30 | 31 | @Override 32 | public Integer read(String string, IMaterialReader materialReader) throws InvalidConfigException 33 | { 34 | try 35 | { 36 | Integer integer = Integer.decode(string); 37 | if (integer.intValue() > 0xffffff || integer.intValue() < 0) 38 | { 39 | throw new InvalidConfigException("Color must have 6 hexadecimal digits"); 40 | } 41 | return integer; 42 | } catch (NumberFormatException e) 43 | { 44 | throw new InvalidConfigException("Invalid color " + string); 45 | } 46 | } 47 | 48 | @Override 49 | public String write(Integer value) 50 | { 51 | return "#" + Integer.toHexString(value.intValue() | 0x1000000).substring(1).toUpperCase(); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/DoubleArraySetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | import com.pg85.otg.util.helpers.StringHelper; 6 | 7 | /** 8 | * Reads and writes arrays of doubles, used for settings like 9 | * CustomHeightControl. 10 | * 11 | *

Numbers are separated with a ",". Numbers may have spaces around them. 12 | * The numbers must be within the bounds of the Java double type. Numbers 13 | * are written separated with a ", " (comma and space). 14 | */ 15 | public class DoubleArraySetting extends Setting 16 | { 17 | public DoubleArraySetting(String name) 18 | { 19 | super(name); 20 | } 21 | 22 | @Override 23 | public double[] getDefaultValue(IMaterialReader materialReader) 24 | { 25 | return new double[0]; 26 | } 27 | 28 | @Override 29 | public double[] read(String string, IMaterialReader materialReader) throws InvalidConfigException 30 | { 31 | if (string.isEmpty()) 32 | { 33 | return new double[0]; 34 | } 35 | String[] split = StringHelper.readCommaSeperatedString(string); 36 | double[] values = new double[split.length]; 37 | for (int i = 0; i < split.length; i++) 38 | { 39 | // Trimming the values allows "Value1, Value2" 40 | values[i] = StringHelper.readDouble(split[i], -Double.MAX_VALUE, Double.MAX_VALUE); 41 | } 42 | return values; 43 | } 44 | 45 | @Override 46 | public String write(double[] values) 47 | { 48 | StringBuilder builder = new StringBuilder(); 49 | for (int i = 0; i < values.length; i++) 50 | { 51 | if (i != 0) 52 | { 53 | builder.append(", "); 54 | } 55 | builder.append(values[i]); 56 | } 57 | return builder.toString(); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/DoubleSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | import com.pg85.otg.util.helpers.StringHelper; 6 | 7 | /** 8 | * Reads and writes a single double number. 9 | * 10 | *

Numbers are limited to the given min and max values. 11 | */ 12 | class DoubleSetting extends Setting 13 | { 14 | private final double defaultValue; 15 | private final double minValue; 16 | private final double maxValue; 17 | 18 | DoubleSetting(String name, double defaultValue, double minValue, double maxValue) 19 | { 20 | super(name); 21 | this.defaultValue = defaultValue; 22 | this.minValue = minValue; 23 | this.maxValue = maxValue; 24 | } 25 | 26 | @Override 27 | public Double getDefaultValue(IMaterialReader materialReader) 28 | { 29 | return defaultValue; 30 | } 31 | 32 | @Override 33 | public Double read(String string, IMaterialReader materialReader) throws InvalidConfigException 34 | { 35 | return StringHelper.readDouble(string, minValue, maxValue); 36 | } 37 | 38 | public Double getMinValue() 39 | { 40 | return minValue; 41 | } 42 | 43 | public Double getMaxValue() 44 | { 45 | return maxValue; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/EnumSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | 6 | /** 7 | * Reads and writes values of the given enum type. 8 | * 9 | *

Valid values are those defined by the given enum type. Values are case 10 | * insensitive, all {@link Enum#name() names} of the values in the enum are 11 | * read and compared to the given value. Values are written using the 12 | * {@link Enum#toString() toString method on the Enum class}. 13 | * 14 | * @param The enum type. 15 | */ 16 | class EnumSetting> extends Setting 17 | { 18 | private final T defaultValue; 19 | private final T[] enumValues; 20 | 21 | public EnumSetting(String name, T defaultValue) 22 | { 23 | super(name); 24 | this.defaultValue = defaultValue; 25 | this.enumValues = defaultValue.getDeclaringClass().getEnumConstants(); 26 | } 27 | 28 | @Override 29 | public T getDefaultValue(IMaterialReader materialReader) 30 | { 31 | return defaultValue; 32 | } 33 | 34 | @Override 35 | public T read(String string, IMaterialReader materialReader) throws InvalidConfigException 36 | { 37 | for (T enumValue : enumValues) 38 | { 39 | if (enumValue.name().equalsIgnoreCase(string)) 40 | { 41 | return enumValue; 42 | } 43 | } 44 | throw new InvalidConfigException(string + " is not an acceptable value"); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/FloatSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | import com.pg85.otg.util.helpers.StringHelper; 6 | 7 | /** 8 | * Reads and writes a single float number. 9 | * 10 | *

Numbers are limited to the given min and max values. 11 | */ 12 | class FloatSetting extends Setting 13 | { 14 | private final float defaultValue; 15 | private final float minValue; 16 | private final float maxValue; 17 | 18 | FloatSetting(String name, float defaultValue, float minValue, float maxValue) 19 | { 20 | super(name); 21 | this.defaultValue = defaultValue; 22 | this.minValue = minValue; 23 | this.maxValue = maxValue; 24 | } 25 | 26 | @Override 27 | public Float getDefaultValue(IMaterialReader materialReader) 28 | { 29 | return defaultValue; 30 | } 31 | 32 | @Override 33 | public Float read(String string, IMaterialReader materialReader) throws InvalidConfigException 34 | { 35 | return (float) StringHelper.readDouble(string, minValue, maxValue); 36 | } 37 | 38 | public Float getMinValue() 39 | { 40 | return minValue; 41 | } 42 | 43 | public Float getMaxValue() 44 | { 45 | return maxValue; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/IntSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | import com.pg85.otg.util.helpers.StringHelper; 6 | 7 | /** 8 | * Reads and writes a single integer. 9 | * 10 | *

Numbers are limited to the given min and max values. 11 | */ 12 | class IntSetting extends Setting 13 | { 14 | private final int defaultValue; 15 | private final int minValue; 16 | private final int maxValue; 17 | 18 | IntSetting(String name, int defaultValue, int minValue, int maxValue) 19 | { 20 | super(name); 21 | this.defaultValue = defaultValue; 22 | this.minValue = minValue; 23 | this.maxValue = maxValue; 24 | } 25 | 26 | @Override 27 | public Integer getDefaultValue(IMaterialReader materialReader) 28 | { 29 | return defaultValue; 30 | } 31 | 32 | @Override 33 | public Integer read(String string, IMaterialReader materialReader) throws InvalidConfigException 34 | { 35 | return StringHelper.readInt(string, minValue, maxValue); 36 | } 37 | 38 | public Integer getMinValue() 39 | { 40 | return minValue; 41 | } 42 | 43 | public Integer getMaxValue() 44 | { 45 | return maxValue; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/LongSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | import com.pg85.otg.util.helpers.StringHelper; 6 | 7 | /** 8 | * Reads and writes a single long. 9 | * 10 | *

Numbers are limited to the given min and max values. 11 | */ 12 | class LongSetting extends Setting 13 | { 14 | private final long defaultValue; 15 | private final long minValue; 16 | private final long maxValue; 17 | 18 | LongSetting(String name, long defaultValue, long minValue, long maxValue) 19 | { 20 | super(name); 21 | this.defaultValue = defaultValue; 22 | this.minValue = minValue; 23 | this.maxValue = maxValue; 24 | } 25 | 26 | @Override 27 | public Long getDefaultValue(IMaterialReader materialReader) 28 | { 29 | return defaultValue; 30 | } 31 | 32 | @Override 33 | public Long read(String string, IMaterialReader materialReader) throws InvalidConfigException 34 | { 35 | return StringHelper.readLong(string, minValue, maxValue); 36 | } 37 | 38 | public Long getMinValue() 39 | { 40 | return minValue; 41 | } 42 | 43 | public Long getMaxValue() 44 | { 45 | return maxValue; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/MaterialSetSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | import com.pg85.otg.util.helpers.StringHelper; 6 | import com.pg85.otg.util.materials.MaterialSet; 7 | 8 | /** 9 | * Reads and writes a set of materials, used for matching. 10 | * 11 | *

Materials are separated using a comma and, optionally, whitespace. Each 12 | * material is stripped from its whitespace and read using 13 | * {@link MaterialSet#parseAndAdd(String)}. 14 | * 15 | */ 16 | class MaterialSetSetting extends Setting 17 | { 18 | private final String[] defaultValues; 19 | 20 | public MaterialSetSetting(String name, String... defaultValues) 21 | { 22 | super(name); 23 | this.defaultValues = defaultValues; 24 | } 25 | 26 | @Override 27 | public MaterialSet getDefaultValue(IMaterialReader materialReader) 28 | { 29 | try 30 | { 31 | MaterialSet blocks = new MaterialSet(); 32 | for (String blockName : defaultValues) 33 | { 34 | blocks.parseAndAdd(blockName, materialReader); 35 | } 36 | return blocks; 37 | } catch (InvalidConfigException e) 38 | { 39 | throw new AssertionError(e); 40 | } 41 | } 42 | 43 | @Override 44 | public MaterialSet read(String string, IMaterialReader materialReader) throws InvalidConfigException 45 | { 46 | MaterialSet blocks = new MaterialSet(); 47 | 48 | for (String blockName : StringHelper.readCommaSeperatedString(string)) 49 | { 50 | blocks.parseAndAdd(blockName, materialReader); 51 | } 52 | 53 | return blocks; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/MaterialSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | import com.pg85.otg.util.materials.LocalMaterialData; 6 | 7 | /** 8 | * Reads and writes a material. Materials are read using 9 | * {@link OTG#readMaterial(String)} and written using 10 | * {@link LocalMaterialData#toString()}. 11 | * 12 | */ 13 | public class MaterialSetting extends Setting 14 | { 15 | private final String defaultValue; 16 | private boolean processedMaterial = false; 17 | private LocalMaterialData defaultMaterial; 18 | 19 | public MaterialSetting(String name, String defaultValue) 20 | { 21 | super(name); 22 | this.defaultValue = defaultValue; 23 | } 24 | 25 | @Override 26 | public LocalMaterialData getDefaultValue(IMaterialReader materialReader) 27 | { 28 | if(!processedMaterial) 29 | { 30 | processedMaterial = true; 31 | try { 32 | defaultMaterial = materialReader.readMaterial(defaultValue); 33 | } catch (InvalidConfigException e) { 34 | e.printStackTrace(); 35 | } 36 | } 37 | return defaultMaterial; 38 | } 39 | 40 | @Override 41 | public LocalMaterialData read(String string, IMaterialReader materialReader) throws InvalidConfigException 42 | { 43 | return materialReader.readMaterial(string); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/MobGroupListSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | import com.pg85.otg.util.biome.WeightedMobSpawnGroup; 6 | 7 | import java.util.Collections; 8 | import java.util.List; 9 | 10 | /** 11 | * Reads and writes a list of mobs. Mobs are read using 12 | * {@link WeightedMobSpawnGroup#fromJson(String)} and written using 13 | * {@link WeightedMobSpawnGroup#toJson(List)}. 14 | * 15 | */ 16 | class MobGroupListSetting extends Setting> 17 | { 18 | 19 | MobGroupListSetting(String name) 20 | { 21 | super(name); 22 | } 23 | 24 | @Override 25 | public List getDefaultValue(IMaterialReader materialReader) 26 | { 27 | return Collections.emptyList(); 28 | } 29 | 30 | @Override 31 | public List read(String string, IMaterialReader materialReader) throws InvalidConfigException 32 | { 33 | return WeightedMobSpawnGroup.fromJson(string); 34 | } 35 | 36 | @Override 37 | public String write(List groups) 38 | { 39 | return WeightedMobSpawnGroup.toJson(groups); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/ReplaceBlocksListSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | import com.pg85.otg.util.biome.ReplaceBlocks; 6 | import com.pg85.otg.util.biome.WeightedMobSpawnGroup; 7 | 8 | import java.util.Collections; 9 | import java.util.List; 10 | 11 | /** 12 | * Reads and writes a list of mobs. Mobs are read using 13 | * {@link WeightedMobSpawnGroup#fromJson(String)} and written using 14 | * {@link WeightedMobSpawnGroup#toJson(List)}. 15 | * 16 | */ 17 | class ReplaceBlocksListSetting extends Setting> 18 | { 19 | ReplaceBlocksListSetting(String name) 20 | { 21 | super(name); 22 | } 23 | 24 | @Override 25 | public List getDefaultValue(IMaterialReader materialReader) 26 | { 27 | return Collections.emptyList(); 28 | } 29 | 30 | @Override 31 | public List read(String string, IMaterialReader materialReader) throws InvalidConfigException 32 | { 33 | return ReplaceBlocks.fromJson(string); 34 | } 35 | 36 | @Override 37 | public String write(List groups) 38 | { 39 | return ReplaceBlocks.toJson(groups); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/ReplacedBlocksSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.constants.Constants; 4 | import com.pg85.otg.exceptions.InvalidConfigException; 5 | import com.pg85.otg.interfaces.IMaterialReader; 6 | import com.pg85.otg.util.biome.ReplaceBlockMatrix; 7 | 8 | /** 9 | * Setting that handles {@link ReplaceBlockMatrix}. 10 | * 11 | */ 12 | class ReplacedBlocksSetting extends Setting 13 | { 14 | 15 | ReplacedBlocksSetting(String name) 16 | { 17 | super(name); 18 | } 19 | 20 | @Override 21 | public ReplaceBlockMatrix getDefaultValue(IMaterialReader materialReader) 22 | { 23 | return ReplaceBlockMatrix.createEmptyMatrix(Constants.WORLD_HEIGHT, materialReader); 24 | } 25 | 26 | @Override 27 | public ReplaceBlockMatrix read(String string, IMaterialReader materialReader) throws InvalidConfigException 28 | { 29 | return new ReplaceBlockMatrix(string, Constants.WORLD_HEIGHT, materialReader); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/RotationSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | import com.pg85.otg.util.bo3.Rotation; 6 | 7 | /** 8 | * Reads and writes a single integer. 9 | * 10 | *

Numbers are limited to the given min and max values. 11 | */ 12 | class RotationSetting extends Setting 13 | { 14 | private final Rotation defaultValue; 15 | 16 | RotationSetting(String name, Rotation defaultValue) 17 | { 18 | super(name); 19 | this.defaultValue = defaultValue; 20 | } 21 | 22 | @Override 23 | public Rotation getDefaultValue(IMaterialReader materialReader) 24 | { 25 | return defaultValue; 26 | } 27 | 28 | @Override 29 | public Rotation read(String string, IMaterialReader materialReader) throws InvalidConfigException 30 | { 31 | return 32 | string == null || string.length() == 0 ? defaultValue : 33 | string.toUpperCase().trim().equals("NORTH") ? Rotation.NORTH : 34 | string.toUpperCase().trim().equals("EAST") ? Rotation.EAST : 35 | string.toUpperCase().trim().equals("SOUTH") ? Rotation.SOUTH : 36 | string.toUpperCase().trim().equals("WEST") ? Rotation.WEST : 37 | defaultValue; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/StringListSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | import com.pg85.otg.util.helpers.StringHelper; 6 | 7 | import java.util.Arrays; 8 | import java.util.List; 9 | 10 | /** 11 | * Reads and writes a list of strings. Strings are read using 12 | * {@link StringHelper#readCommaSeperatedString(String)}, and written with a 13 | * ", " between each string. 14 | * 15 | */ 16 | class StringListSetting extends Setting> 17 | { 18 | private String[] defaultValue; 19 | 20 | StringListSetting(String name, String... defaultValue) 21 | { 22 | super(name); 23 | this.defaultValue = defaultValue; 24 | } 25 | 26 | @Override 27 | public List getDefaultValue(IMaterialReader materialReader) 28 | { 29 | return Arrays.asList(defaultValue); 30 | } 31 | 32 | @Override 33 | public List read(String string, IMaterialReader materialReader) throws InvalidConfigException 34 | { 35 | return Arrays.asList(StringHelper.readCommaSeperatedString(string)); 36 | } 37 | 38 | @Override 39 | public String write(List value) 40 | { 41 | return StringHelper.join(value, ", "); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/settingType/StringSetting.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.settingType; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.IMaterialReader; 5 | 6 | /** 7 | * Reads and writes a string. Surrounding whitespace is stripped using 8 | * {@link String#trim()}. 9 | * 10 | */ 11 | class StringSetting extends Setting 12 | { 13 | private final String defaultValue; 14 | 15 | StringSetting(String name, String defaultValue) 16 | { 17 | super(name); 18 | this.defaultValue = defaultValue; 19 | } 20 | 21 | @Override 22 | public String getDefaultValue(IMaterialReader materialReader) 23 | { 24 | return defaultValue; 25 | } 26 | 27 | @Override 28 | public String read(String string, IMaterialReader materialReader) throws InvalidConfigException 29 | { 30 | return string.trim(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /common/common-config/src/main/java/com/pg85/otg/config/standard/PluginConfigStandardValues.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.config.standard; 2 | 3 | import com.pg85.otg.config.settingType.Setting; 4 | import com.pg85.otg.config.settingType.Settings; 5 | import com.pg85.otg.constants.SettingsEnums.LogLevels; 6 | 7 | public class PluginConfigStandardValues extends Settings 8 | { 9 | // Plugin Defaults 10 | 11 | public static final Setting LOG_LEVEL = enumSetting("LogLevel", LogLevels.Standard); 12 | public static final Setting DECORATION_ENABLED = booleanSetting("DecorationEnabled", true); 13 | public static final Setting LOG_CUSTOM_OBJECTS = booleanSetting("LogCustomObjects", false); 14 | public static final Setting LOG_BO4_PLOTTING = booleanSetting("LogBO4Plotting", false); 15 | public static final Setting LOG_CONFIGS = booleanSetting("LogConfigs", false); 16 | public static final Setting LOG_BIOME_REGISTRY = booleanSetting("LogBiomeRegistry", false); 17 | public static final Setting LOG_DECORATION = booleanSetting("LogDecoration", false); 18 | public static final Setting LOG_MOBS = booleanSetting("LogMobs", false); 19 | public static final Setting LOG_PRESETS = stringSetting("LogPresets", "all"); 20 | public static final Setting LOG_PERFORMANCE = booleanSetting("LogPerformance", false); 21 | public static final Setting DEVELOPER_MODE = booleanSetting("DeveloperMode", false); 22 | public static final Setting WORKER_THREADS = intSetting("WorkerThreads", 0, 0, 10); 23 | } 24 | -------------------------------------------------------------------------------- /common/common-core/src/main/java/com/pg85/otg/OTG.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg; 2 | 3 | /** 4 | * Main entry-point. Used for logging and to access OTGEngine. 5 | * OTGEngine is implemented and provided by the platform-specific 6 | * layer and holds any objects and methods used during a session. 7 | */ 8 | public class OTG 9 | { 10 | private static OTGEngine Engine; 11 | 12 | private OTG() { } 13 | 14 | // Engine 15 | 16 | public static OTGEngine getEngine() 17 | { 18 | return Engine; 19 | } 20 | 21 | public static void startEngine(OTGEngine engine) 22 | { 23 | if (Engine != null) 24 | { 25 | throw new IllegalStateException("Engine is already set."); 26 | } 27 | 28 | Engine = engine; 29 | engine.onStart(); 30 | } 31 | 32 | public static void stopEngine() 33 | { 34 | Engine.onShutdown(); 35 | Engine = null; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /common/common-customobject/build.gradle: -------------------------------------------------------------------------------- 1 | // Build script for the Common parts of OpenTerrainGenerator 2 | 3 | plugins { 4 | id 'java' 5 | } 6 | 7 | // Project properties 8 | archivesBaseName = "openterraingenerator-common-customobject" 9 | description = "Core files of OpenTerrainGenerator" 10 | 11 | repositories 12 | { 13 | jcenter() 14 | mavenLocal() 15 | mavenCentral() 16 | } 17 | 18 | dependencies 19 | { 20 | compile project(':common:common-util') 21 | compile project(':common:common-config') 22 | } 23 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/CustomObjectLoader.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject; 2 | 3 | import java.io.File; 4 | 5 | import com.pg85.otg.util.nbt.NBTHelper; 6 | import com.pg85.otg.interfaces.ILogger; 7 | 8 | public interface CustomObjectLoader 9 | { 10 | /** 11 | * Returns a CustomObject with the given name and file. The object shouldn't yet be initialisized. 12 | * 13 | * @param objectName Name of the object. 14 | * @param file File of the object. 15 | * @return The object. 16 | */ 17 | public CustomObject loadFromFile(String objectName, File file, ILogger logger); 18 | 19 | /** 20 | * Called whenever Open Terrain Generator is being shut down / reloaded. 21 | */ 22 | public default void onShutdown() 23 | { 24 | // Clean up the cache 25 | NBTHelper.clearCache(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/SpawnableObject.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject; 2 | 3 | import com.pg85.otg.customobject.structures.CustomStructureCache; 4 | import com.pg85.otg.interfaces.IWorldGenRegion; 5 | import com.pg85.otg.util.bo3.Rotation; 6 | 7 | import java.util.Random; 8 | 9 | /** 10 | * Describes some small object (must fit in a single chunk) that can be spawned 11 | * in a world. 12 | */ 13 | interface SpawnableObject 14 | { 15 | /** 16 | * Spawns the object at the given position. It shouldn't execute any spawn 17 | * checks, so it should make an effort to spawn at this location, even if 18 | * the location is not suitable.. 19 | * 20 | * @param world World to spawn in. 21 | * @param random Random number generator based on the world seed. 22 | * @param rotation Rotation to spawn the object in. 23 | * @param x X coord of the object origin. 24 | * @param y Y coord of the object origin. 25 | * @param z Z coord of the object origin. 26 | * @return Whether the attempt was successful. (It should never fail, but you never know.) 27 | */ 28 | public boolean spawnForced(CustomStructureCache structureCache, IWorldGenRegion worldGenRegion, Random random, Rotation rotation, int x, int y, int z, boolean allowReplaceBlocks); 29 | 30 | /** 31 | * Returns the name of this object. 32 | * 33 | * @return The name. If this object is loaded from a file, the file 34 | * extension (.bo3, .nbt) is excluded. 35 | */ 36 | public String getName(); 37 | } 38 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/bo2/BO2Loader.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.bo2; 2 | 3 | import com.pg85.otg.customobject.CustomObject; 4 | import com.pg85.otg.customobject.CustomObjectLoader; 5 | import com.pg85.otg.customobject.config.io.FileSettingsReaderBO4; 6 | import com.pg85.otg.interfaces.ILogger; 7 | 8 | import java.io.File; 9 | 10 | public class BO2Loader implements CustomObjectLoader 11 | { 12 | @Override 13 | public CustomObject loadFromFile(String objectName, File file, ILogger logger) 14 | { 15 | return new BO2(new FileSettingsReaderBO4(objectName, file, logger)); 16 | } 17 | 18 | @Override 19 | public void onShutdown() { } 20 | } 21 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/bo3/bo3function/BO3BlockFunction.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.bo3.bo3function; 2 | 3 | import java.util.Random; 4 | 5 | import com.pg85.otg.customobject.bo3.BO3Config; 6 | import com.pg85.otg.customobject.bofunctions.BlockFunction; 7 | import com.pg85.otg.interfaces.IWorldGenRegion; 8 | import com.pg85.otg.util.biome.ReplaceBlockMatrix; 9 | 10 | /** 11 | * Represents a block in a BO3. 12 | */ 13 | public class BO3BlockFunction extends BlockFunction 14 | { 15 | public BO3BlockFunction() { } 16 | 17 | public BO3BlockFunction(BO3Config holder) 18 | { 19 | this.holder = holder; 20 | } 21 | 22 | public BO3BlockFunction rotate() 23 | { 24 | BO3BlockFunction rotatedBlock = new BO3BlockFunction(); 25 | rotatedBlock.x = z; 26 | rotatedBlock.y = y; 27 | rotatedBlock.z = -x; 28 | rotatedBlock.material = material.rotate(); 29 | rotatedBlock.nbt = nbt; 30 | rotatedBlock.nbtName = nbtName; 31 | 32 | return rotatedBlock; 33 | } 34 | 35 | @Override 36 | public void spawn(IWorldGenRegion worldGenRegion, Random random, int x, int y, int z) 37 | { 38 | worldGenRegion.setBlock(x, y, z, this.material, this.nbt); 39 | } 40 | 41 | @Override 42 | public void spawn(IWorldGenRegion worldGenRegion, Random random, int x, int y, int z, ReplaceBlockMatrix replaceBlocks) 43 | { 44 | worldGenRegion.setBlock(x, y, z, this.material, this.nbt, replaceBlocks); 45 | } 46 | 47 | @Override 48 | public Class getHolderType() 49 | { 50 | return BO3Config.class; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/bo3/bo3function/BO3EntityFunction.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.bo3.bo3function; 2 | 3 | import com.pg85.otg.customobject.bo3.BO3Config; 4 | import com.pg85.otg.customobject.bofunctions.EntityFunction; 5 | import com.pg85.otg.interfaces.IEntityFunction; 6 | 7 | /** 8 | * Represents an entity in a BO3. 9 | */ 10 | public class BO3EntityFunction extends EntityFunction implements IEntityFunction 11 | { 12 | public BO3EntityFunction rotate() 13 | { 14 | BO3EntityFunction rotatedBlock = new BO3EntityFunction(); 15 | rotatedBlock.x = z; 16 | rotatedBlock.y = y; 17 | rotatedBlock.z = -x; 18 | rotatedBlock.name = name; 19 | rotatedBlock.resourceLocation = resourceLocation; 20 | rotatedBlock.groupSize = groupSize; 21 | rotatedBlock.originalNameTagOrNBTFileName = originalNameTagOrNBTFileName; 22 | rotatedBlock.nameTagOrNBTFileName = nameTagOrNBTFileName; 23 | rotatedBlock.namedBinaryTag = namedBinaryTag; 24 | rotatedBlock.rotation = (rotation + 1) % 4; 25 | 26 | return rotatedBlock; 27 | } 28 | 29 | @Override 30 | public Class getHolderType() 31 | { 32 | return BO3Config.class; 33 | } 34 | 35 | @Override 36 | public EntityFunction createNewInstance() 37 | { 38 | return new BO3EntityFunction(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/bo3/bo3function/BO3MinecraftObjectFunction.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.bo3.bo3function; 2 | 3 | import com.pg85.otg.customobject.bo3.BO3Config; 4 | import com.pg85.otg.customobject.bofunctions.MinecraftObjectFunction; 5 | 6 | /** 7 | * Represents a block in a BO3. 8 | */ 9 | public class BO3MinecraftObjectFunction extends MinecraftObjectFunction 10 | { 11 | public BO3MinecraftObjectFunction rotate() 12 | { 13 | BO3MinecraftObjectFunction rotatedBlock = new BO3MinecraftObjectFunction(); 14 | rotatedBlock.x = z; 15 | rotatedBlock.y = y; 16 | rotatedBlock.z = -x; 17 | rotatedBlock.rotation = rotation.next(); 18 | 19 | return rotatedBlock; 20 | } 21 | 22 | @Override 23 | public Class getHolderType() 24 | { 25 | return BO3Config.class; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/bo3/checks/BO3Check.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.bo3.checks; 2 | 3 | import com.pg85.otg.config.ConfigFunction; 4 | import com.pg85.otg.customobject.bo3.BO3Config; 5 | import com.pg85.otg.customobject.config.CustomObjectConfigFunction; 6 | import com.pg85.otg.interfaces.IWorldGenRegion; 7 | 8 | /** 9 | * Represents a check - something that can prevent the BO3 from spawning if this 10 | * condition is not met. 11 | */ 12 | public abstract class BO3Check extends CustomObjectConfigFunction 13 | { 14 | /** 15 | * Y position relative to the object origin. 16 | */ 17 | public int y; 18 | 19 | /** 20 | * Returns whether this check would prevent spawning at the given position. 21 | * The given x, y and z positions are simply the relative coords in this 22 | * object added to the coords of the origin of the BO3. The internal 23 | * coords in this object should be ignored. 24 | * 25 | * @param world The world to check in 26 | * @param x The x position 27 | * @param y The y position 28 | * @param z The z position 29 | * @return Whether this check prevents the BO3 from spawning. 30 | */ 31 | public abstract boolean preventsSpawn(IWorldGenRegion worldGenregion, int x, int y, int z); 32 | 33 | /** 34 | * This implementation of 35 | * {@link ConfigFunction#isAnalogousTo(ConfigFunction)} simply checks 36 | * whether the classes and coordinates are the same. 37 | */ 38 | @Override 39 | public boolean isAnalogousTo(CustomObjectConfigFunction other) 40 | { 41 | if(!getClass().equals(other.getClass())) { 42 | return false; 43 | } 44 | BO3Check check = (BO3Check) other; 45 | return check.x == x && check.y == y && check.z == z; 46 | } 47 | 48 | public abstract BO3Check rotate(); 49 | } 50 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/bo3/checks/BlockCheckNot.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.bo3.checks; 2 | 3 | import com.pg85.otg.interfaces.IWorldGenRegion; 4 | 5 | public final class BlockCheckNot extends BlockCheck 6 | { 7 | @Override 8 | public boolean preventsSpawn(IWorldGenRegion worldGenRegion, int x, int y, int z) 9 | { 10 | // We want the exact opposite as BlockCheck 11 | return !super.preventsSpawn(worldGenRegion, x, y, z); 12 | } 13 | 14 | @Override 15 | public String makeString() 16 | { 17 | return makeString("BlockCheckNot"); 18 | } 19 | 20 | @Override 21 | public BO3Check rotate() 22 | { 23 | BlockCheckNot rotatedCheck = new BlockCheckNot(); 24 | rotatedCheck.x = z; 25 | rotatedCheck.y = y; 26 | rotatedCheck.z = -x; 27 | rotatedCheck.toCheck = toCheck.rotate(); 28 | return rotatedCheck; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/bo3/checks/ModCheckNot.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.bo3.checks; 2 | 3 | import com.pg85.otg.interfaces.IModLoadedChecker; 4 | 5 | public class ModCheckNot extends ModCheck 6 | { 7 | @Override 8 | public String makeString() 9 | { 10 | return makeString("ModCheckNot"); 11 | } 12 | 13 | public boolean evaluate(IModLoadedChecker modLoadedChecker) 14 | { 15 | return !super.evaluate(modLoadedChecker); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/bo4/bo4function/BO4BranchNode.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.bo4.bo4function; 2 | 3 | import com.pg85.otg.customobject.bofunctions.BranchNode; 4 | import com.pg85.otg.customobject.structures.StructuredCustomObject; 5 | import com.pg85.otg.util.bo3.Rotation; 6 | 7 | /** 8 | * Simple class to hold the spawn chance and rotation of a BO3 in the Branch or 9 | * WeightedBranch function in the BO3 file. 10 | */ 11 | class BO4BranchNode extends BranchNode 12 | { 13 | /** 14 | * The max branch depth of the branch given to it by its parent 15 | * Used to make certain branches longer than others 16 | */ 17 | int branchDepth; 18 | boolean isRequiredBranch; 19 | boolean isWeightedBranch; 20 | String branchGroup; 21 | 22 | /** 23 | * Creates an instance of BranchNode with given rotation, chance, and branch fields 24 | */ 25 | BO4BranchNode(int branchDepth, boolean isRequiredBranch, boolean isWeightedBranch, Rotation rotation, double chance, StructuredCustomObject customObject, String customObjectName, String branchGroup) 26 | { 27 | this.branchDepth = branchDepth; 28 | this.rotation = rotation; 29 | this.chance = chance; 30 | 31 | this.customObjectName = customObject != null ? customObject.getName() : customObjectName != null && customObjectName.length() > 0 ? customObjectName : null; 32 | this.customObject = customObject; 33 | 34 | this.isRequiredBranch = isRequiredBranch; 35 | this.isWeightedBranch = isWeightedBranch; 36 | this.branchGroup = branchGroup; 37 | } 38 | 39 | /** 40 | * @return The string representation of this branch as seen in BO3 configs 41 | */ 42 | @Override 43 | protected String toBranchString() 44 | { 45 | return ',' + customObjectName + ',' + rotation.name() + ',' + chance + ',' + branchDepth; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/config/CustomObjectErroredFunction.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.config; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.interfaces.ILogger; 5 | import com.pg85.otg.interfaces.IMaterialReader; 6 | import com.pg85.otg.util.helpers.StringHelper; 7 | 8 | import java.util.List; 9 | 10 | public final class CustomObjectErroredFunction extends CustomObjectConfigFunction 11 | { 12 | private final Class holder; 13 | private final String name; 14 | private final List args; 15 | 16 | CustomObjectErroredFunction(String name, T holder, List args, String error) 17 | { 18 | @SuppressWarnings("unchecked") 19 | Class holderClass = (Class) holder.getClass(); 20 | this.holder = holderClass; 21 | this.name = name; 22 | this.args = args; 23 | this.invalidate(name, args, error); 24 | } 25 | 26 | @Override 27 | public Class getHolderType() 28 | { 29 | return holder; 30 | } 31 | 32 | @Override 33 | protected void load(List args, ILogger logger, IMaterialReader materialReader) throws InvalidConfigException 34 | { 35 | throw new UnsupportedOperationException(); 36 | } 37 | 38 | @Override 39 | public String makeString() 40 | { 41 | return name + "(" + StringHelper.join(args, ",") + ")"; 42 | } 43 | 44 | @Override 45 | public boolean isAnalogousTo(CustomObjectConfigFunction other) 46 | { 47 | // This function will never do anything, so won't matter how it is 48 | // inherited 49 | return this == other; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/creator/ObjectType.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.creator; 2 | 3 | import java.nio.file.Path; 4 | 5 | public enum ObjectType 6 | { 7 | BO2("BO2", 2), 8 | BO3("BO3", 3), 9 | BO4("BO4", 4); 10 | 11 | private final String type; 12 | 13 | private final int version; 14 | 15 | ObjectType(String type, int version) 16 | { 17 | this.type = type; 18 | this.version = version; 19 | } 20 | 21 | public String getType() 22 | { 23 | return type; 24 | } 25 | 26 | public int getVersion() 27 | { 28 | return version; 29 | } 30 | 31 | public Path getObjectFilePathFromName(String objectName, Path objectFolderPath) 32 | { 33 | return objectFolderPath.resolve(objectName + "." + type); 34 | } 35 | 36 | public boolean filenameIsOfType(String fileName) 37 | { 38 | return fileName.matches(".+[Bb][Oo]" + version); 39 | } 40 | 41 | public String getFileNameForTemplate(String templateName) 42 | { 43 | return templateName + "." + type + "Template"; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/resource/ICustomObjectResource.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.resource; 2 | 3 | import java.nio.file.Path; 4 | import java.util.Random; 5 | 6 | import com.pg85.otg.customobject.CustomObjectManager; 7 | import com.pg85.otg.customobject.config.CustomObjectResourcesManager; 8 | import com.pg85.otg.customobject.structures.CustomStructureCache; 9 | import com.pg85.otg.interfaces.IMaterialReader; 10 | import com.pg85.otg.interfaces.IModLoadedChecker; 11 | import com.pg85.otg.interfaces.IWorldGenRegion; 12 | 13 | public interface ICustomObjectResource 14 | { 15 | default void processForChunkDecoration(CustomStructureCache structureCache, IWorldGenRegion worldGenRegion, Random random, Path otgRootFolder, CustomObjectManager customObjectManager, IMaterialReader materialReader, CustomObjectResourcesManager manager, IModLoadedChecker modLoadedChecker) 16 | { 17 | // TODO: Fire Forge resource decoration events, when they're available. 18 | spawnForChunkDecoration(structureCache, worldGenRegion, random, otgRootFolder, customObjectManager, materialReader, manager, modLoadedChecker); 19 | } 20 | 21 | void spawnForChunkDecoration(CustomStructureCache structureCache, IWorldGenRegion worldGenRegion, Random random, Path otgRootFolder, CustomObjectManager customObjectManager, IMaterialReader materialReader, CustomObjectResourcesManager manager, IModLoadedChecker modLoadedChecker); 22 | } 23 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/structures/Branch.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.structures; 2 | 3 | import com.pg85.otg.customobject.CustomObjectManager; 4 | import com.pg85.otg.customobject.config.CustomObjectResourcesManager; 5 | import com.pg85.otg.interfaces.ILogger; 6 | import com.pg85.otg.interfaces.IMaterialReader; 7 | import com.pg85.otg.interfaces.IModLoadedChecker; 8 | import com.pg85.otg.util.bo3.Rotation; 9 | 10 | import java.nio.file.Path; 11 | import java.util.Random; 12 | 13 | /** 14 | * Represents a branch of a CustomObject. 15 | * 16 | */ 17 | public interface Branch 18 | { 19 | /** 20 | * Makes a CustomObjectCoordinate out of this branch. Is allowed 21 | * to return null if based on the random number generator no 22 | * branch should spawn here. 23 | * 24 | * @param world The world. 25 | * @param random The random number generator. 26 | * @param rotation Rotation of the origin of the object. 27 | * @param x X coordinate of the origin of the object. 28 | * @param y Y coordinate of the origin of the object. 29 | * @param z Z coordinate of the origin of the object. 30 | * @return The CustomObjectCoordinate of this branch. 31 | */ 32 | public CustomStructureCoordinate toCustomObjectCoordinate(String presetFolderName, Random random, Rotation rotation, int x, int y, int z, String startBO3Name, Path otgRootFolder, ILogger logger, CustomObjectManager customObjectManager, IMaterialReader materialReader, CustomObjectResourcesManager manager, IModLoadedChecker modLoadedChecker); 33 | } 34 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/structures/PlottedChunksRegion.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.structures; 2 | 3 | import java.util.Arrays; 4 | 5 | import com.pg85.otg.constants.Constants; 6 | 7 | public class PlottedChunksRegion 8 | { 9 | private boolean requiresSave = false; 10 | private boolean[][] plottedChunks = new boolean[Constants.REGION_SIZE][Constants.REGION_SIZE]; 11 | 12 | public PlottedChunksRegion() { } 13 | 14 | PlottedChunksRegion(boolean[][] plottedChunks) 15 | { 16 | this.plottedChunks = plottedChunks; 17 | } 18 | 19 | boolean requiresSave() 20 | { 21 | return this.requiresSave; 22 | } 23 | 24 | void markSaved() 25 | { 26 | this.requiresSave = false; 27 | } 28 | 29 | public boolean getChunk(int internalX, int internalZ) 30 | { 31 | return this.plottedChunks[internalX][internalZ]; 32 | } 33 | 34 | public void setChunk(int internalX, int internalZ) 35 | { 36 | this.plottedChunks[internalX][internalZ] = true; 37 | this.requiresSave = true; 38 | } 39 | 40 | public boolean[][] getArray() 41 | { 42 | return this.plottedChunks; 43 | } 44 | 45 | static PlottedChunksRegion getFilledRegion() 46 | { 47 | boolean[][] plottedChunks = new boolean[Constants.REGION_SIZE][Constants.REGION_SIZE]; 48 | for(int i = 0; i < Constants.REGION_SIZE; i++) 49 | { 50 | Arrays.fill(plottedChunks[i], true); 51 | } 52 | return new PlottedChunksRegion(plottedChunks); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/structures/StructureDataRegion.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.structures; 2 | 3 | import com.pg85.otg.constants.Constants; 4 | 5 | class StructureDataRegion 6 | { 7 | private boolean requiresSave = false; 8 | private CustomStructure[][] structures = new CustomStructure[Constants.REGION_SIZE][Constants.REGION_SIZE]; 9 | 10 | boolean requiresSave() 11 | { 12 | return this.requiresSave; 13 | } 14 | 15 | void markSaved() 16 | { 17 | this.requiresSave = false; 18 | } 19 | 20 | void markSaveRequired() 21 | { 22 | this.requiresSave = true; 23 | } 24 | 25 | CustomStructure getStructure(int internalX, int internalZ) 26 | { 27 | return this.structures[internalX][internalZ]; 28 | } 29 | 30 | void setStructure(int internalX, int internalZ, CustomStructure structure, boolean requiresSave) 31 | { 32 | this.structures[internalX][internalZ] = structure; 33 | this.requiresSave = this.requiresSave || requiresSave; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/structures/StructuredCustomObject.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.structures; 2 | 3 | import com.pg85.otg.customobject.CustomObject; 4 | import com.pg85.otg.customobject.config.CustomObjectConfigFile; 5 | import com.pg85.otg.customobject.creator.ObjectType; 6 | import com.pg85.otg.customobject.util.BoundingBox; 7 | import com.pg85.otg.interfaces.IStructuredCustomObject; 8 | import com.pg85.otg.util.bo3.Rotation; 9 | 10 | /** 11 | * Represents CustomObjects that can have other objects attached 12 | * to it making a structure. 13 | * 14 | */ 15 | public interface StructuredCustomObject extends CustomObject, IStructuredCustomObject 16 | { 17 | ObjectType getType(); 18 | CustomObjectConfigFile getConfig(); 19 | BoundingBox getBoundingBox(Rotation north); 20 | } 21 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/structures/bo4/smoothing/BlockCoordsAndNeighbours.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.structures.bo4.smoothing; 2 | 3 | import com.pg85.otg.customobject.structures.bo4.BO4CustomStructureCoordinate; 4 | 5 | class BlockCoordsAndNeighbours 6 | { 7 | public BO4CustomStructureCoordinate bO3; 8 | public int blockX; 9 | public short blockY; 10 | public int blockZ; 11 | public boolean smoothInDirection1; 12 | public boolean smoothInDirection2; 13 | public boolean smoothInDirection3; 14 | public boolean smoothInDirection4; 15 | 16 | public BlockCoordsAndNeighbours(BO4CustomStructureCoordinate bO3, int blockX, short blockY, int blockZ, boolean smoothInDirection1, boolean smoothInDirection2, boolean smoothInDirection3, boolean smoothInDirection4) 17 | { 18 | this.bO3 = bO3; 19 | this.blockX = blockX; 20 | this.blockY = blockY; 21 | this.blockZ = blockZ; 22 | this.smoothInDirection1 = smoothInDirection1; 23 | this.smoothInDirection2 = smoothInDirection2; 24 | this.smoothInDirection3 = smoothInDirection3; 25 | this.smoothInDirection4 = smoothInDirection4; 26 | } 27 | } -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/structures/bo4/smoothing/SmoothingAreaBlock.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.structures.bo4.smoothing; 2 | 3 | class SmoothingAreaBlock 4 | { 5 | enum enumSmoothingBlockType 6 | { 7 | FILLING, 8 | CUTTING 9 | } 10 | 11 | int x = 0; 12 | short y = -1; 13 | int z = 0; 14 | enumSmoothingBlockType smoothingBlockType = null; 15 | 16 | public SmoothingAreaBlock() { } 17 | 18 | public SmoothingAreaBlock(int x, short y, int z, enumSmoothingBlockType smoothingBlockType) 19 | { 20 | this.x = x; 21 | this.y = y; 22 | this.z = z; 23 | this.smoothingBlockType = smoothingBlockType; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/util/BO3Enums.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.util; 2 | 3 | import com.pg85.otg.constants.Constants; 4 | 5 | public class BO3Enums 6 | { 7 | // The spawn height 8 | public static enum SpawnHeightEnum 9 | { 10 | randomY, 11 | highestBlock, 12 | highestSolidBlock 13 | } 14 | 15 | // How an object should be extended to a surface 16 | public static enum ExtrudeMode 17 | { 18 | None(-1, -1), 19 | BottomDown(Constants.WORLD_HEIGHT - 1, Constants.WORLD_DEPTH), 20 | TopUp(Constants.WORLD_DEPTH, Constants.WORLD_HEIGHT - 1); 21 | 22 | /** 23 | * Defines where calculation should begin 24 | */ 25 | private int startingHeight = 0; 26 | 27 | /** 28 | * Defines where calculation should end 29 | */ 30 | private int endingHeight = 0; 31 | 32 | ExtrudeMode(int heightStart, int heightEnd) 33 | { 34 | this.startingHeight = heightStart; 35 | this.endingHeight = heightEnd; 36 | } 37 | 38 | public int getStartingHeight() 39 | { 40 | return startingHeight; 41 | } 42 | 43 | public int getEndingHeight() 44 | { 45 | return endingHeight; 46 | } 47 | } 48 | 49 | // What to do when outside the source block 50 | public static enum OutsideSourceBlock 51 | { 52 | dontPlace, 53 | placeAnyway 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /common/common-customobject/src/main/java/com/pg85/otg/customobject/util/Corner.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.customobject.util; 2 | 3 | public class Corner 4 | { 5 | public final int x; 6 | public final int y; 7 | public final int z; 8 | 9 | public Corner(int x, int y, int z) 10 | { 11 | this.x = x; 12 | this.y = y; 13 | this.z = z; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /common/common-generator/build.gradle: -------------------------------------------------------------------------------- 1 | // Build script for the Common parts of OpenTerrainGenerator 2 | 3 | plugins { 4 | id 'java' 5 | } 6 | 7 | // Project properties 8 | archivesBaseName = "openterraingenerator-common-generator" 9 | description = "Core files of OpenTerrainGenerator" 10 | 11 | repositories 12 | { 13 | jcenter() 14 | mavenLocal() 15 | mavenCentral() 16 | } 17 | 18 | dependencies 19 | { 20 | compile project(':common:common-util') 21 | compile project(':common:common-config') 22 | compile ( 23 | 'it.unimi.dsi:fastutil:8.2.1', 24 | 'com.google.guava:guava:23.0' 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/AddIslandsLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers; 2 | 3 | import static com.pg85.otg.gen.biome.layers.BiomeLayers.LAND_BIT; 4 | 5 | import com.pg85.otg.gen.biome.layers.type.DiagonalCrossSamplingLayer; 6 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 7 | 8 | /** 9 | * Fuzzes the edge of land and ocean by adding islands and adding ocean. 10 | */ 11 | class AddIslandsLayer implements DiagonalCrossSamplingLayer 12 | { 13 | @Override 14 | public int sample(LayerSampleContext context, int x, int z, int sw, int se, int ne, int nw, int center) 15 | { 16 | // Initialize the sample as always land... for some reason. 17 | int sample = center | LAND_BIT; 18 | 19 | // If the center is not land and one of the corners is, set it to ocean 2/3 of the time. 20 | if (!BiomeLayers.isLand(center) && (BiomeLayers.isLand(nw) || BiomeLayers.isLand(ne) || BiomeLayers.isLand(sw) || BiomeLayers.isLand(se))) 21 | { 22 | if (context.nextInt(3) != 0) 23 | { 24 | sample ^= LAND_BIT; 25 | } 26 | // If the center is land and one of the corners isn't, there's a 1/5 chance to set it to ocean. 27 | } else if (BiomeLayers.isLand(center) && (!BiomeLayers.isLand(nw) || !BiomeLayers.isLand(ne) || !BiomeLayers.isLand(sw) || !BiomeLayers.isLand(se))) 28 | { 29 | if (context.nextInt(5) == 0) 30 | { 31 | sample ^= LAND_BIT; 32 | } 33 | } 34 | else if (!BiomeLayers.isLand(center)) 35 | { 36 | sample ^= LAND_BIT; 37 | } 38 | 39 | return sample; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/ApplyOceanLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers; 2 | 3 | import com.pg85.otg.gen.biome.layers.type.ParentedLayer; 4 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 5 | import com.pg85.otg.interfaces.ILayerSampler; 6 | 7 | public class ApplyOceanLayer implements ParentedLayer 8 | { 9 | //private final BiomeLayerData data; 10 | 11 | public ApplyOceanLayer(BiomeLayerData data) 12 | { 13 | //this.data = data; 14 | } 15 | 16 | @Override 17 | public int sample(LayerSampleContext context, ILayerSampler parent, int x, int z) 18 | { 19 | int sample = parent.sample(x, z); 20 | 21 | // If there is no land bit, leave the biome bit at 0. 22 | // 0 is the world's ocean biome, set by PresetLoader 23 | // when registering biomes. 24 | 25 | // TODO: Do we still need this class? 26 | 27 | return sample; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/BiomeLayerBase.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers; 2 | 3 | import com.pg85.otg.gen.biome.layers.type.ParentedLayer; 4 | 5 | /** 6 | * Places the biomes at a specific depth, given the biome groups. 7 | */ 8 | abstract class BiomeLayerBase implements ParentedLayer 9 | { 10 | protected final BiomeLayerData data; 11 | protected final int depth; 12 | 13 | BiomeLayerBase(BiomeLayerData data, int depth) 14 | { 15 | this.data = data; 16 | this.depth = depth; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/FinalizeLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers; 2 | 3 | import com.pg85.otg.gen.biome.layers.type.ParentedLayer; 4 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 5 | import com.pg85.otg.interfaces.ILayerSampler; 6 | 7 | /** 8 | * Gets the biome id of the sample of this position by removing the extra land and other data. 9 | */ 10 | class FinalizeLayer implements ParentedLayer 11 | { 12 | private final boolean riversEnabled; 13 | private int[] riverBiomes; 14 | 15 | public FinalizeLayer(boolean riversEnabled, int[] riverBiomes) 16 | { 17 | this.riversEnabled = riversEnabled; 18 | this.riverBiomes = riverBiomes; 19 | } 20 | 21 | @Override 22 | public int sample(LayerSampleContext context, ILayerSampler parent, int x, int z) 23 | { 24 | int sample = parent.sample(x, z); 25 | 26 | // Remove all the metadata bits from the sample 27 | sample = sample & BiomeLayers.BIOME_BITS; 28 | 29 | if (this.riversEnabled && (sample & BiomeLayers.RIVER_BITS) != 0) 30 | { 31 | int riverBiomeId = this.riverBiomes[sample]; 32 | if(riverBiomeId >= 0) 33 | { 34 | sample = riverBiomeId; 35 | } 36 | } 37 | 38 | return sample; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/FinalizeWithRiverLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers; 2 | 3 | import com.pg85.otg.gen.biome.layers.type.MergingLayer; 4 | import com.pg85.otg.gen.biome.layers.util.LayerRandomnessSource; 5 | import com.pg85.otg.interfaces.ILayerSampler; 6 | 7 | /** 8 | * Gets the biome id of the sample of this position by removing the extra land and other data. 9 | */ 10 | class FinalizeWithRiverLayer implements MergingLayer 11 | { 12 | private final boolean riversEnabled; 13 | private final int[] riverBiomes; 14 | 15 | public FinalizeWithRiverLayer(boolean riversEnabled, int[] riverBiomes) 16 | { 17 | this.riversEnabled = riversEnabled; 18 | this.riverBiomes = riverBiomes; 19 | } 20 | 21 | @Override 22 | public int sample(LayerRandomnessSource context, ILayerSampler mainSampler, ILayerSampler riverSampler, int x, int z) 23 | { 24 | int sample = mainSampler.sample(x, z); 25 | 26 | // Remove all the metadata bits from the sample 27 | sample = sample & BiomeLayers.BIOME_BITS; 28 | 29 | if (this.riversEnabled) 30 | { 31 | int currentRiver = riverSampler.sample(x, z); 32 | if((currentRiver & BiomeLayers.RIVER_BITS) != 0) 33 | { 34 | int riverBiomeId = this.riverBiomes[sample]; 35 | if(riverBiomeId >= 0) 36 | { 37 | sample = riverBiomeId; 38 | } 39 | } 40 | } 41 | 42 | return sample; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/FuzzyScaleLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers; 2 | 3 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 4 | 5 | class FuzzyScaleLayer extends ScaleLayer 6 | { 7 | @Override 8 | protected int sample(LayerSampleContext context, int i, int j, int k, int l) 9 | { 10 | return context.choose(i, j, k, l); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/IceLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers; 2 | 3 | import com.pg85.otg.constants.SettingsEnums.BiomeMode; 4 | import com.pg85.otg.gen.biome.layers.type.ParentedLayer; 5 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 6 | import com.pg85.otg.interfaces.ILayerSampler; 7 | 8 | /** 9 | * Sets ice based on the provided rarity. 10 | */ 11 | class IceLayer implements ParentedLayer 12 | { 13 | private final int rarity; 14 | 15 | IceLayer(BiomeLayerData data) 16 | { 17 | if(data.biomeMode == BiomeMode.NoGroups) 18 | { 19 | NewBiomeGroup iceGroup = data.groupRegistry.get(2); 20 | // Scale rarity from the world config 21 | this.rarity = 101 - (iceGroup == null ? 0 : iceGroup.rarity); 22 | } else { 23 | this.rarity = 10; 24 | } 25 | } 26 | 27 | @Override 28 | public int sample(LayerSampleContext context, ILayerSampler parent, int x, int z) 29 | { 30 | int sample = parent.sample(x, z); 31 | 32 | // Set ice based on the rarity 33 | // TODO: For 1.12, we initliased the chunkseed here with inverted coordinates, 34 | // so initChunkSeed(z + zi, x + xi);, do we need to do the same here? 35 | if (context.nextInt(this.rarity) == 0) 36 | { 37 | return sample | BiomeLayers.ICE_BIT; 38 | } 39 | 40 | return sample; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/InitializationLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers; 2 | 3 | import com.pg85.otg.gen.biome.layers.type.InitLayer; 4 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 5 | 6 | /** 7 | * Initializes the biome sample for biome generation. 8 | */ 9 | class InitializationLayer implements InitLayer 10 | { 11 | @Override 12 | public int sample(LayerSampleContext context, int x, int y) 13 | { 14 | return 0; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/MergeOceanTemperatureLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers; 2 | 3 | import com.pg85.otg.gen.biome.layers.type.MergingLayer; 4 | import com.pg85.otg.gen.biome.layers.util.LayerRandomnessSource; 5 | import com.pg85.otg.interfaces.ILayerSampler; 6 | 7 | public class MergeOceanTemperatureLayer implements MergingLayer 8 | { 9 | @Override 10 | public int sample(LayerRandomnessSource context, ILayerSampler mainSampler, ILayerSampler oceanSampler, int x, int z) 11 | { 12 | int sample = mainSampler.sample(x, z); 13 | 14 | // If we're not land, return ocean 15 | if (!BiomeLayers.isLand(sample)) 16 | { 17 | return oceanSampler.sample(x, z); 18 | } 19 | 20 | // Return biome sample 21 | return sample; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/OceanTemperatureLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers; 2 | 3 | import com.pg85.otg.gen.biome.layers.type.InitLayer; 4 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 5 | 6 | public class OceanTemperatureLayer implements InitLayer 7 | { 8 | private final BiomeLayerData data; 9 | 10 | public OceanTemperatureLayer(BiomeLayerData data) 11 | { 12 | this.data = data; 13 | } 14 | 15 | @Override 16 | public int sample(LayerSampleContext context, int x, int z) 17 | { 18 | double noise = context.getNoiseSampler().sample((double)x / 8.0, (double)z / 8.0D, 0.0D, 0.0D, 0.0D); 19 | if (noise > 0.4D) 20 | { 21 | return this.data.oceanTemperatures[0]; // Warm ocean 22 | } 23 | else if (noise > 0.2D) 24 | { 25 | return this.data.oceanTemperatures[1]; // Lukewarm ocean 26 | } 27 | else if (noise < -0.4D) 28 | { 29 | return this.data.oceanTemperatures[2]; // Frozen ocean 30 | } 31 | else if (noise < -0.2D) 32 | { 33 | return this.data.oceanTemperatures[3]; // Cold ocean 34 | } 35 | 36 | return 0; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/RiverInitLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers; 2 | 3 | import com.pg85.otg.gen.biome.layers.type.ParentedLayer; 4 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 5 | import com.pg85.otg.interfaces.ILayerSampler; 6 | 7 | public class RiverInitLayer implements ParentedLayer 8 | { 9 | @Override 10 | public int sample(LayerSampleContext context, ILayerSampler parent, int x, int z) 11 | { 12 | int currentPiece = parent.sample(x, z); 13 | // TODO: For 1.12, we initliased the chunkseed here with inverted coordinates, 14 | // so initChunkSeed(zi + z, xi + x);, do we need to do the same here? 15 | if (context.nextInt(2) == 0) 16 | { 17 | currentPiece |= BiomeLayers.RIVER_BIT_ONE; 18 | } else { 19 | currentPiece |= BiomeLayers.RIVER_BIT_TWO; 20 | } 21 | 22 | return currentPiece; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/RiverLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers; 2 | 3 | import com.pg85.otg.gen.biome.layers.type.CrossSamplingLayer; 4 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 5 | 6 | public class RiverLayer implements CrossSamplingLayer 7 | { 8 | @Override 9 | public int sample(LayerSampleContext context, int x, int z, int n, int e, int s, int w, int center) 10 | { 11 | int northCheck = n & BiomeLayers.RIVER_BITS; 12 | int southCheck = s & BiomeLayers.RIVER_BITS; 13 | int eastCheck = e & BiomeLayers.RIVER_BITS; 14 | int westCheck = w & BiomeLayers.RIVER_BITS; 15 | int centerCheck = center & BiomeLayers.RIVER_BITS; 16 | if ( 17 | (centerCheck == 0) || 18 | (westCheck == 0) || 19 | (eastCheck == 0) || 20 | (northCheck == 0) || 21 | (southCheck == 0) 22 | ) 23 | { 24 | center |= BiomeLayers.RIVER_BITS; 25 | } 26 | else if ( 27 | (centerCheck != westCheck) || 28 | (centerCheck != northCheck) || 29 | (centerCheck != eastCheck) || 30 | (centerCheck != southCheck) 31 | ) 32 | { 33 | center |= BiomeLayers.RIVER_BITS; 34 | } else { 35 | // Remove any river bits entirely(?) 36 | center |= BiomeLayers.RIVER_BITS; 37 | center ^= BiomeLayers.RIVER_BITS; 38 | } 39 | return center; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/type/CrossSamplingLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers.type; 2 | 3 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 4 | import com.pg85.otg.interfaces.ILayerSampler; 5 | 6 | /** 7 | * The type for layers that sample in a cross/plus formation. 8 | * This is useful for getting all the neighboring samples from a specific x and z coordinate. 9 | * Unfortunately, this will cause some serious slowdown so it needs to be used with care. 10 | */ 11 | public interface CrossSamplingLayer extends ParentedLayer { 12 | int sample(LayerSampleContext context, int x, int z, int n, int e, int s, int w, int center); 13 | 14 | default int sample(LayerSampleContext context, ILayerSampler parent, int x, int z) { 15 | return this.sample(context, x, z, 16 | parent.sample(x, z - 1), // North 17 | parent.sample(x + 1, z), // East 18 | parent.sample(x, z + 1), // South 19 | parent.sample(x - 1, z), // West 20 | parent.sample(x, z)); // Center 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/type/DiagonalCrossSamplingLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers.type; 2 | 3 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 4 | import com.pg85.otg.interfaces.ILayerSampler; 5 | 6 | /** 7 | * The type for layers that sample in a diagonal cross or X formation. 8 | * This is useful for getting all the corner samples from a specific x and z coordinate. 9 | * Unfortunately, this will cause some serious slowdown so it needs to be used with care. 10 | */ 11 | public interface DiagonalCrossSamplingLayer extends ParentedLayer { 12 | int sample(LayerSampleContext context, int x, int z, int sw, int se, int ne, int nw, int center); 13 | 14 | default int sample(LayerSampleContext context, ILayerSampler parent, int x, int z) { 15 | return this.sample(context, x, z, 16 | parent.sample(x - 1, z + 1), // Southwest 17 | parent.sample(x + 1, z + 1), // Southeast 18 | parent.sample(x + 1, z - 1), // Northeast 19 | parent.sample(x - 1, z - 1), // Northwest 20 | parent.sample(x, z)); // Center 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/type/InitLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers.type; 2 | 3 | import com.pg85.otg.gen.biome.layers.util.LayerFactory; 4 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 5 | import com.pg85.otg.interfaces.ILayerSampler; 6 | 7 | /** 8 | * The type for layers that create a new layer generation stack. 9 | */ 10 | public interface InitLayer 11 | { 12 | default LayerFactory create(LayerSampleContext context) 13 | { 14 | return () -> context.createSampler((x, z) -> { 15 | context.initSeed(x, z); 16 | return this.sample(context, x, z); 17 | }); 18 | } 19 | 20 | int sample(LayerSampleContext context, int x, int z); 21 | } 22 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/type/MergingLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers.type; 2 | 3 | import com.pg85.otg.gen.biome.layers.util.LayerFactory; 4 | import com.pg85.otg.gen.biome.layers.util.LayerRandomnessSource; 5 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 6 | import com.pg85.otg.interfaces.ILayerSampler; 7 | 8 | public interface MergingLayer 9 | { 10 | default LayerFactory create(LayerSampleContext context, LayerFactory layer1, LayerFactory layer2) 11 | { 12 | return () -> { 13 | R layerSampler = layer1.make(); 14 | R layerSampler2 = layer2.make(); 15 | return context.createSampler((x, z) -> { 16 | context.initSeed(x, z); 17 | return this.sample(context, layerSampler, layerSampler2, x, z); 18 | }, layerSampler, layerSampler2); 19 | }; 20 | } 21 | 22 | int sample(LayerRandomnessSource context, ILayerSampler sampler1, ILayerSampler sampler2, int x, int z); 23 | } 24 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/type/ParentedLayer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers.type; 2 | 3 | import com.pg85.otg.gen.biome.layers.util.LayerFactory; 4 | import com.pg85.otg.gen.biome.layers.util.LayerSampleContext; 5 | import com.pg85.otg.interfaces.ILayerSampler; 6 | 7 | /** 8 | * The type for layers that modify the output based on the previous layer. 9 | */ 10 | public interface ParentedLayer 11 | { 12 | default LayerFactory create(LayerSampleContext context, LayerFactory parent) 13 | { 14 | return () -> { 15 | R layerSampler = parent.make(); 16 | return context.createSampler((x, z) -> { 17 | context.initSeed(x, z); 18 | return this.sample(context, layerSampler, x, z); 19 | }, layerSampler); 20 | }; 21 | } 22 | 23 | int sample(LayerSampleContext context, ILayerSampler parent, int x, int z); 24 | } 25 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/util/LayerFactory.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers.util; 2 | 3 | import com.pg85.otg.interfaces.ILayerSampler; 4 | 5 | public interface LayerFactory 6 | { 7 | A make(); 8 | } 9 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/util/LayerOperator.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers.util; 2 | 3 | public interface LayerOperator 4 | { 5 | int apply(int x, int z); 6 | } 7 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/util/LayerRandomnessSource.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers.util; 2 | 3 | import com.pg85.otg.gen.noise.PerlinNoiseSampler; 4 | 5 | public interface LayerRandomnessSource 6 | { 7 | int nextInt(int bound); 8 | 9 | PerlinNoiseSampler getNoiseSampler(); 10 | } 11 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/biome/layers/util/LayerSampleContext.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.biome.layers.util; 2 | 3 | import com.pg85.otg.interfaces.ILayerSampler; 4 | 5 | public interface LayerSampleContext extends LayerRandomnessSource 6 | { 7 | void initSeed(long x, long y); 8 | 9 | R createSampler(LayerOperator operator); 10 | 11 | default R createSampler(LayerOperator operator, R parent) 12 | { 13 | return this.createSampler(operator); 14 | } 15 | 16 | default R createSampler(LayerOperator operator, R layerSampler, R layerSampler2) 17 | { 18 | return this.createSampler(operator); 19 | } 20 | 21 | default int choose(int a, int b) 22 | { 23 | return this.nextInt(2) == 0 ? a : b; 24 | } 25 | 26 | default int choose(int a, int b, int c, int d) 27 | { 28 | int i = this.nextInt(4); 29 | if (i == 0) 30 | { 31 | return a; 32 | } 33 | else if (i == 1) 34 | { 35 | return b; 36 | } else { 37 | return i == 2 ? c : d; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/noise/legacy/NoiseGeneratorSurfacePatchOctaves.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.noise.legacy; 2 | 3 | import java.util.Random; 4 | 5 | @Deprecated 6 | public class NoiseGeneratorSurfacePatchOctaves 7 | { 8 | private NoiseGeneratorSurfacePatch[] noiseArray; 9 | private int numOctaves; 10 | 11 | public NoiseGeneratorSurfacePatchOctaves(Random random, int numOctaves) 12 | { 13 | this.numOctaves = numOctaves; 14 | this.noiseArray = new NoiseGeneratorSurfacePatch[numOctaves]; 15 | for (int i = 0; i < numOctaves; i++) 16 | this.noiseArray[i] = new NoiseGeneratorSurfacePatch(random); 17 | } 18 | 19 | /** 20 | * Convenience Method for getting simple noise at a specific x and z, composites noise from 21 | * {@code numOctaves} octaves. 22 | * @param x The x coordinate 23 | * @param z The z coordinate 24 | * @return the noise value of y 25 | */ 26 | public double getYNoise(double x, double z) 27 | { 28 | double resultingY = 0.0D; 29 | double octaveAmplitude = 1.0D; 30 | 31 | for (int var9 = 0; var9 < this.numOctaves; ++var9) 32 | { 33 | resultingY += this.noiseArray[var9].getYNoise(x * octaveAmplitude, z * octaveAmplitude) / octaveAmplitude; 34 | octaveAmplitude /= 2.0D; 35 | } 36 | 37 | return resultingY; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/resource/DungeonResource.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.resource; 2 | 3 | import com.pg85.otg.constants.Constants; 4 | import com.pg85.otg.exceptions.InvalidConfigException; 5 | import com.pg85.otg.interfaces.IBiomeConfig; 6 | import com.pg85.otg.interfaces.ILogger; 7 | import com.pg85.otg.interfaces.IMaterialReader; 8 | import com.pg85.otg.interfaces.IWorldGenRegion; 9 | import com.pg85.otg.util.helpers.RandomHelper; 10 | 11 | import java.util.List; 12 | import java.util.Random; 13 | 14 | public class DungeonResource extends FrequencyResourceBase 15 | { 16 | private final int maxAltitude; 17 | private final int minAltitude; 18 | 19 | public DungeonResource(IBiomeConfig biomeConfig, List args, ILogger logger, IMaterialReader materialReader) throws InvalidConfigException 20 | { 21 | super(biomeConfig, args, logger, materialReader); 22 | assureSize(3, args); 23 | 24 | this.frequency = 1; 25 | this.rarity = readDouble(args.get(0), 1, Integer.MAX_VALUE); 26 | this.minAltitude = readInt(args.get(1), Constants.WORLD_DEPTH, Constants.WORLD_HEIGHT - 1); 27 | this.maxAltitude = readInt(args.get(2), minAltitude, Constants.WORLD_HEIGHT - 1); 28 | } 29 | 30 | @Override 31 | public String toString() 32 | { 33 | return "Dungeon(" + this.rarity + "," + this.minAltitude + "," + this.maxAltitude + ")"; 34 | } 35 | 36 | @Override 37 | public void spawn(IWorldGenRegion world, Random random, int x, int z) 38 | { 39 | int y = RandomHelper.numberInRange(random, this.minAltitude, this.maxAltitude); 40 | world.placeDungeon(random, world.getDecorationArea().getChunkBeingDecoratedCenterX(), y, world.getDecorationArea().getChunkBeingDecoratedCenterZ()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/resource/IBasicResource.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.resource; 2 | 3 | import java.util.Random; 4 | 5 | import com.pg85.otg.interfaces.ILogger; 6 | import com.pg85.otg.interfaces.IMaterialReader; 7 | import com.pg85.otg.interfaces.IWorldGenRegion; 8 | 9 | // Biome resources are spawned during decoration, for each chunk being decorated, resources can 10 | // spawn blocks with a 2x2 chunk area (TODO: Will need to move to 3x3 for 1.16). For each resource, 11 | // processForChunkDecoration is called when a chunk is decorated. By default, this calls 12 | // spawnForChunkDecoration() to perform a single spawn attempt for the resource. Most of OTG's 13 | // biome resources are FrequencyResourceBase resources, that use rarity/frequency in 14 | // processForChunkDecoration to determine the number of calls to spawnForChunkDecoration for each 15 | // chunk, as well as randomising coordinates. Other resources that don't rely on frequency/rarity 16 | // setting implement their own processForChunkDecoration/spawnForChunkDecoration logic. 17 | // * Note: Resources that use custom objects like CustomObject/CustomStructure/Tree/Sapling are in 18 | // the common-customobject project. 19 | public interface IBasicResource 20 | { 21 | default void processForChunkDecoration(IWorldGenRegion worldGenregion, Random random, ILogger logger, IMaterialReader materialReader) 22 | { 23 | // TODO: Fire Forge resource decoration events, when they're available. 24 | spawnForChunkDecoration(worldGenregion, random, logger, materialReader); 25 | } 26 | 27 | void spawnForChunkDecoration(IWorldGenRegion worldGenRegion, Random random, ILogger logger, IMaterialReader materialReader); 28 | } 29 | -------------------------------------------------------------------------------- /common/common-generator/src/main/java/com/pg85/otg/gen/resource/RegistryResource.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.gen.resource; 2 | 3 | import java.util.List; 4 | 5 | import com.pg85.otg.config.biome.BiomeResourceBase; 6 | import com.pg85.otg.exceptions.InvalidConfigException; 7 | import com.pg85.otg.interfaces.IBiomeConfig; 8 | import com.pg85.otg.interfaces.ILogger; 9 | import com.pg85.otg.interfaces.IMaterialReader; 10 | 11 | public class RegistryResource extends BiomeResourceBase 12 | { 13 | private final String registryKey; 14 | private final String decorationStage; 15 | 16 | public RegistryResource(IBiomeConfig biomeConfig, List args, ILogger logger, IMaterialReader materialReader) throws InvalidConfigException 17 | { 18 | super(biomeConfig, args, logger, materialReader); 19 | assureSize(1, args); 20 | 21 | this.registryKey = args.get(0); 22 | if(args.size() > 1) 23 | { 24 | this.decorationStage = args.get(1); 25 | } else { 26 | this.decorationStage = "VEGETAL_DECORATION"; 27 | } 28 | } 29 | 30 | public String getDecorationStage() 31 | { 32 | return this.decorationStage; 33 | } 34 | 35 | public String getFeatureKey() 36 | { 37 | return this.registryKey; 38 | } 39 | 40 | @Override 41 | public String toString() 42 | { 43 | return "Registry(" + this.registryKey + "," + this.decorationStage + ")"; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /common/common-util/build.gradle: -------------------------------------------------------------------------------- 1 | // Build script for the Common parts of OpenTerrainGenerator 2 | 3 | plugins { 4 | id 'java' 5 | } 6 | 7 | // Project properties 8 | archivesBaseName = "openterraingenerator-common-util" 9 | description = "Core files of OpenTerrainGenerator" 10 | 11 | repositories 12 | { 13 | jcenter() 14 | mavenLocal() 15 | mavenCentral() 16 | } 17 | 18 | dependencies {} 19 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/exceptions/InvalidConfigException.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.exceptions; 2 | 3 | @SuppressWarnings("serial") 4 | public class InvalidConfigException extends Exception 5 | { 6 | public InvalidConfigException(String string) 7 | { 8 | super(string); 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/IBiome.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | public interface IBiome 4 | { 5 | IBiomeConfig getBiomeConfig(); 6 | 7 | /** 8 | * Gets the temperature at the given position, if this biome would be 9 | * there. This temperature is based on a base temperature value, but it 10 | * will be lower at higher altitudes. 11 | */ 12 | float getTemperatureAt(int x, int y, int z); 13 | } 14 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/IBiomeRegistryProvider.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | public interface IBiomeRegistryProvider 4 | { 5 | IBiome getBiomeByNameOrNull(String biomeName); 6 | } 7 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/IBiomeResourceLocation.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | public interface IBiomeResourceLocation 4 | { 5 | String toResourceLocationString(); 6 | String getPresetFolderName(); 7 | } 8 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/ICachedBiomeProvider.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | import com.pg85.otg.util.ChunkCoordinate; 4 | 5 | public interface ICachedBiomeProvider 6 | { 7 | public IBiomeConfig[] getBiomeConfigsForChunk(ChunkCoordinate chunkCoordinate); 8 | public IBiome[] getBiomesForChunk(ChunkCoordinate chunkCoordinate); 9 | public IBiome[] getBiomesForChunks(ChunkCoordinate chunkCoord, int widthHeightInChunks); 10 | public IBiomeConfig getBiomeConfig(int x, int z, boolean cacheChunk); 11 | public IBiomeConfig getBiomeConfig(int x, int z); 12 | public IBiome getBiome(int x, int z); 13 | 14 | public IBiomeConfig[] getNoiseBiomeConfigsForRegion(int noiseStartX, int noiseStartZ, int widthHeight); 15 | public IBiomeConfig getNoiseBiomeConfig(int x, int z, boolean cacheChunk); 16 | public IBiome getNoiseBiome(int x, int z); 17 | } 18 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/IChunkDecorator.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | public interface IChunkDecorator 4 | { 5 | Object getLockingObject(); 6 | 7 | boolean isDecorating(); 8 | 9 | public void beginSave(); 10 | 11 | public void endSave(); 12 | 13 | boolean getIsSaveRequired(); 14 | } 15 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/ICustomObject.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | public interface ICustomObject 4 | { 5 | public String getName(); 6 | } 7 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/ICustomObjectManager.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | // TODO: Does nothing, CustomStructureGen and BO4Config cast ICustomObjectManager to CustomObjectManager atm, 4 | // since we'd need to create a whole bunch of interfaces to abstract out CustomObjectCollection's object loading methods. :( 5 | public interface ICustomObjectManager 6 | { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/ICustomObjectResourcesManager.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | // TODO: Does nothing, CustomStructureGen casts ICustomObjectManager/ICustomObjectResourcesManager to 4 | // CustomObjectManager/CustomObjectResourcesManager atm, since we'd need to create a whole bunch of 5 | // interfaces to abstract out CustomObjectCollection's object loading methods. :( 6 | public interface ICustomObjectResourcesManager 7 | { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/ICustomStructureGen.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | import java.nio.file.Path; 4 | import java.util.List; 5 | 6 | public interface ICustomStructureGen 7 | { 8 | List getObjects(String presetFolderName, Path otgRootFolder, ILogger logger, ICustomObjectManager customObjectManager, IMaterialReader materialReader, ICustomObjectResourcesManager manager, IModLoadedChecker modLoadedChecker); 9 | Double getObjectChance(int i); 10 | String getObjectName(int i); 11 | boolean isEmpty(); 12 | } 13 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/IEntityFunction.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | import com.pg85.otg.util.nbt.NamedBinaryTag; 4 | 5 | public interface IEntityFunction 6 | { 7 | public double getX(); 8 | public int getY(); 9 | public double getZ(); 10 | public int getGroupSize(); 11 | public String getNameTagOrNBTFileName(); 12 | public String getResourceLocation(); 13 | public String getMetaData(); 14 | NamedBinaryTag getNBTTag(); 15 | public String makeString(); 16 | } 17 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/ILayerSampler.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | public interface ILayerSampler 4 | { 5 | int sample(int x, int z); 6 | } 7 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/ILayerSource.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | public interface ILayerSource 4 | { 5 | ILayerSampler getSampler(); 6 | } 7 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/ILogger.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | import com.pg85.otg.util.logging.LogCategory; 4 | import com.pg85.otg.util.logging.LogLevel; 5 | 6 | public interface ILogger 7 | { 8 | public void init(LogLevel level, boolean logCustomObjects, boolean logStructurePlotting, boolean logConfigs, boolean logPerformance, boolean logBiomeRegistry, boolean logDecoration, boolean logMobs, String logPresets); 9 | 10 | public boolean getLogCategoryEnabled(LogCategory category); 11 | public void log(LogLevel level, LogCategory category, String message); 12 | public void printStackTrace(LogLevel marker, LogCategory category, Exception e); 13 | public boolean canLogForPreset(String presetFolderName); 14 | } 15 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/IMaterialReader.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | import com.pg85.otg.exceptions.InvalidConfigException; 4 | import com.pg85.otg.util.materials.LocalMaterialData; 5 | import com.pg85.otg.util.materials.LocalMaterialTag; 6 | 7 | public interface IMaterialReader 8 | { 9 | public LocalMaterialData readMaterial(String material) throws InvalidConfigException; 10 | public LocalMaterialTag readTag(String tag) throws InvalidConfigException; 11 | } 12 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/IModLoadedChecker.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | public interface IModLoadedChecker 4 | { 5 | boolean isModLoaded(String mod); 6 | } 7 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/IPluginConfig.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | import com.pg85.otg.constants.SettingsEnums.ConfigMode; 4 | import com.pg85.otg.constants.SettingsEnums.LogLevels; 5 | 6 | /** 7 | * OTG.ini / PluginConfig classes 8 | * 9 | * IPluginConfig defines anything that's used/exposed between projects. 10 | * PluginConfigBase implements anything needed for IWorldConfig. 11 | * PluginConfig contains only fields/methods used for io/serialisation/instantiation. 12 | * 13 | * PluginConfig should be used only in common-core and platform-specific layers, when reading/writing settings on app start. 14 | * IPluginConfig should be used wherever settings are used in code. 15 | */ 16 | public interface IPluginConfig 17 | { 18 | public LogLevels getLogLevel(); 19 | public int getMaxWorkerThreads(); 20 | public boolean getDeveloperModeEnabled(); 21 | public boolean logCustomObjects(); 22 | public boolean logStructurePlotting(); 23 | public boolean logConfigs(); 24 | public boolean logPerformance(); 25 | public boolean logDecoration(); 26 | public boolean logBiomeRegistry(); 27 | public boolean getDecorationEnabled(); 28 | public boolean logMobs(); 29 | public String logPresets(); 30 | public ConfigMode getSettingsMode(); 31 | } 32 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/ISaplingSpawner.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | public interface ISaplingSpawner 4 | { 5 | // TODO: Create interfaces for CustomStructureCache/CustomObjectManager so we can properly 6 | // abstract out common-customobjects, using casts in ChunkDecorator and for Saplings atm. 7 | boolean hasWideTrunk(); 8 | } 9 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/IStructuredCustomObject.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | public interface IStructuredCustomObject extends ICustomObject 4 | { 5 | String getName(); 6 | } 7 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/interfaces/ISurfaceGeneratorNoiseProvider.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.interfaces; 2 | 3 | public interface ISurfaceGeneratorNoiseProvider { 4 | public double getBiomeBlocksNoiseValue(int xInWorld, int zInWorld); 5 | } 6 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/BlockPos2D.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util; 2 | 3 | public class BlockPos2D 4 | { 5 | public final int x; 6 | public final int z; 7 | 8 | public BlockPos2D(int x, int z) 9 | { 10 | this.x = x; 11 | this.z = z; 12 | } 13 | 14 | public boolean equals(Object other) 15 | { 16 | if(this == other) 17 | { 18 | return true; 19 | } 20 | if(other instanceof BlockPos2D) 21 | { 22 | if(((BlockPos2D)other).x == this.x && ((BlockPos2D)other).z == this.z) 23 | { 24 | return true; 25 | } 26 | } 27 | return false; 28 | } 29 | } -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/FifoMap.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util; 2 | 3 | import java.util.Iterator; 4 | import java.util.LinkedHashMap; 5 | 6 | public class FifoMap extends LinkedHashMap 7 | { 8 | private int max; 9 | 10 | /** 11 | * 12 | */ 13 | private static final long serialVersionUID = 1L; 14 | 15 | public FifoMap (int max){ 16 | super(max + 1); 17 | this.max = max; 18 | 19 | } 20 | 21 | @Override 22 | public U put (T key, U value) { 23 | U forReturn = super.put(key, value); 24 | if (super.size() > max){ 25 | removeEldest(); 26 | } 27 | 28 | return forReturn; 29 | } 30 | 31 | private void removeEldest() { 32 | Iterator iterator = this.keySet().iterator(); 33 | if (iterator.hasNext()){ 34 | this.remove(iterator.next()); 35 | } 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/MutableBoolean.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util; 2 | 3 | public final class MutableBoolean 4 | { 5 | private boolean value; 6 | 7 | public MutableBoolean(boolean value) { 8 | this.value = value; 9 | } 10 | 11 | public boolean isValue() 12 | { 13 | return value; 14 | } 15 | 16 | public void setValue(boolean value) 17 | { 18 | this.value = value; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/OTGDirection.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util; 2 | 3 | public enum OTGDirection 4 | { 5 | DOWN(0, -1, 0), 6 | UP(0, 1, 0), 7 | NORTH(0, 0, -1), 8 | SOUTH(0, 0, 1), 9 | WEST(-1, 0, 0), 10 | EAST(1, 0, 0); 11 | 12 | private final int dx; 13 | private final int dy; 14 | private final int dz; 15 | 16 | OTGDirection(int dx, int dy, int dz) { 17 | this.dx = dx; 18 | this.dy = dy; 19 | this.dz = dz; 20 | } 21 | 22 | public int getX() 23 | { 24 | return dx; 25 | } 26 | 27 | public int getY() 28 | { 29 | return dy; 30 | } 31 | 32 | public int getZ() 33 | { 34 | return dz; 35 | } 36 | 37 | public OTGDirection getClockWise() { 38 | switch (this) { 39 | case NORTH: 40 | return EAST; 41 | case SOUTH: 42 | return WEST; 43 | case WEST: 44 | return NORTH; 45 | case EAST: 46 | return SOUTH; 47 | default: 48 | throw new IllegalStateException("Unable to get CW direction of " + this); 49 | } 50 | } 51 | 52 | public OTGDirection getCounterClockWise() { 53 | switch (this) { 54 | case NORTH: 55 | return WEST; 56 | case SOUTH: 57 | return EAST; 58 | case WEST: 59 | return SOUTH; 60 | case EAST: 61 | return NORTH; 62 | default: 63 | throw new IllegalStateException("Unable to get CCW direction of " + this); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/Pair.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util; 2 | 3 | public class Pair 4 | { 5 | private final F first; 6 | private final S second; 7 | 8 | private Pair(final F first, final S second) 9 | { 10 | this.first = first; 11 | this.second = second; 12 | } 13 | 14 | public F getFirst() 15 | { 16 | return first; 17 | } 18 | 19 | public S getSecond() 20 | { 21 | return second; 22 | } 23 | 24 | public static Pair of(final F first, final S second) 25 | { 26 | return new Pair<>(first, second); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/biome/ColorSet.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.biome; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | public class ColorSet 7 | { 8 | 9 | protected List layers = new ArrayList<>(); 10 | 11 | public List getLayers() 12 | { 13 | return layers; 14 | } 15 | 16 | public int getColor(double noise, int def) 17 | { 18 | if (this.layers.isEmpty()) 19 | { 20 | return def; 21 | } 22 | for (ColorThreshold color : this.layers) 23 | { 24 | if (noise <= color.maxNoise) 25 | { 26 | return color.getColor(); 27 | } 28 | } 29 | return def; 30 | } 31 | 32 | @Override 33 | public String toString() 34 | { 35 | // Make sure that empty name is written to the config files 36 | return ""; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/biome/ColorThreshold.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.biome; 2 | 3 | 4 | public class ColorThreshold implements Comparable 5 | { 6 | final float maxNoise; 7 | final int color; 8 | 9 | public ColorThreshold(int color, float maxNoise) { 10 | this.color = color; 11 | this.maxNoise = maxNoise; 12 | } 13 | 14 | public float getMaxNoise() 15 | { 16 | return maxNoise; 17 | } 18 | 19 | public int getColor() 20 | { 21 | return color; 22 | } 23 | 24 | @Override 25 | public int compareTo(ColorThreshold that) 26 | { 27 | float delta = this.maxNoise - that.maxNoise; 28 | // The number 65565 is just randomly chosen, any positive number 29 | // works fine as long as it can represent the floating point delta 30 | // as an integer 31 | return (int) (delta * 65565); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/biome/MCBiomeResourceLocation.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.biome; 2 | 3 | import com.pg85.otg.interfaces.IBiomeResourceLocation; 4 | 5 | public class MCBiomeResourceLocation implements IBiomeResourceLocation 6 | { 7 | private final String domain; 8 | private final String path; 9 | private final String presetFolder; 10 | 11 | public MCBiomeResourceLocation(String domain, String path, String presetFolderName) 12 | { 13 | this.domain = domain; 14 | this.path = path; 15 | this.presetFolder = presetFolderName; 16 | } 17 | 18 | @Override 19 | public String getPresetFolderName() 20 | { 21 | return this.presetFolder; 22 | } 23 | 24 | @Override 25 | public String toResourceLocationString() 26 | { 27 | return String.format("%s%s%s", this.domain, ":", this.path); 28 | } 29 | 30 | @Override 31 | public boolean equals(Object other) 32 | { 33 | if (this == other) 34 | { 35 | return true; 36 | } 37 | if (!(other instanceof MCBiomeResourceLocation)) 38 | { 39 | return false; 40 | } 41 | return ((MCBiomeResourceLocation)other).toResourceLocationString().equals(this.toResourceLocationString()); 42 | } 43 | 44 | @Override 45 | public int hashCode() 46 | { 47 | return toResourceLocationString().hashCode(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/biome/SimpleColorSet.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.biome; 2 | 3 | import java.util.List; 4 | 5 | import com.pg85.otg.exceptions.InvalidConfigException; 6 | import com.pg85.otg.interfaces.IMaterialReader; 7 | import com.pg85.otg.util.helpers.StringHelper; 8 | 9 | public class SimpleColorSet extends ColorSet 10 | { 11 | 12 | public SimpleColorSet(String[] args, IMaterialReader materialReader) throws InvalidConfigException 13 | { 14 | for (int i = 0; i < args.length - 1; i += 2) 15 | { 16 | Integer color = StringHelper.readColor(args[i]); 17 | float maxNoise = (float) StringHelper.readDouble(args[i + 1], -1, 1); 18 | layers.add(new ColorThreshold(color, maxNoise)); 19 | } 20 | } 21 | 22 | public SimpleColorSet(List list) 23 | { 24 | layers = list; 25 | } 26 | 27 | @Override 28 | public String toString() 29 | { 30 | if (this.layers.isEmpty()) 31 | { 32 | return ""; 33 | } 34 | 35 | StringBuilder stringBuilder = new StringBuilder(); 36 | for (ColorThreshold layer : this.layers) 37 | { 38 | stringBuilder.append("#" + Integer.toHexString(layer.getColor() | 0x1000000).substring(1).toUpperCase()); 39 | stringBuilder.append(',').append(' '); 40 | stringBuilder.append(layer.maxNoise); 41 | stringBuilder.append(',').append(' '); 42 | } 43 | // Delete last ", " 44 | stringBuilder.deleteCharAt(stringBuilder.length() - 2); 45 | return stringBuilder.toString(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/gen/ChunkBuffer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.gen; 2 | 3 | import com.pg85.otg.constants.Constants; 4 | import com.pg85.otg.util.ChunkCoordinate; 5 | import com.pg85.otg.util.materials.LocalMaterialData; 6 | 7 | /** 8 | * ChunkBuffer wraps a platform-specific chunk object for 9 | * base terrain generation and carvers in the common project. 10 | */ 11 | public abstract class ChunkBuffer 12 | { 13 | public abstract ChunkCoordinate getChunkCoordinate(); 14 | 15 | // TODO: Chunkbuffer uses internal coordinates that do not go from 0 to 16, 16 | // How large is the provided chunk actually, and how do the coord work? 17 | 18 | public abstract void setBlock(int blockX, int blockY, int blockZ, LocalMaterialData material); 19 | 20 | public abstract LocalMaterialData getBlock(int blockX, int blockY, int blockZ); 21 | 22 | // TODO: Are these really necessary, can use heightmaps? 23 | 24 | private final short[] highestBlockHeight = new short[Constants.CHUNK_SIZE * Constants.CHUNK_SIZE]; 25 | public int getHighestBlockForColumn(int blockX, int blockZ) 26 | { 27 | return highestBlockHeight[blockX * Constants.CHUNK_SIZE + blockZ]; 28 | } 29 | 30 | public void setHighestBlockForColumn(int blockX, int blockZ, int height) 31 | { 32 | if(height > highestBlockHeight[blockX * Constants.CHUNK_SIZE + blockZ]) 33 | { 34 | highestBlockHeight[blockX * Constants.CHUNK_SIZE + blockZ] = (short)height; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/gen/DecorationBiomeCache.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.gen; 2 | 3 | import com.pg85.otg.constants.Constants; 4 | import com.pg85.otg.interfaces.IBiome; 5 | import com.pg85.otg.interfaces.ICachedBiomeProvider; 6 | import com.pg85.otg.interfaces.IBiomeConfig; 7 | import com.pg85.otg.util.ChunkCoordinate; 8 | 9 | public class DecorationBiomeCache 10 | { 11 | private final int startX; 12 | private final int startZ; 13 | private final IBiome[] biomes; 14 | 15 | public DecorationBiomeCache(int startChunkX, int startChunkZ, ICachedBiomeProvider cachedBiomeProvider) 16 | { 17 | this.startX = startChunkX * Constants.CHUNK_SIZE; 18 | this.startZ = startChunkZ * Constants.CHUNK_SIZE; 19 | this.biomes = cachedBiomeProvider.getBiomesForChunks(ChunkCoordinate.fromBlockCoords(this.startX, this.startZ), DecorationArea.WIDTH); 20 | } 21 | 22 | public IBiome getBiome(int x, int z) 23 | { 24 | // If this throws an indexoutofbounds exception, there's a bug in calling code that needs to be fixed. 25 | // Any code requesting biomes during decoration should not be doing so outside of bounds. 26 | int internalX = x - this.startX; 27 | int internalZ = z - this.startZ; 28 | return this.biomes[internalX * DecorationArea.HEIGHT + internalZ]; 29 | } 30 | 31 | public IBiomeConfig getBiomeConfig(int x, int z) 32 | { 33 | return getBiome(x, z).getBiomeConfig(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/gen/JigsawStructureData.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.gen; 2 | 3 | /** 4 | * Helper class to hold jigsaw structure data for density calculations. 5 | */ 6 | public class JigsawStructureData 7 | { 8 | public final int minX; 9 | public final int minY; 10 | public final int minZ; 11 | public final int maxX; 12 | public final int delta; 13 | public final int maxZ; 14 | public final boolean useDelta; 15 | public final int sourceX; 16 | public final int groundY; 17 | public final int sourceZ; 18 | 19 | public JigsawStructureData(int minX, int minY, int minZ, int maxX, int delta, int maxZ, boolean useDelta, int sourceX, int groundY, int sourceZ) { 20 | this.minX = minX; 21 | this.minY = minY; 22 | this.minZ = minZ; 23 | this.maxX = maxX; 24 | this.delta = delta; 25 | this.maxZ = maxZ; 26 | this.useDelta = useDelta; 27 | this.sourceX = sourceX; 28 | this.groundY = groundY; 29 | this.sourceZ = sourceZ; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/helpers/RandomHelper.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.helpers; 2 | 3 | import java.util.Random; 4 | 5 | /** 6 | * Class to get a random generator which is constant for the given input. 7 | * 8 | */ 9 | public class RandomHelper 10 | { 11 | private RandomHelper() 12 | { 13 | } 14 | 15 | /** 16 | * Gets a Random generator with a random seed. However, the same input 17 | * will always produce the same output. 18 | * 19 | * @param x X-coord to start with. 20 | * @param z Z-coord to start with. 21 | * @param seed Seed to start with. 22 | * @return A random generator with a random seed. 23 | */ 24 | public static Random getRandomForCoords(int x, int z, long seed) 25 | { 26 | Random random = new Random(); 27 | random.setSeed(seed); 28 | long l1 = random.nextLong() + 1L; 29 | long l2 = random.nextLong() + 1L; 30 | random.setSeed(x * l1 + z * l2 ^ seed); 31 | return random; 32 | } 33 | 34 | public static Random getRandomForCoords(int x, int y, int z, long seed) 35 | { 36 | Random random = new Random(); 37 | random.setSeed(seed); 38 | long l1 = random.nextLong() + 1L; 39 | long l2 = random.nextLong() + 1L; 40 | long l3 = random.nextLong() + 1L; 41 | random.setSeed(x * l1 + y * l2 + z * l3 ^ seed); 42 | return random; 43 | } 44 | 45 | /** 46 | * Returns a random number between min and max, inclusive. 47 | * 48 | * @param random The random number generator. 49 | * @param min The minimum value. 50 | * @param max The maximum value. 51 | * @return A random number between min and max, inclusive. 52 | */ 53 | public static int numberInRange(Random random, int min, int max) 54 | { 55 | return min + random.nextInt(max - min + 1); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/helpers/StreamHelper.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.helpers; 2 | 3 | import java.io.DataInputStream; 4 | import java.io.DataOutput; 5 | import java.io.EOFException; 6 | import java.io.IOException; 7 | import java.nio.BufferUnderflowException; 8 | import java.nio.ByteBuffer; 9 | import java.nio.charset.StandardCharsets; 10 | 11 | public class StreamHelper 12 | { 13 | 14 | public static void writeStringToStream(DataOutput stream, String value) throws IOException 15 | { 16 | stream.writeBoolean(value == null); 17 | if(value != null) 18 | { 19 | byte[] bytes = (value == null ? "" : value).getBytes(StandardCharsets.UTF_8); 20 | stream.writeShort(bytes.length); 21 | stream.write(bytes); 22 | } 23 | } 24 | 25 | public static String readStringFromStream(DataInputStream stream) throws IOException 26 | { 27 | boolean isNull = stream.readBoolean(); 28 | if(isNull) 29 | { 30 | return null; 31 | } 32 | 33 | short length = stream.readShort(); 34 | byte[] chars = new byte[length]; 35 | if(length > 0) 36 | { 37 | if (stream.read(chars, 0, chars.length) != chars.length) 38 | { 39 | throw new EOFException(); 40 | } 41 | return new String(chars); 42 | } else { 43 | return ""; 44 | } 45 | } 46 | 47 | public static String readStringFromBuffer(ByteBuffer buffer) throws IOException, BufferUnderflowException 48 | { 49 | boolean isNull = buffer.get() != 0; 50 | if(isNull) 51 | { 52 | return null; 53 | } 54 | 55 | short length = buffer.getShort(); 56 | byte[] chars = new byte[length]; 57 | if(length > 0) 58 | { 59 | buffer.get(chars, 0, chars.length); 60 | return new String(chars); 61 | } else { 62 | return ""; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/logging/LogCategory.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.logging; 2 | 3 | public enum LogCategory 4 | { 5 | MAIN, 6 | CUSTOM_OBJECTS, 7 | STRUCTURE_PLOTTING, 8 | CONFIGS, 9 | BIOME_REGISTRY, 10 | DECORATION, 11 | PERFORMANCE, 12 | MOBS; 13 | 14 | public String getLogTag() 15 | { 16 | String categoryTag = ""; 17 | switch(this) 18 | { 19 | case BIOME_REGISTRY: 20 | categoryTag = "[BiomeRegistry]"; 21 | break; 22 | case CONFIGS: 23 | categoryTag = "[Configs]"; 24 | break; 25 | case CUSTOM_OBJECTS: 26 | categoryTag = "[CustomObjects]"; 27 | break; 28 | case DECORATION: 29 | categoryTag = "[Decoration]"; 30 | break; 31 | case MAIN: 32 | categoryTag = "[Main]"; 33 | break; 34 | case MOBS: 35 | categoryTag = "[Mobs]"; 36 | break; 37 | case PERFORMANCE: 38 | categoryTag = "[Performance]"; 39 | break; 40 | case STRUCTURE_PLOTTING: 41 | categoryTag = "[StructurePlotting]"; 42 | break; 43 | default: 44 | break; 45 | } 46 | return categoryTag; 47 | } 48 | } -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/logging/LogLevel.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.logging; 2 | 3 | public enum LogLevel 4 | { 5 | FATAL, 6 | ERROR, 7 | WARN, 8 | INFO 9 | } -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/materials/LocalMaterialBase.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.materials; 2 | 3 | /** 4 | * Represents one of Minecraft's materials. 5 | * Immutable. 6 | */ 7 | public abstract class LocalMaterialBase 8 | { 9 | public abstract boolean isTag(); 10 | 11 | public abstract String toString(); 12 | 13 | public abstract boolean matches(LocalMaterialData material); 14 | } 15 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/materials/LocalMaterialTag.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.materials; 2 | 3 | /** 4 | * Represents one of Minecraft's material tags. 5 | * Immutable. 6 | */ 7 | public abstract class LocalMaterialTag extends LocalMaterialBase 8 | { 9 | @Override 10 | public boolean isTag() 11 | { 12 | return true; 13 | } 14 | 15 | @Override 16 | public boolean matches(LocalMaterialData material) 17 | { 18 | return material.isBlockTag(this); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/materials/MaterialProperties.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.materials; 2 | 3 | import com.pg85.otg.util.OTGDirection; 4 | 5 | public class MaterialProperties 6 | { 7 | public static final MaterialProperty AGE_0_25 = new MaterialProperty<>("age"); 8 | public static final MaterialProperty AGE_0_3 = new MaterialProperty<>("age"); 9 | public static final MaterialProperty PICKLES_1_4 = new MaterialProperty<>("pickles"); 10 | 11 | public static final MaterialProperty SNOWY = new MaterialProperty<>("snowy"); 12 | 13 | public static final MaterialProperty HORIZONTAL_DIRECTION = new MaterialProperty<>("horizontal_direction"); 14 | } 15 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/materials/MaterialProperty.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.materials; 2 | 3 | public class MaterialProperty 4 | { 5 | public final String name; 6 | 7 | public MaterialProperty(String name) { 8 | this.name = name; 9 | } 10 | 11 | @Override 12 | public String toString() 13 | { 14 | return "MaterialProperty(" + this.name + ")"; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/materials/MaterialSetEntry.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.materials; 2 | 3 | class MaterialSetEntry 4 | { 5 | private LocalMaterialBase material; 6 | 7 | MaterialSetEntry(LocalMaterialBase material) 8 | { 9 | this.material = material; 10 | } 11 | 12 | @Override 13 | public boolean equals(Object other) 14 | { 15 | // Uses hashCode, as it is guaranteed to be unique for this class 16 | if (other instanceof MaterialSetEntry) 17 | { 18 | return other.hashCode() == hashCode(); 19 | } 20 | return false; 21 | } 22 | 23 | /** 24 | * Gets the hashCode of this entry, which is equal to either 25 | * {@link LocalMaterialData#hashCode()} or 26 | * {@link LocalMaterialData#hashCodeWithoutBlockData()}. This means that 27 | * the hashCode is unique. 28 | * 29 | * @return The unique hashCode. 30 | */ 31 | @Override 32 | public int hashCode() 33 | { 34 | return this.material.hashCode(); 35 | } 36 | 37 | @Override 38 | public String toString() 39 | { 40 | return this.material.toString(); 41 | } 42 | 43 | public LocalMaterialBase getMaterial() 44 | { 45 | return this.material; 46 | } 47 | 48 | /** 49 | * Rotates this check 90 degrees. If block data was ignored in this check, 50 | * it will still be ignored, otherwise the block data will be rotated too. 51 | * 52 | * @return The rotated check. 53 | */ 54 | MaterialSetEntry rotate() 55 | { 56 | if (this.material.isTag()) 57 | { 58 | return new MaterialSetEntry(this.material); 59 | } else { 60 | // Rotate block data, to maintain check correctness 61 | return new MaterialSetEntry(((LocalMaterialData)this.material).rotate()); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/minecraft/EntityCategory.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.minecraft; 2 | 3 | /** 4 | * Represents the four mob type groups used by vanilla Minecraft. 5 | */ 6 | public enum EntityCategory 7 | { 8 | AMBIENT_CREATURE, 9 | WATER_CREATURE, 10 | CREATURE, 11 | MONSTER, 12 | WATER_AMBIENT, 13 | MISC 14 | } -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/minecraft/TreeType.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.minecraft; 2 | 3 | /** 4 | * Represents all tree types in Minecraft. 5 | * 6 | */ 7 | public enum TreeType 8 | { 9 | Acacia, 10 | BigTree, 11 | Birch, 12 | CocoaTree, 13 | DarkOak, 14 | /** 15 | * Soft-deprecated, renamed to Birch 16 | */ 17 | Forest("Birch"), 18 | CrimsonFungi, 19 | WarpedFungi, 20 | ChorusPlant, 21 | GroundBush, 22 | HugeMushroom, 23 | HugeRedMushroom, 24 | HugeBrownMushroom, 25 | JungleTree, 26 | SwampTree, 27 | Taiga1, 28 | Taiga2, 29 | HugeTaiga1, 30 | HugeTaiga2, 31 | TallBirch, 32 | Tree; 33 | 34 | private final String name; 35 | 36 | /** 37 | * Creates a new tree type. 38 | */ 39 | private TreeType() 40 | { 41 | this.name = name(); 42 | } 43 | 44 | /** 45 | * Creates a new tree type. When this type is written to the configs, the 46 | * provided name will be used instead. This allows for renaming tree types 47 | * while still being able to read old ones. 48 | * 49 | * @param name The name used for writing. 50 | */ 51 | private TreeType(String name) 52 | { 53 | this.name = name; 54 | } 55 | 56 | public String toString() 57 | { 58 | // Overridden so that the correct name is used when writing 59 | // to the config files 60 | return name; 61 | } 62 | } -------------------------------------------------------------------------------- /common/common-util/src/main/java/com/pg85/otg/util/nbt/LocalNBTHelper.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.util.nbt; 2 | 3 | import com.pg85.otg.util.gen.LocalWorldGenRegion; 4 | 5 | public abstract class LocalNBTHelper 6 | { 7 | /** 8 | * Gets the NBT tag, if any, at a location 9 | * 10 | * @param world The world to use 11 | * @param x x coordinate to check 12 | * @param y y coordinate to check 13 | * @param z z coordinate to check 14 | * @return the NBT data at that location, if any 15 | */ 16 | public abstract NamedBinaryTag getNBTFromLocation(LocalWorldGenRegion world, int x, int y, int z); 17 | } 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/logo.png -------------------------------------------------------------------------------- /platforms/fabric/gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1G 3 | 4 | # Fabric Properties 5 | # check these on https://fabricmc.net/versions.html 6 | minecraft_version=1.16.5 7 | yarn_mappings=1.16.5+build.9 8 | loader_version=0.11.3 9 | 10 | # Mod Properties 11 | mod_version = 1.0.0 12 | maven_group = com.example 13 | archives_base_name = openterraingenerator-fabric 14 | 15 | # Dependencies 16 | # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api (or https://fabricmc.net/versions.html) 17 | fabric_version=0.34.2+1.16 18 | -------------------------------------------------------------------------------- /platforms/fabric/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /platforms/fabric/src/main/java/com/pg85/otg/fabric/OTGPlugin.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.fabric; 2 | 3 | import net.fabricmc.api.ModInitializer; 4 | 5 | public class OTGPlugin implements ModInitializer { 6 | @Override 7 | public void onInitialize() { 8 | // This code runs as soon as Minecraft is in a mod-load-ready state. 9 | // However, some things (like resources) may still be uninitialized. 10 | // Proceed with mild caution. 11 | 12 | System.out.println("OpenTerrainGenerator-Fabric reporting in... it's dark in here."); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /platforms/fabric/src/main/resources/OTGlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/fabric/src/main/resources/OTGlogo.png -------------------------------------------------------------------------------- /platforms/fabric/src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "otg", 4 | "version": "${version}", 5 | 6 | "name": "Example Mod", 7 | "description": "OTG: Generate anything!", 8 | "authors": [ 9 | "Team OTG" 10 | ], 11 | "contact": { 12 | "homepage": "https://fabricmc.net/", 13 | "sources": "https://github.com/FabricMC/fabric-example-mod" 14 | }, 15 | 16 | "license": "MIT", 17 | "icon": "OTGlogo.png", 18 | 19 | "environment": "*", 20 | "entrypoints": { 21 | "main": [ 22 | "com.pg85.otg.fabric.OTGPlugin" 23 | ] 24 | }, 25 | "mixins": [ 26 | "otg-fabric.mixins.json" 27 | ], 28 | 29 | "depends": { 30 | "fabricloader": ">=0.11.3", 31 | "fabric": "*", 32 | "minecraft": "1.16.5", 33 | "java": ">=8" 34 | }, 35 | "suggests": { 36 | "another-mod": "*" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /platforms/fabric/src/main/resources/otg-fabric.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "minVersion": "0.8", 4 | "package": "net.fabricmc.example.mixin", 5 | "compatibilityLevel": "JAVA_8", 6 | "mixins": [ 7 | ], 8 | "client": [ 9 | ], 10 | "injectors": { 11 | "defaultRequire": 1 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /platforms/forge/.gitattributes: -------------------------------------------------------------------------------- 1 | # Disable autocrlf on generated files, they always generate with LF 2 | # Add any extra files or paths here to make git stop saying they 3 | # are changed when only line endings change. 4 | src/generated/**/.cache/cache text eol=lf 5 | src/generated/**/*.json text eol=lf 6 | -------------------------------------------------------------------------------- /platforms/forge/gradle.properties: -------------------------------------------------------------------------------- 1 | # Sets default memory used for gradle commands. Can be overridden by user or command line properties. 2 | # This is required to provide enough memory for the Minecraft decompilation process. 3 | org.gradle.jvmargs=-Xmx3G 4 | org.gradle.daemon=false -------------------------------------------------------------------------------- /platforms/forge/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/api/OTGForgeAPI.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.api; 2 | 3 | import java.util.Optional; 4 | 5 | import com.pg85.otg.forge.gen.OTGNoiseChunkGenerator; 6 | import com.pg85.otg.interfaces.IBiomeConfig; 7 | 8 | import net.minecraft.util.math.BlockPos; 9 | import net.minecraft.world.server.ServerWorld; 10 | 11 | public class OTGForgeAPI 12 | { 13 | @SuppressWarnings("resource") 14 | public static IBiomeConfig getOTGBiome(ServerWorld world, BlockPos pos) 15 | { 16 | if (!(world.getChunkSource().generator instanceof OTGNoiseChunkGenerator)) 17 | { 18 | return null; 19 | } 20 | 21 | return ((OTGNoiseChunkGenerator) world.getChunkSource().generator).getCachedBiomeProvider() 22 | .getBiomeConfig(pos.getX(), pos.getZ()); 23 | } 24 | 25 | public static Optional getOTGBiomeOptional(ServerWorld world, BlockPos pos) 26 | { 27 | return Optional.ofNullable(getOTGBiome(world, pos)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/commands/BaseCommand.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.commands; 2 | 3 | import com.mojang.brigadier.builder.LiteralArgumentBuilder; 4 | 5 | import net.minecraft.command.CommandSource; 6 | import net.minecraft.util.text.IFormattableTextComponent; 7 | import net.minecraft.util.text.StringTextComponent; 8 | import net.minecraft.util.text.TextFormatting; 9 | 10 | public abstract class BaseCommand 11 | { 12 | protected final String name; 13 | protected String helpMessage = "No help message specified."; 14 | protected String usage = "No usage message specified."; 15 | protected String[] detailedHelp = new String[] 16 | { "No detailed help specified." }; 17 | 18 | public BaseCommand(String name) { 19 | this.name = name; 20 | } 21 | 22 | public String getName() 23 | { 24 | return name; 25 | } 26 | 27 | public String getHelpMessage() 28 | { 29 | return helpMessage; 30 | } 31 | 32 | public String getUsage() 33 | { 34 | return usage; 35 | } 36 | 37 | public String[] getDetailedHelp() 38 | { 39 | return this.detailedHelp; 40 | } 41 | 42 | public IFormattableTextComponent createComponent(String text, String text2, TextFormatting color1, TextFormatting color2) { 43 | return new StringTextComponent(text).withStyle(color1).append(new StringTextComponent(text2).withStyle(color2)); 44 | } 45 | 46 | public abstract void build(LiteralArgumentBuilder builder); 47 | } 48 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/commands/FlushCommand.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.commands; 2 | 3 | import com.mojang.brigadier.builder.LiteralArgumentBuilder; 4 | import com.pg85.otg.OTG; 5 | import com.pg85.otg.forge.gen.OTGNoiseChunkGenerator; 6 | import com.pg85.otg.util.logging.LogCategory; 7 | import com.pg85.otg.util.logging.LogLevel; 8 | 9 | import net.minecraft.command.CommandSource; 10 | import net.minecraft.command.Commands; 11 | import net.minecraft.util.text.StringTextComponent; 12 | 13 | public class FlushCommand extends BaseCommand 14 | { 15 | public FlushCommand() 16 | { 17 | super("flush"); 18 | this.helpMessage = "Clears all loaded objects, forcing them to be reloaded from disk."; 19 | this.usage = "/otg flush"; 20 | } 21 | 22 | @Override 23 | public void build(LiteralArgumentBuilder builder) 24 | { 25 | builder.then(Commands.literal("flush") 26 | .executes(context -> flushCache(context.getSource())) 27 | ); 28 | } 29 | 30 | protected int flushCache(CommandSource source) 31 | { 32 | if (!(source.getLevel().getChunkSource().generator instanceof OTGNoiseChunkGenerator)) 33 | { 34 | source.sendSuccess(new StringTextComponent("OTG is not enabled in this world"), false); 35 | return 0; 36 | } 37 | 38 | OTG.getEngine().getLogger().log(LogLevel.INFO, LogCategory.MAIN, "Unloading BO2/BO3/BO4 files"); 39 | OTG.getEngine().getCustomObjectManager().reloadCustomObjectFiles(); 40 | source.sendSuccess(new StringTextComponent("Objects unloaded."), false); 41 | return 0; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/commands/WorldEditUtil.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.commands; 2 | 3 | import com.sk89q.worldedit.IncompleteRegionException; 4 | import com.sk89q.worldedit.WorldEdit; 5 | import com.sk89q.worldedit.forge.ForgeAdapter; 6 | import com.sk89q.worldedit.math.BlockVector3; 7 | import net.minecraft.entity.player.ServerPlayerEntity; 8 | import net.minecraft.util.math.BlockPos; 9 | 10 | public class WorldEditUtil 11 | { 12 | public static RegionCommand.Region getRegionFromPlayer(ServerPlayerEntity playerEntity) 13 | { 14 | if (!WorldEdit.getInstance().getSessionManager().contains(ForgeAdapter.adaptPlayer(playerEntity))) 15 | { 16 | return null; 17 | } 18 | try 19 | { 20 | com.sk89q.worldedit.regions.Region weRegion = WorldEdit.getInstance().getSessionManager() 21 | .get(ForgeAdapter.adaptPlayer(playerEntity)) 22 | .getSelection(ForgeAdapter.adapt(playerEntity.getLevel())); 23 | RegionCommand.Region region = new RegionCommand.Region(); 24 | region.setPos(getPosFromVector3(weRegion.getMinimumPoint())); 25 | region.setPos(getPosFromVector3(weRegion.getMaximumPoint())); 26 | return region; 27 | } 28 | catch (IncompleteRegionException e) 29 | { 30 | return null; 31 | } 32 | } 33 | 34 | private static BlockPos getPosFromVector3(BlockVector3 vector) 35 | { 36 | return new BlockPos(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/commands/arguments/BiomeObjectArgument.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.commands.arguments; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.concurrent.CompletableFuture; 6 | import java.util.function.Function; 7 | import java.util.stream.Collectors; 8 | 9 | import com.mojang.brigadier.context.CommandContext; 10 | import com.mojang.brigadier.suggestion.Suggestions; 11 | import com.mojang.brigadier.suggestion.SuggestionsBuilder; 12 | import com.pg85.otg.OTG; 13 | 14 | import net.minecraft.command.CommandSource; 15 | import net.minecraft.command.ISuggestionProvider; 16 | 17 | public class BiomeObjectArgument 18 | { 19 | private static final Function filterNamesWithSpaces = (name -> name.contains(" ") ? "\"" + name + "\"" : name); 20 | 21 | public static CompletableFuture suggest(CommandContext context, 22 | SuggestionsBuilder builder) 23 | { 24 | String presetFolderName = context.getArgument("preset", String.class); 25 | List list; 26 | // Get global objects if global, else fetch based on preset 27 | if (presetFolderName.equalsIgnoreCase("global")) 28 | { 29 | list = OTG.getEngine().getCustomObjectManager().getGlobalObjects().getGlobalObjectNames(OTG.getEngine().getLogger(), OTG.getEngine().getOTGRootFolder()); 30 | } 31 | else 32 | { 33 | list = OTG.getEngine().getCustomObjectManager().getGlobalObjects().getAllBONamesForPreset(presetFolderName, OTG.getEngine().getLogger(), OTG.getEngine().getOTGRootFolder()); 34 | } 35 | if (list == null) 36 | { 37 | list = new ArrayList<>(); 38 | } 39 | list = list.stream().map(filterNamesWithSpaces).collect(Collectors.toList()); 40 | return ISuggestionProvider.suggest(list, builder); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/commands/arguments/FlagsArgument.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.commands.arguments; 2 | 3 | import com.mojang.brigadier.StringReader; 4 | import com.mojang.brigadier.arguments.ArgumentType; 5 | import com.mojang.brigadier.exceptions.CommandSyntaxException; 6 | 7 | public class FlagsArgument implements ArgumentType 8 | { 9 | 10 | private FlagsArgument() 11 | { 12 | } 13 | 14 | public static FlagsArgument create() 15 | { 16 | return new FlagsArgument(); 17 | } 18 | 19 | @Override 20 | public String parse(StringReader reader) throws CommandSyntaxException { 21 | return reader.readString(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/commands/arguments/PresetArgument.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.commands.arguments; 2 | 3 | import java.util.Set; 4 | import java.util.concurrent.CompletableFuture; 5 | import java.util.function.Function; 6 | import java.util.stream.Collectors; 7 | 8 | import com.mojang.brigadier.context.CommandContext; 9 | import com.mojang.brigadier.suggestion.Suggestions; 10 | import com.mojang.brigadier.suggestion.SuggestionsBuilder; 11 | import com.pg85.otg.OTG; 12 | 13 | import net.minecraft.command.CommandSource; 14 | import net.minecraft.command.ISuggestionProvider; 15 | 16 | public class PresetArgument 17 | { 18 | private static final Function filterNamesWithSpaces = (name -> name.contains(" ") 19 | ? "\"" + name + "\"" 20 | : name); 21 | 22 | public static CompletableFuture suggest(CommandContext context, 23 | SuggestionsBuilder builder, boolean global) 24 | { 25 | // TODO: Should this include shortnames? 26 | Set set = OTG.getEngine().getPresetLoader().getAllPresetFolderNames().stream() 27 | .map(filterNamesWithSpaces).collect(Collectors.toSet()); 28 | if (global) 29 | set.add("global"); 30 | return ISuggestionProvider.suggest(set, builder); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/dimensions/OTGChunkGeneratorFactory.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.dimensions; 2 | 3 | import net.minecraft.util.registry.DynamicRegistries; 4 | import net.minecraft.util.registry.Registry; 5 | import net.minecraft.world.biome.Biome; 6 | import net.minecraft.world.gen.ChunkGenerator; 7 | import net.minecraft.world.gen.DimensionSettings; 8 | import net.minecraft.world.gen.settings.DimensionGeneratorSettings; 9 | import net.minecraftforge.common.world.ForgeWorldType.IChunkGeneratorFactory; 10 | 11 | public class OTGChunkGeneratorFactory implements IChunkGeneratorFactory 12 | { 13 | // Only used for SP world creation by Forge, we use our own WorldType registration logic for SP (see OTGPlugin/OTGGui). 14 | @Override 15 | public ChunkGenerator createChunkGenerator(Registry biomeRegistry, Registry dimensionSettingsRegistry, long seed, String generatorSettings) 16 | { 17 | return null; 18 | } 19 | 20 | // Used for MP when starting the server, with settings from server.properties. 21 | public DimensionGeneratorSettings createSettings(DynamicRegistries dynamicRegistries, long seed, boolean generateStructures, boolean bonusChest, String generatorSettings) 22 | { 23 | return OTGDimensionType.createOTGSettings(dynamicRegistries, seed, generateStructures, bonusChest, generatorSettings); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/dimensions/OTGWorldType.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.dimensions; 2 | 3 | import com.pg85.otg.constants.Constants; 4 | 5 | import net.minecraft.util.ResourceLocation; 6 | import net.minecraftforge.common.world.ForgeWorldType; 7 | 8 | public class OTGWorldType extends ForgeWorldType 9 | { 10 | public OTGWorldType() 11 | { 12 | super(new OTGChunkGeneratorFactory()); 13 | this.setRegistryName(new ResourceLocation(Constants.MOD_ID_SHORT)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/dimensions/portals/OTGPlayerProvider.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.dimensions.portals; 2 | 3 | import net.minecraft.util.Direction; 4 | import net.minecraftforge.common.capabilities.Capability; 5 | import net.minecraftforge.common.capabilities.ICapabilityProvider; 6 | import net.minecraftforge.common.util.LazyOptional; 7 | 8 | // Player capabilities used for tracking players in OTG portals. 9 | public class OTGPlayerProvider implements ICapabilityProvider 10 | { 11 | private final OTGPlayer otgPlayer; 12 | 13 | public OTGPlayerProvider(OTGPlayer otgPlayer) 14 | { 15 | this.otgPlayer = otgPlayer; 16 | } 17 | 18 | @SuppressWarnings("unchecked") 19 | @Override 20 | public LazyOptional getCapability(Capability cap, Direction side) 21 | { 22 | if (cap == OTGCapabilities.OTG_PLAYER_CAPABILITY) 23 | { 24 | return LazyOptional.of(() -> (T) this.otgPlayer); 25 | } 26 | return LazyOptional.empty(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/event/GuiHandler.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.event; 2 | 3 | import com.pg85.otg.config.dimensions.DimensionConfig; 4 | import com.pg85.otg.constants.Constants; 5 | import com.pg85.otg.forge.gui.screens.ModpackCreateWorldScreen; 6 | 7 | import net.minecraft.client.gui.screen.CreateWorldScreen; 8 | import net.minecraftforge.api.distmarker.Dist; 9 | import net.minecraftforge.client.event.GuiOpenEvent; 10 | import net.minecraftforge.eventbus.api.SubscribeEvent; 11 | import net.minecraftforge.fml.common.Mod.EventBusSubscriber; 12 | 13 | // Only used for Modpack world creation menu atm 14 | @EventBusSubscriber(modid = Constants.MOD_ID_SHORT, value = Dist.CLIENT) 15 | public class GuiHandler 16 | { 17 | @SubscribeEvent 18 | public static void onGuiOpen(GuiOpenEvent event) 19 | { 20 | if(event.getGui() instanceof CreateWorldScreen && !(event.getGui() instanceof ModpackCreateWorldScreen)) 21 | { 22 | DimensionConfig modPackConfig = DimensionConfig.fromDisk(Constants.MODPACK_CONFIG_NAME); 23 | if(modPackConfig != null) 24 | { 25 | CreateWorldScreen screen = (CreateWorldScreen)event.getGui(); 26 | event.setGui(ModpackCreateWorldScreen.create(screen.lastScreen)); 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/event/PlayerHandler.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.event; 2 | 3 | import com.pg85.otg.constants.Constants; 4 | import com.pg85.otg.forge.dimensions.portals.OTGPlayer; 5 | import net.minecraft.entity.player.PlayerEntity; 6 | import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; 7 | import net.minecraftforge.eventbus.api.SubscribeEvent; 8 | import net.minecraftforge.fml.common.Mod.EventBusSubscriber; 9 | 10 | // Only used to track players in otg portals atm. 11 | @EventBusSubscriber(modid = Constants.MOD_ID_SHORT) 12 | public class PlayerHandler 13 | { 14 | @SubscribeEvent 15 | public static void onPlayerUpdate(LivingUpdateEvent event) 16 | { 17 | if (event.getEntityLiving() instanceof PlayerEntity) 18 | { 19 | OTGPlayer.get((PlayerEntity) event.getEntityLiving()).ifPresent(OTGPlayer::onUpdate); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/gen/ForgeChunkBuffer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.gen; 2 | 3 | import com.pg85.otg.forge.materials.ForgeMaterialData; 4 | import com.pg85.otg.util.ChunkCoordinate; 5 | import com.pg85.otg.util.gen.ChunkBuffer; 6 | import com.pg85.otg.util.materials.LocalMaterialData; 7 | 8 | import net.minecraft.block.BlockState; 9 | import net.minecraft.util.math.BlockPos; 10 | import net.minecraft.util.math.ChunkPos; 11 | import net.minecraft.world.chunk.ChunkPrimer; 12 | import net.minecraft.world.chunk.IChunk; 13 | 14 | public class ForgeChunkBuffer extends ChunkBuffer 15 | { 16 | private final BlockPos.Mutable mutable = new BlockPos.Mutable(); 17 | private final ChunkPrimer chunk; 18 | 19 | ForgeChunkBuffer(ChunkPrimer chunk) 20 | { 21 | this.chunk = chunk; 22 | } 23 | 24 | @Override 25 | public ChunkCoordinate getChunkCoordinate() 26 | { 27 | ChunkPos pos = this.chunk.getPos(); 28 | return ChunkCoordinate.fromChunkCoords(pos.x, pos.z); 29 | } 30 | 31 | @Override 32 | public void setBlock(int internalX, int blockY, int internalZ, LocalMaterialData material) 33 | { 34 | this.chunk.setBlockState(this.mutable.set(internalX, blockY, internalZ), ((ForgeMaterialData) material).internalBlock(), false); 35 | } 36 | 37 | @Override 38 | public LocalMaterialData getBlock(int internalX, int blockY, int internalZ) 39 | { 40 | BlockState blockState = this.chunk.getBlockState(this.mutable.set(internalX, blockY, internalZ)); 41 | return blockState == null ? null : ForgeMaterialData.ofBlockState(blockState); 42 | } 43 | 44 | public IChunk getChunk() 45 | { 46 | return this.chunk; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/gui/screens/OTGDimensionSettingsContainer.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.gui.screens; 2 | 3 | import com.pg85.otg.config.dimensions.DimensionConfig; 4 | 5 | import net.minecraft.world.gen.settings.DimensionGeneratorSettings; 6 | 7 | public class OTGDimensionSettingsContainer 8 | { 9 | public DimensionConfig dimensionConfig; 10 | public DimensionGeneratorSettings dimGenSettings; 11 | 12 | public OTGDimensionSettingsContainer(DimensionConfig dimensionConfig, DimensionGeneratorSettings dimGenSettings) 13 | { 14 | this.dimensionConfig = dimensionConfig; 15 | this.dimGenSettings = dimGenSettings; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/mixin/MixinChunkManager.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.mixin; 2 | 3 | import net.minecraft.world.chunk.Chunk; 4 | import net.minecraft.world.chunk.ChunkPrimer; 5 | import net.minecraft.world.chunk.ChunkPrimerWrapper; 6 | import net.minecraft.world.chunk.IChunk; 7 | import net.minecraft.world.server.ChunkHolder; 8 | import net.minecraft.world.server.ChunkManager; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.ModifyArg; 12 | 13 | import java.util.function.Predicate; 14 | 15 | @Mixin(ChunkManager.class) 16 | public class MixinChunkManager 17 | { 18 | @ModifyArg(method = "saveAllChunks(Z)V", at = @At(value = "INVOKE", target = "Ljava/util/stream/Stream;filter(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;", ordinal = 0)) 19 | private Predicate alwaysAccessibleFlush(Predicate chunk) 20 | { 21 | return c -> true; 22 | } 23 | 24 | @ModifyArg(method = "saveAllChunks(Z)V", at = @At(value = "INVOKE", target = "Ljava/util/stream/Stream;filter(Ljava/util/function/Predicate;)Ljava/util/stream/Stream;", ordinal = 1)) 25 | private Predicate allowChunkPrimerFlush(Predicate chunk) 26 | { 27 | return c -> c instanceof ChunkPrimer || c instanceof ChunkPrimerWrapper || c instanceof Chunk; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/mixin/MixinSpawnLocationHelper.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.mixin; 2 | 3 | import com.pg85.otg.forge.gen.OTGNoiseChunkGenerator; 4 | import net.minecraft.entity.player.SpawnLocationHelper; 5 | import net.minecraft.util.math.BlockPos; 6 | import net.minecraft.world.chunk.Chunk; 7 | import net.minecraft.world.gen.Heightmap; 8 | import net.minecraft.world.server.ServerWorld; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 13 | 14 | @Mixin(SpawnLocationHelper.class) 15 | public class MixinSpawnLocationHelper 16 | { 17 | @Inject(method = "getOverworldRespawnPos", at = @At("HEAD"), cancellable = true) 18 | private static void fixSpawningInGround(ServerWorld world, int x, int z, boolean needsValidSpawn, CallbackInfoReturnable cir) 19 | { 20 | if (world.getChunkSource().generator instanceof OTGNoiseChunkGenerator) 21 | { 22 | Chunk chunk = world.getChunk(x >> 4, z >> 4); 23 | int topY = chunk.getHeight(Heightmap.Type.MOTION_BLOCKING, x & 15, z & 15); 24 | int surfaceY = chunk.getHeight(Heightmap.Type.WORLD_SURFACE, x & 15, z & 15); 25 | int floorY = chunk.getHeight(Heightmap.Type.OCEAN_FLOOR, x & 15, z & 15); 26 | 27 | // We ensure these 3 are the same to make sure that we're not spawning underwater or on a tree. 28 | if (topY == surfaceY && floorY == surfaceY) 29 | { 30 | cir.setReturnValue(new BlockPos(x, topY + 1, z)); 31 | } else { 32 | cir.setReturnValue(null); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/network/AcknowledgeOTGMessage.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.network; 2 | 3 | import net.minecraft.network.PacketBuffer; 4 | import net.minecraftforge.fml.network.FMLHandshakeHandler; 5 | import net.minecraftforge.fml.network.NetworkEvent; 6 | 7 | import java.util.function.Supplier; 8 | 9 | public class AcknowledgeOTGMessage implements OTGLoginMessage 10 | { 11 | private int loginIndex; 12 | 13 | public AcknowledgeOTGMessage() { } 14 | 15 | public static void serialize(AcknowledgeOTGMessage msg, PacketBuffer buf) { } 16 | 17 | public static AcknowledgeOTGMessage deserialize(PacketBuffer buf) 18 | { 19 | return new AcknowledgeOTGMessage(); 20 | } 21 | 22 | public static void handle(FMLHandshakeHandler __, AcknowledgeOTGMessage msg, Supplier ctx) 23 | { 24 | ctx.get().enqueueWork(() -> ctx.get().setPacketHandled(true)); 25 | ctx.get().setPacketHandled(true); 26 | } 27 | 28 | @Override 29 | public int getLoginIndex() 30 | { 31 | return loginIndex; 32 | } 33 | 34 | @Override 35 | public void setLoginIndex(int loginIndex) 36 | { 37 | this.loginIndex = loginIndex; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/network/OTGLoginMessage.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.network; 2 | 3 | import java.util.function.IntSupplier; 4 | 5 | public interface OTGLoginMessage extends IntSupplier 6 | { 7 | int getLoginIndex(); 8 | void setLoginIndex(int loginIndex); 9 | 10 | @Override 11 | default int getAsInt() 12 | { 13 | return this.getLoginIndex(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/util/ForgeLogger.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.util; 2 | 3 | import com.pg85.otg.constants.Constants; 4 | import com.pg85.otg.util.logging.LogCategory; 5 | import com.pg85.otg.util.logging.LogLevel; 6 | import com.pg85.otg.util.logging.Logger; 7 | 8 | import org.apache.logging.log4j.LogManager; 9 | 10 | public final class ForgeLogger extends Logger 11 | { 12 | private final org.apache.logging.log4j.Logger logger = LogManager.getLogger(Constants.MOD_ID_SHORT); 13 | 14 | @Override 15 | public void log(LogLevel level, LogCategory category, String message) 16 | { 17 | if (this.minimumLevel.compareTo(level) < 0) 18 | { 19 | // Only log messages that we want to see... 20 | return; 21 | } 22 | 23 | // Forge automatically adds the OpenTerrainGenerator prefix, 24 | // so we don't need to do that ourselves. 25 | switch (level) 26 | { 27 | case FATAL: 28 | this.logger.fatal(category.getLogTag() + " " + message); 29 | break; 30 | case ERROR: 31 | this.logger.error(category.getLogTag() + " " + message); 32 | break; 33 | case WARN: 34 | this.logger.warn(category.getLogTag() + " " + message); 35 | break; 36 | case INFO: 37 | this.logger.info(category.getLogTag() + " " + message); 38 | break; 39 | default: 40 | break; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /platforms/forge/src/main/java/com/pg85/otg/forge/util/ForgeModLoadedChecker.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.forge.util; 2 | 3 | import com.pg85.otg.interfaces.IModLoadedChecker; 4 | import net.minecraftforge.fml.ModList; 5 | 6 | public class ForgeModLoadedChecker implements IModLoadedChecker 7 | { 8 | @Override 9 | public boolean isModLoaded(String mod) 10 | { 11 | return ModList.get().isLoaded(mod); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/OTGlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/OTGlogo.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_beige.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_beige_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_beige_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_black.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_black_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_black_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_blue.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_blue_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_blue_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_crystalblue.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_crystalblue_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_crystalblue_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_darkblue.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_darkblue_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_darkblue_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_darkgreen.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_darkgreen_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_darkgreen_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_darkred.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_darkred_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_darkred_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_emerald.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_emerald_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_emerald_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_flame.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_flame_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_flame_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_gold.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_gold_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_gold_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_green.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_green_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_green_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_grey.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_grey_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_grey_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_lightblue.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_lightblue_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_lightblue_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_lightgreen.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_lightgreen_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_lightgreen_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_orange.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_orange_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_orange_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_pink.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_pink_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_pink_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_red.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_red_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_red_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_white.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_white_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_white_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/blockstates/portalotg_yellow.json: -------------------------------------------------------------------------------- 1 | { 2 | "variants": { 3 | "axis=z": { "model": "otg:block/portalotg_yellow_ew" }, 4 | "axis=x": { "model": "otg:block/portalotg_yellow_ns" } 5 | } 6 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_beige_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_beige", 4 | "portal": "otg:blocks/portalotg_beige" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_beige_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_beige", 4 | "portal": "otg:blocks/portalotg_beige" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_black_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_black", 4 | "portal": "otg:blocks/portalotg_black" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_black_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_black", 4 | "portal": "otg:blocks/portalotg_black" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_blue_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_blue", 4 | "portal": "otg:blocks/portalotg_blue" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_blue_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_blue", 4 | "portal": "otg:blocks/portalotg_blue" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_crystalblue_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_crystalblue", 4 | "portal": "otg:blocks/portalotg_crystalblue" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_crystalblue_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_crystalblue", 4 | "portal": "otg:blocks/portalotg_crystalblue" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_darkblue_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_darkblue", 4 | "portal": "otg:blocks/portalotg_darkblue" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_darkblue_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_darkblue", 4 | "portal": "otg:blocks/portalotg_darkblue" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_darkgreen_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_darkgreen", 4 | "portal": "otg:blocks/portalotg_darkgreen" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_darkgreen_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_darkgreen", 4 | "portal": "otg:blocks/portalotg_darkgreen" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_darkred_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_darkred", 4 | "portal": "otg:blocks/portalotg_darkred" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_darkred_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_darkred", 4 | "portal": "otg:blocks/portalotg_darkred" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_emerald_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_emerald", 4 | "portal": "otg:blocks/portalotg_emerald" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_emerald_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_emerald", 4 | "portal": "otg:blocks/portalotg_emerald" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg", 4 | "portal": "otg:blocks/portalotg" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_flame_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_flame", 4 | "portal": "otg:blocks/portalotg_flame" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_flame_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_flame", 4 | "portal": "otg:blocks/portalotg_flame" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_gold_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_gold", 4 | "portal": "otg:blocks/portalotg_gold" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_gold_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_gold", 4 | "portal": "otg:blocks/portalotg_gold" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_green_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_green", 4 | "portal": "otg:blocks/portalotg_green" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_green_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_green", 4 | "portal": "otg:blocks/portalotg_green" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_grey_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_grey", 4 | "portal": "otg:blocks/portalotg_grey" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_grey_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_grey", 4 | "portal": "otg:blocks/portalotg_grey" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_lightblue_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_lightblue", 4 | "portal": "otg:blocks/portalotg_lightblue" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_lightblue_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_lightblue", 4 | "portal": "otg:blocks/portalotg_lightblue" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_lightgreen_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_lightgreen", 4 | "portal": "otg:blocks/portalotg_lightgreen" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_lightgreen_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_lightgreen", 4 | "portal": "otg:blocks/portalotg_lightgreen" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg", 4 | "portal": "otg:blocks/portalotg" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_orange_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_orange", 4 | "portal": "otg:blocks/portalotg_orange" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_orange_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_orange", 4 | "portal": "otg:blocks/portalotg_orange" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_pink_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_pink", 4 | "portal": "otg:blocks/portalotg_pink" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_pink_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_pink", 4 | "portal": "otg:blocks/portalotg_pink" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_red_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_red", 4 | "portal": "otg:blocks/portalotg_red" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_red_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_red", 4 | "portal": "otg:blocks/portalotg_red" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_white_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_white", 4 | "portal": "otg:blocks/portalotg_white" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_white_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_white", 4 | "portal": "otg:blocks/portalotg_white" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_yellow_ew.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_yellow", 4 | "portal": "otg:blocks/portalotg_yellow" 5 | }, 6 | "elements": [ 7 | { "from": [ 6, 0, 0 ], 8 | "to": [ 10, 16, 16 ], 9 | "faces": { 10 | "east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/models/block/portalotg_yellow_ns.json: -------------------------------------------------------------------------------- 1 | { 2 | "textures": { 3 | "particle": "otg:blocks/portalotg_yellow", 4 | "portal": "otg:blocks/portalotg_yellow" 5 | }, 6 | "elements": [ 7 | { "from": [ 0, 0, 6 ], 8 | "to": [ 16, 16, 10 ], 9 | "faces": { 10 | "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }, 11 | "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" } 12 | } 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_beige.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_beige.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_beige.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_black.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_black.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_blue.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_blue.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_crystalblue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_crystalblue.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_crystalblue.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_darkblue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_darkblue.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_darkblue.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_darkgreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_darkgreen.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_darkgreen.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_darkred.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_darkred.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_darkred.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_emerald.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_emerald.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_emerald.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_flame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_flame.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_flame.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_gold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_gold.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_gold.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_green.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_green.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_grey.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_grey.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_lightblue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_lightblue.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_lightblue.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_lightgreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_lightgreen.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_lightgreen.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_orange.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_orange.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_pink.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_pink.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_red.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_red.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_white.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_white.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PG85/OpenTerrainGenerator/b9d2d644e704487e389ee975fd92ea9cc8a59872/platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_yellow.png -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/assets/otg/textures/blocks/portalotg_yellow.png.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "animation": {} 3 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/otg.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "plugin": "com.pg85.otg.forge.mixin.MixinConfigPlugin", 3 | "required": true, 4 | "package": "com.pg85.otg.forge.mixin", 5 | "compatibilityLevel": "JAVA_8", 6 | "refmap": "otg.refmap.json", 7 | "mixins": [ 8 | "MixinChunkManager", 9 | "MixinSpawnLocationHelper", 10 | "MixinStructure", 11 | ], 12 | "injectors": { 13 | "defaultRequire": 1 14 | }, 15 | "minVersion": "0.8" 16 | } -------------------------------------------------------------------------------- /platforms/forge/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "openterraingenerator resources", 4 | "pack_format": 6, 5 | "_comment": "A pack_format of 6 requires json lang files and some texture changes from 1.16.4. Note: we require v6 pack meta for all mods." 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /platforms/spigot/src/main/java/com/pg85/otg/spigot/SpigotEngine.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.spigot; 2 | 3 | import com.pg85.otg.OTGEngine; 4 | import com.pg85.otg.spigot.materials.SpigotMaterials; 5 | import com.pg85.otg.spigot.presets.SpigotPresetLoader; 6 | import com.pg85.otg.spigot.util.SpigotLogger; 7 | import com.pg85.otg.spigot.util.SpigotPluginLoadedChecker; 8 | import org.bukkit.plugin.java.JavaPlugin; 9 | 10 | import java.io.File; 11 | import java.io.UnsupportedEncodingException; 12 | import java.net.URLDecoder; 13 | import java.nio.charset.StandardCharsets; 14 | 15 | public class SpigotEngine extends OTGEngine 16 | { 17 | private final JavaPlugin plugin; 18 | 19 | protected SpigotEngine (JavaPlugin plugin) 20 | { 21 | super( 22 | new SpigotLogger(), 23 | plugin.getDataFolder().toPath(), 24 | new SpigotPluginLoadedChecker(), 25 | new SpigotPresetLoader(plugin.getDataFolder()) 26 | ); 27 | this.plugin = plugin; 28 | } 29 | 30 | @Override 31 | public void onStart() 32 | { 33 | SpigotMaterials.init(); 34 | super.onStart(); 35 | } 36 | 37 | public JavaPlugin getPlugin() 38 | { 39 | return this.plugin; 40 | } 41 | 42 | @Override 43 | public File getJarFile() 44 | { 45 | String fileName = plugin.getClass().getProtectionDomain().getCodeSource().getLocation().getFile(); 46 | // URLEncoded string, decode. 47 | try { 48 | fileName = URLDecoder.decode(fileName, StandardCharsets.UTF_8.toString()); 49 | } catch (UnsupportedEncodingException e) { } 50 | 51 | if(fileName != null) 52 | { 53 | File modFile = new File(fileName); 54 | if(modFile.isFile()) 55 | { 56 | return modFile; 57 | } 58 | } 59 | return null; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /platforms/spigot/src/main/java/com/pg85/otg/spigot/api/OTGSpigotAPI.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.spigot.api; 2 | 3 | import java.util.Optional; 4 | 5 | import org.bukkit.Location; 6 | import org.bukkit.craftbukkit.v1_16_R3.CraftWorld; 7 | 8 | import com.pg85.otg.interfaces.IBiomeConfig; 9 | import com.pg85.otg.spigot.gen.OTGNoiseChunkGenerator; 10 | 11 | import net.minecraft.server.v1_16_R3.WorldServer; 12 | 13 | public class OTGSpigotAPI 14 | { 15 | public static IBiomeConfig getOTGBiome(Location location) 16 | { 17 | WorldServer world = ((CraftWorld) location.getWorld()).getHandle(); 18 | 19 | if (!(world.getChunkProvider().getChunkGenerator() instanceof OTGNoiseChunkGenerator)) 20 | { 21 | return null; 22 | } 23 | 24 | return ((OTGNoiseChunkGenerator) world.getChunkProvider().getChunkGenerator()).getCachedBiomeProvider() 25 | .getBiomeConfig(location.getBlockX(), location.getBlockZ()); 26 | } 27 | 28 | public static Optional getOTGBiomeOptional(Location location) 29 | { 30 | return Optional.ofNullable(getOTGBiome(location)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /platforms/spigot/src/main/java/com/pg85/otg/spigot/commands/CancelEditCommand.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.spigot.commands; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import org.bukkit.entity.Player; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | public class CancelEditCommand extends BaseCommand 10 | { 11 | 12 | public CancelEditCommand() { 13 | super("canceledit"); 14 | this.helpMessage = "Cancel and discard your current edit"; 15 | this.usage = "/otg canceledit"; 16 | } 17 | 18 | @Override 19 | public List onTabComplete(CommandSender sender, String[] args) 20 | { 21 | return new ArrayList<>(); 22 | } 23 | 24 | @Override 25 | public boolean execute(CommandSender sender, String[] args) 26 | { 27 | if (sender instanceof Player) 28 | { 29 | EditCommand.cancelSession((Player) sender); 30 | } else { 31 | sender.sendMessage("Only players can use this command"); 32 | } 33 | return true; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /platforms/spigot/src/main/java/com/pg85/otg/spigot/commands/FinishEditCommand.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.spigot.commands; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import org.bukkit.entity.Player; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | public class FinishEditCommand extends BaseCommand 10 | { 11 | 12 | public FinishEditCommand() { 13 | super("finishedit"); 14 | this.helpMessage = "Finish and save your current edit."; 15 | this.usage = "/otg finishedit"; 16 | } 17 | 18 | @Override 19 | public List onTabComplete(CommandSender sender, String[] args) 20 | { 21 | return new ArrayList<>(); 22 | } 23 | 24 | @Override 25 | public boolean execute(CommandSender sender, String[] args) 26 | { 27 | if (sender instanceof Player) 28 | { 29 | EditCommand.finishSession((Player) sender); 30 | } else { 31 | sender.sendMessage("Only players can use this command"); 32 | } 33 | return true; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /platforms/spigot/src/main/java/com/pg85/otg/spigot/commands/FlushCommand.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.spigot.commands; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.bukkit.command.CommandSender; 7 | import org.bukkit.entity.Player; 8 | 9 | import com.pg85.otg.OTG; 10 | import com.pg85.otg.util.logging.LogCategory; 11 | import com.pg85.otg.util.logging.LogLevel; 12 | 13 | public class FlushCommand extends BaseCommand 14 | { 15 | public FlushCommand() { 16 | super("flush"); 17 | this.helpMessage = "Clears all loaded objects, forcing them to be reloaded from disk."; 18 | this.usage = "/otg flush"; 19 | } 20 | 21 | public boolean execute(CommandSender sender, String[] args) 22 | { 23 | if (!(sender instanceof Player)) 24 | { 25 | sender.sendMessage("Only players can execute this command"); 26 | return true; 27 | } 28 | 29 | OTG.getEngine().getLogger().log(LogLevel.INFO, LogCategory.MAIN, "Unloading BO2/BO3/BO4 files"); 30 | OTG.getEngine().getCustomObjectManager().reloadCustomObjectFiles(); 31 | sender.sendMessage("Objects unloaded."); 32 | return true; 33 | } 34 | 35 | @Override 36 | public List onTabComplete(CommandSender sender, String[] args) 37 | { 38 | return Collections.emptyList(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /platforms/spigot/src/main/java/com/pg85/otg/spigot/commands/PresetCommand.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.spigot.commands; 2 | 3 | import java.util.Collections; 4 | import java.util.List; 5 | 6 | import org.bukkit.command.CommandSender; 7 | import org.bukkit.craftbukkit.v1_16_R3.CraftWorld; 8 | import org.bukkit.entity.Player; 9 | 10 | import com.pg85.otg.presets.Preset; 11 | import com.pg85.otg.spigot.gen.OTGNoiseChunkGenerator; 12 | 13 | import net.minecraft.server.v1_16_R3.WorldServer; 14 | 15 | public class PresetCommand extends BaseCommand 16 | { 17 | public PresetCommand() 18 | { 19 | super("preset"); 20 | this.helpMessage = "Displays information about the current world's preset."; 21 | this.usage = "/otg preset"; 22 | } 23 | 24 | public boolean execute(CommandSender sender, String[] args) 25 | { 26 | if (!(sender instanceof Player)) 27 | { 28 | sender.sendMessage("Only players can execute this command"); 29 | return true; 30 | } 31 | Player player = (Player) sender; 32 | WorldServer world = ((CraftWorld) player.getWorld()).getHandle(); 33 | 34 | if (!(world.getChunkProvider().getChunkGenerator() instanceof OTGNoiseChunkGenerator)) 35 | { 36 | sender.sendMessage("OTG is not enabled in this world"); 37 | return true; 38 | } 39 | 40 | Preset preset = ((OTGNoiseChunkGenerator) world.getChunkProvider().getChunkGenerator()).getPreset(); 41 | sender.sendMessage("Preset: " + preset.getFolderName() + 42 | "\nDescription: " + preset.getDescription() + 43 | "\nMajor version: " + preset.getMajorVersion()); 44 | return true; 45 | } 46 | 47 | @Override 48 | public List onTabComplete(CommandSender sender, String[] args) 49 | { 50 | return Collections.emptyList(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /platforms/spigot/src/main/java/com/pg85/otg/spigot/commands/WorldEditUtil.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.spigot.commands; 2 | 3 | import com.sk89q.worldedit.IncompleteRegionException; 4 | import com.sk89q.worldedit.WorldEdit; 5 | import com.sk89q.worldedit.bukkit.BukkitAdapter; 6 | import com.sk89q.worldedit.math.BlockVector3; 7 | import net.minecraft.server.v1_16_R3.BlockPosition; 8 | import org.bukkit.entity.Player; 9 | 10 | public class WorldEditUtil 11 | { 12 | public static RegionCommand.Region getRegionFromPlayer(Player source) 13 | { 14 | if (!WorldEdit.getInstance().getSessionManager().contains(BukkitAdapter.adapt(source))) 15 | { 16 | return null; 17 | } 18 | try 19 | { 20 | com.sk89q.worldedit.regions.Region weRegion = WorldEdit.getInstance().getSessionManager() 21 | .get(BukkitAdapter.adapt(source)) 22 | .getSelection(BukkitAdapter.adapt(source.getWorld())); 23 | RegionCommand.Region region = new RegionCommand.Region(); 24 | region.setPos(getPosFromVector3(weRegion.getMinimumPoint())); 25 | region.setPos(getPosFromVector3(weRegion.getMaximumPoint())); 26 | return region; 27 | } 28 | catch (IncompleteRegionException e) 29 | { 30 | return null; 31 | } 32 | } 33 | 34 | private static BlockPosition getPosFromVector3(BlockVector3 vector) 35 | { 36 | return new BlockPosition(vector.getBlockX(), vector.getBlockY(), vector.getBlockZ()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /platforms/spigot/src/main/java/com/pg85/otg/spigot/networking/OTGClientSyncManager.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.spigot.networking; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | public class OTGClientSyncManager 7 | { 8 | private static final Map syncedData = new HashMap<>(); 9 | 10 | public static Map getSyncedData() 11 | { 12 | return syncedData; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /platforms/spigot/src/main/java/com/pg85/otg/spigot/util/SpigotLogger.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.spigot.util; 2 | 3 | import com.pg85.otg.constants.Constants; 4 | import com.pg85.otg.util.logging.LogCategory; 5 | import com.pg85.otg.util.logging.LogLevel; 6 | import com.pg85.otg.util.logging.Logger; 7 | 8 | import org.apache.logging.log4j.LogManager; 9 | 10 | public class SpigotLogger extends Logger 11 | { 12 | private final org.apache.logging.log4j.Logger logger = LogManager.getLogger(Constants.MOD_ID_SHORT); 13 | 14 | @Override 15 | public void log (LogLevel level, LogCategory category, String message) 16 | { 17 | if (this.minimumLevel.compareTo(level) < 0) 18 | { 19 | // Only log messages that we want to see... 20 | return; 21 | } 22 | 23 | // Add prefix to log output 24 | // Spigot does not need prefix 25 | // message = "[" + Constants.MOD_ID_SHORT + "] " + message; 26 | switch (level) 27 | { 28 | case FATAL: 29 | this.logger.fatal(category.getLogTag() + " " + message); 30 | break; 31 | case ERROR: 32 | this.logger.error(category.getLogTag() + " " + message); 33 | break; 34 | case WARN: 35 | this.logger.warn(category.getLogTag() + " " + message); 36 | break; 37 | case INFO: 38 | this.logger.info(category.getLogTag() + " " + message); 39 | break; 40 | default: 41 | break; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /platforms/spigot/src/main/java/com/pg85/otg/spigot/util/SpigotPluginLoadedChecker.java: -------------------------------------------------------------------------------- 1 | package com.pg85.otg.spigot.util; 2 | 3 | import org.bukkit.Bukkit; 4 | 5 | import com.pg85.otg.interfaces.IModLoadedChecker; 6 | 7 | public class SpigotPluginLoadedChecker implements IModLoadedChecker 8 | { 9 | @Override 10 | public boolean isModLoaded (String mod) 11 | { 12 | return Bukkit.getServer().getPluginManager().isPluginEnabled(mod); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /resources/DimensionConfigs/Example 1.yaml: -------------------------------------------------------------------------------- 1 | # Forge only: Dimension configs are used to set up OTG dimensions for Forge MP servers, and to configure modpacks for SP & MP. 2 | # Use: 3 | # Forge MP: Set the name of this config (without .yaml) as server-properties generator-settings. 4 | # Forge SP: Modpacks can use this config to lock the world creation GUI and use the settings in this config instead, so users can create a world with 1 click. 5 | # - Rename this file to Modpack.yaml, OTG will automatically replace the world creation GUI with a locked custom world creation screen. 6 | # For more information, see: https://openterraingen.fandom.com/wiki/Dimension_%26_Modpack_Configuration 7 | # 8 | # This config creates an OTG overworld using OTG's "Default" preset, and adds a dimension using the "VanillaVistas" preset. 9 | --- 10 | Overworld: 11 | PresetFolderName: "Default" 12 | Dimensions: 13 | - PresetFolderName: "VanillaVistas" -------------------------------------------------------------------------------- /resources/DimensionConfigs/Example 2.yaml: -------------------------------------------------------------------------------- 1 | # Forge only: Dimension configs are used to set up OTG dimensions for Forge MP servers, and to configure modpacks for SP & MP. 2 | # Use: 3 | # Forge MP: Set the name of this config (without .yaml) as server-properties generator-settings. 4 | # Forge SP: Modpacks can use this config to lock the world creation GUI and use the settings in this config instead, so users can create a world with 1 click. 5 | # - Rename this file to Modpack.yaml, OTG will automatically replace the world creation GUI with a locked custom world creation screen. 6 | # For more information, see: https://openterraingen.fandom.com/wiki/Dimension_%26_Modpack_Configuration 7 | # 8 | # This config creates an vanilla "flat" overworld, and adds a dimension using the "VanillaVistas" preset. 9 | # Note: The NonOTGGeneratorSettings setting can be used to add a generator-settings JSON string for the "flat" overworld. 10 | --- 11 | Overworld: 12 | NonOTGWorldType: "flat" 13 | NonOTGGeneratorSettings: 14 | Dimensions: 15 | - PresetFolderName: "VanillaVistas" -------------------------------------------------------------------------------- /resources/DimensionConfigs/Example 3.yaml: -------------------------------------------------------------------------------- 1 | # Forge only: Dimension configs are used to set up OTG dimensions for Forge MP servers, and to configure modpacks for SP & MP. 2 | # Use: 3 | # Forge MP: Set the name of this config (without .yaml) as server-properties generator-settings. 4 | # Forge SP: Modpacks can use this config to lock the world creation GUI and use the settings in this config instead, so users can create a world with 1 click. 5 | # - Rename this file to Modpack.yaml, OTG will automatically replace the world creation GUI with a locked custom world creation screen. 6 | # For more information, see: https://openterraingen.fandom.com/wiki/Dimension_%26_Modpack_Configuration 7 | # 8 | # This config creates a Biomes O' Plenty overworld with OTG Nether and End using the "Skylands" and "SkylandsTall" presets. 9 | # It also add a dimension using the "VanillaVistas" preset. 10 | # Note: The NonOTGGeneratorSettings setting can be used to add a generator-settings JSON string for the "biomesoplenty" overworld. 11 | --- 12 | Overworld: 13 | NonOTGWorldType: "biomesoplenty" 14 | NonOTGGeneratorSettings: 15 | Nether: 16 | PresetFolderName: "Skylands" 17 | End: 18 | PresetFolderName: "SkylandsTall" 19 | Dimensions: 20 | - PresetFolderName: "VanillaVistas" -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | maven { 5 | name = 'Fabric' 6 | url = 'https://maven.fabricmc.net/' 7 | } 8 | } 9 | } 10 | 11 | include 'common:common-util', 'common:common-config', 'common:common-customobject', 'common:common-generator', 'common:common-core', 'platforms:forge', 'platforms:fabric' 12 | include 'platforms:spigot' 13 | findProject(':platforms:spigot')?.name = 'spigot' 14 | 15 | --------------------------------------------------------------------------------