From 5ac0de27e74d90b820571d8d40ed66dd47f1d496 Mon Sep 17 00:00:00 2001 From: encryptiongs Date: Tue, 23 Jul 2024 20:10:53 +0200 Subject: [PATCH] 1.20.1 --- .gitattributes | 8 + .github/workflows/github-automated-build.yaml | 2 +- .gitignore | 7 + README.md | 20 +- build.gradle | 23 +- gradle.properties | 21 +- gradle/gradle-daemon-jvm.properties | 2 + gradle/wrapper/gradle-wrapper.jar | Bin 59536 -> 43453 bytes gradle/wrapper/gradle-wrapper.properties | 4 +- gradlew | 51 +- gradlew.bat | 35 +- .../kpabr/backrooms/BackroomsComponents.java | 4 +- .../com/kpabr/backrooms/BackroomsMod.java | 38 +- .../com/kpabr/backrooms/api/LevelsApi.java | 5 +- .../kpabr/backrooms/api/WretchedCycleApi.java | 1 + .../backrooms/block/AbstractPipeBlock.java | 41 +- .../backrooms/block/BackroomsDoorBlock.java | 5 +- .../kpabr/backrooms/block/ComputerBlock.java | 7 +- .../block/CrackedCopperPipeBlock.java | 37 +- .../backrooms/block/CrackedPipeBlock.java | 34 +- .../com/kpabr/backrooms/block/CrateBlock.java | 38 +- .../backrooms/block/FiresaltCrystalBlock.java | 17 - .../block/FluorescentLightBlock.java | 5 +- .../kpabr/backrooms/block/MachineryBlock.java | 67 +- .../com/kpabr/backrooms/block/MaskBlock.java | 42 +- .../kpabr/backrooms/block/MoldyTileBlock.java | 2 +- .../com/kpabr/backrooms/block/PipeBlock.java | 46 +- .../com/kpabr/backrooms/block/PlateDoor.java | 3 +- .../kpabr/backrooms/block/PortalBlock.java | 25 +- .../backrooms/block/PyroilLineBlock.java | 134 +-- .../block/RepairedFluorescentLightBlock.java | 62 +- .../backrooms/block/RoofWiringBlock.java | 80 +- .../com/kpabr/backrooms/block/TileBlock.java | 8 - .../kpabr/backrooms/block/TilemoldBlock.java | 31 +- .../kpabr/backrooms/block/WallpaperBlock.java | 14 +- .../block/entity/ComputerBlockEntity.java | 5 +- .../block/entity/CrateBlockEntity.java | 24 +- .../block/entity/MaskBlockEntity.java | 11 +- .../block/entity/PyroilLineBlockEntity.java | 15 +- .../backrooms/client/BackroomsClient.java | 24 +- .../client/entity/model/HoundModel.java | 10 +- .../client/entity/model/WretchModel.java | 10 +- .../entity/renderer/HoundEntityRenderer.java | 5 +- .../entity/renderer/WretchEntityRenderer.java | 3 +- .../sky/RemoveSkyboxQuadsBakedModel.java | 4 +- .../client/render/sky/SkyboxShaders.java | 27 +- .../component/PlayerWretchedComponent.java | 3 +- .../component/WretchedComponent.java | 4 + .../backrooms/config/BackroomsConfig.java | 8 +- .../backrooms/effect/RaggedStatusEffect.java | 12 +- .../backrooms/effect/RottenStatusEffect.java | 12 +- .../effect/WretchedStatusEffect.java | 12 +- .../entity/FireSaltProjectileEntity.java | 20 +- .../kpabr/backrooms/entity/HoundEntity.java | 85 +- .../backrooms/entity/HoundEntityTasks.java | 68 +- .../kpabr/backrooms/entity/WretchEntity.java | 83 +- .../backrooms/entity/WretchEntityTasks.java | 74 +- .../backrooms/fluid/AlmondWaterFluid.java | 11 + .../kpabr/backrooms/fluid/DefaultFluid.java | 7 +- .../backrooms/init/BackroomStatusEffects.java | 9 +- .../kpabr/backrooms/init/BackroomsBlocks.java | 353 ++++++-- .../backrooms/init/BackroomsDamageSource.java | 13 - .../backrooms/init/BackroomsDamageTypes.java | 18 + .../backrooms/init/BackroomsEntities.java | 16 +- .../kpabr/backrooms/init/BackroomsFluids.java | 11 +- .../backrooms/init/BackroomsGamerules.java | 65 +- .../kpabr/backrooms/init/BackroomsGroups.java | 45 +- .../kpabr/backrooms/init/BackroomsItems.java | 90 ++- .../kpabr/backrooms/init/BackroomsLevels.java | 197 +++-- .../backrooms/init/BackroomsLootTables.java | 2 +- .../backrooms/init/BackroomsParticles.java | 5 +- .../backrooms/init/BackroomsProjectiles.java | 5 +- .../kpabr/backrooms/init/BackroomsSounds.java | 2 + .../backrooms/items/AlmondWaterItem.java | 12 +- .../com/kpabr/backrooms/items/FireSalt.java | 2 +- .../com/kpabr/backrooms/items/MaskItem.java | 10 +- .../mixins/BackgroundRendererMixin.java | 25 - .../mixins/BlockRenderManagerMixin.java | 1 - .../mixins/BrewingRecipeRegistryMixin.java | 2 +- ...hunkBuilderBuiltChunkRebuildTaskMixin.java | 9 +- .../kpabr/backrooms/mixins/EntityMixin.java | 24 +- .../backrooms/mixins/GameRendererMixin.java | 9 +- .../backrooms/mixins/InGameHudMixin.java | 31 +- .../backrooms/mixins/ItemRendererMixin.java | 55 +- .../backrooms/mixins/LivingEntityMixin.java | 2 +- .../mixins/PlayerScreenHandlerMixin.java | 8 +- .../backrooms/mixins/RenderLayerAccessor.java | 4 +- .../mixins/ScreenHandlerAccessor.java | 3 - .../ServerPlayerInteractionManagerMixin.java | 5 +- .../backrooms/mixins/WorldRendererMixin.java | 66 +- .../backrooms/particle/FireSaltParticle.java | 2 - .../backrooms/util/BiomeListBuilder.java | 2 +- .../backrooms/util/BiomeRegistryList.java | 12 +- .../java/com/kpabr/backrooms/util/Color.java | 24 +- .../backrooms/util/ElectricalStationRoom.java | 58 +- .../kpabr/backrooms/util/EntityHelper.java | 5 +- .../kpabr/backrooms/util/LevelParameters.java | 35 +- .../com/kpabr/backrooms/util/MathUtil.java | 2 +- .../kpabr/backrooms/util/NbtPlacerUtil.java | 138 ++-- .../kpabr/backrooms/util/RegistryHelper.java | 38 +- .../backrooms/util/SACallbackManager.java | 1 - .../biomes/level0/CrimsonHallsBiome.java | 40 - .../biome/biomes/level0/DecrepitBiome.java | 39 - .../biomes/level0/MegalophobiaBiome.java | 35 - .../biome/biomes/level0/YellowHallsBiome.java | 35 - .../biome/biomes/level1/CementHallsBiome.java | 38 - .../biomes/level1/ParkingGarageBiome.java | 38 - .../biome/biomes/level1/WarehouseBiome.java | 37 - .../world/biome/biomes/level2/PipesBiome.java | 36 - .../biomes/level3/ElectricalStationBiome.java | 40 - .../biome/sources/LevelOneBiomeSource.java | 92 ++- .../biome/sources/LevelThreeBiomeSource.java | 32 +- .../biome/sources/LevelTwoBiomeSource.java | 34 +- .../biome/sources/LevelZeroBiomeSource.java | 95 +-- .../world/chunk/LevelOneChunkGenerator.java | 178 ++-- .../world/chunk/LevelThreeChunkGenerator.java | 140 ++-- .../world/chunk/LevelTwoChunkGenerator.java | 250 +++--- .../world/chunk/LevelZeroChunkGenerator.java | 764 ++++++++++-------- .../CementHallsChunkGenerator.java | 222 ++--- .../ParkingGarageChunkGenerator.java | 196 +++-- .../WarehouseChunkGenerator.java | 362 +++++---- src/main/java/name/trimsky/lib_ai/LibAI.java | 15 +- .../lib_ai/SimpleTaskControllerManager.java | 2 +- .../name/trimsky/lib_ai/TaskController.java | 7 +- .../name/trimsky/lib_ai/example/LibAIMod.java | 43 - .../example/client/ExampleEntityModel.java | 27 - .../example/client/ExampleEntityRenderer.java | 12 - .../lib_ai/example/entity/ExampleEntity.java | 72 -- .../example/tasks/LookAtEntityTask.java | 37 - .../name/trimsky/lib_ai/tasks/EmptyTask.java | 6 +- .../name/trimsky/lib_ai/tasks/GroupTask.java | 27 +- .../name/trimsky/lib_ai/tasks/SingleTask.java | 7 +- .../java/name/trimsky/lib_ai/tasks/Task.java | 1 + .../backrooms/blockstates/office_door.json | 64 +- .../backrooms/blockstates/plate_door.json | 64 +- .../assets/backrooms/lang/en_us.json | 2 +- .../models/block/colombina_mask.json | 4 +- .../models/block/cracked_pipe_ew.json | 2 +- .../models/block/cracked_pipe_ns.json | 2 +- .../models/block/harlequin_mask.json | 4 +- .../models/block/office_door_bottom.json | 7 - .../block/office_door_bottom_hinge.json | 7 - .../models/block/office_door_bottom_left.json | 7 + .../block/office_door_bottom_left_open.json | 7 + .../block/office_door_bottom_right.json | 7 + .../block/office_door_bottom_right_open.json | 7 + .../models/block/office_door_top.json | 7 - .../models/block/office_door_top_hinge.json | 7 - .../models/block/office_door_top_left.json | 7 + .../block/office_door_top_left_open.json | 7 + .../models/block/office_door_top_right.json | 7 + .../block/office_door_top_right_open.json | 7 + .../models/block/plate_door_bottom.json | 7 - .../models/block/plate_door_bottom_hinge.json | 7 - .../models/block/plate_door_bottom_left.json | 7 + .../block/plate_door_bottom_left_open.json | 7 + .../models/block/plate_door_bottom_right.json | 7 + .../block/plate_door_bottom_right_open.json | 7 + .../models/block/plate_door_top.json | 7 - .../models/block/plate_door_top_hinge.json | 7 - .../models/block/plate_door_top_left.json | 7 + .../block/plate_door_top_left_open.json | 7 + .../models/block/plate_door_top_right.json | 7 + .../block/plate_door_top_right_open.json | 7 + .../models/block/sock_buskin_mask.json | 4 +- .../{armor => block}/colombina_mask.png | Bin .../{armor => block}/harlequin_mask.png | Bin .../{armor => block}/sock_buskin_mask.png | Bin .../backrooms/textures/block/wiring_edge.png | Bin 157 -> 121 bytes .../backrooms/damage_type/wretched_cycle.json | 7 + .../dimension_type/level_0_type.json | 4 +- .../dimension_type/level_1_type.json | 8 +- .../dimension_type/level_2_type.json | 4 +- .../dimension_type/level_3_type.json | 4 +- .../worldgen/biome/cement_walls.json | 26 + .../worldgen/biome/crimson_walls.json | 26 + .../backrooms/worldgen/biome/decrepit.json | 26 + .../worldgen/biome/electrical_station.json | 26 + .../worldgen/biome/megalophobia.json | 18 + .../worldgen/biome/parking_garage.json | 26 + .../data/backrooms/worldgen/biome/pipes.json | 17 + .../backrooms/worldgen/biome/warehouse.json | 26 + .../worldgen/biome/yellow_walls.json | 18 + src/main/resources/fabric.mod.json | 4 +- 184 files changed, 3399 insertions(+), 2986 deletions(-) create mode 100644 .gitattributes create mode 100644 gradle/gradle-daemon-jvm.properties delete mode 100644 src/main/java/com/kpabr/backrooms/init/BackroomsDamageSource.java create mode 100644 src/main/java/com/kpabr/backrooms/init/BackroomsDamageTypes.java delete mode 100644 src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/CrimsonHallsBiome.java delete mode 100644 src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/DecrepitBiome.java delete mode 100644 src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/MegalophobiaBiome.java delete mode 100644 src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/YellowHallsBiome.java delete mode 100644 src/main/java/com/kpabr/backrooms/world/biome/biomes/level1/CementHallsBiome.java delete mode 100644 src/main/java/com/kpabr/backrooms/world/biome/biomes/level1/ParkingGarageBiome.java delete mode 100644 src/main/java/com/kpabr/backrooms/world/biome/biomes/level1/WarehouseBiome.java delete mode 100644 src/main/java/com/kpabr/backrooms/world/biome/biomes/level2/PipesBiome.java delete mode 100644 src/main/java/com/kpabr/backrooms/world/biome/biomes/level3/ElectricalStationBiome.java delete mode 100644 src/main/java/name/trimsky/lib_ai/example/LibAIMod.java delete mode 100644 src/main/java/name/trimsky/lib_ai/example/client/ExampleEntityModel.java delete mode 100644 src/main/java/name/trimsky/lib_ai/example/client/ExampleEntityRenderer.java delete mode 100644 src/main/java/name/trimsky/lib_ai/example/entity/ExampleEntity.java delete mode 100644 src/main/java/name/trimsky/lib_ai/example/tasks/LookAtEntityTask.java delete mode 100644 src/main/resources/assets/backrooms/models/block/office_door_bottom.json delete mode 100644 src/main/resources/assets/backrooms/models/block/office_door_bottom_hinge.json create mode 100644 src/main/resources/assets/backrooms/models/block/office_door_bottom_left.json create mode 100644 src/main/resources/assets/backrooms/models/block/office_door_bottom_left_open.json create mode 100644 src/main/resources/assets/backrooms/models/block/office_door_bottom_right.json create mode 100644 src/main/resources/assets/backrooms/models/block/office_door_bottom_right_open.json delete mode 100644 src/main/resources/assets/backrooms/models/block/office_door_top.json delete mode 100644 src/main/resources/assets/backrooms/models/block/office_door_top_hinge.json create mode 100644 src/main/resources/assets/backrooms/models/block/office_door_top_left.json create mode 100644 src/main/resources/assets/backrooms/models/block/office_door_top_left_open.json create mode 100644 src/main/resources/assets/backrooms/models/block/office_door_top_right.json create mode 100644 src/main/resources/assets/backrooms/models/block/office_door_top_right_open.json delete mode 100644 src/main/resources/assets/backrooms/models/block/plate_door_bottom.json delete mode 100644 src/main/resources/assets/backrooms/models/block/plate_door_bottom_hinge.json create mode 100644 src/main/resources/assets/backrooms/models/block/plate_door_bottom_left.json create mode 100644 src/main/resources/assets/backrooms/models/block/plate_door_bottom_left_open.json create mode 100644 src/main/resources/assets/backrooms/models/block/plate_door_bottom_right.json create mode 100644 src/main/resources/assets/backrooms/models/block/plate_door_bottom_right_open.json delete mode 100644 src/main/resources/assets/backrooms/models/block/plate_door_top.json delete mode 100644 src/main/resources/assets/backrooms/models/block/plate_door_top_hinge.json create mode 100644 src/main/resources/assets/backrooms/models/block/plate_door_top_left.json create mode 100644 src/main/resources/assets/backrooms/models/block/plate_door_top_left_open.json create mode 100644 src/main/resources/assets/backrooms/models/block/plate_door_top_right.json create mode 100644 src/main/resources/assets/backrooms/models/block/plate_door_top_right_open.json rename src/main/resources/assets/backrooms/textures/{armor => block}/colombina_mask.png (100%) rename src/main/resources/assets/backrooms/textures/{armor => block}/harlequin_mask.png (100%) rename src/main/resources/assets/backrooms/textures/{armor => block}/sock_buskin_mask.png (100%) create mode 100644 src/main/resources/data/backrooms/damage_type/wretched_cycle.json create mode 100644 src/main/resources/data/backrooms/worldgen/biome/cement_walls.json create mode 100644 src/main/resources/data/backrooms/worldgen/biome/crimson_walls.json create mode 100644 src/main/resources/data/backrooms/worldgen/biome/decrepit.json create mode 100644 src/main/resources/data/backrooms/worldgen/biome/electrical_station.json create mode 100644 src/main/resources/data/backrooms/worldgen/biome/megalophobia.json create mode 100644 src/main/resources/data/backrooms/worldgen/biome/parking_garage.json create mode 100644 src/main/resources/data/backrooms/worldgen/biome/pipes.json create mode 100644 src/main/resources/data/backrooms/worldgen/biome/warehouse.json create mode 100644 src/main/resources/data/backrooms/worldgen/biome/yellow_walls.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a6e97c7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,8 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# Linux start script should use lf +/gradlew text eol=lf + +# These are Windows script files and should use crlf +*.bat text eol=crlf \ No newline at end of file diff --git a/.github/workflows/github-automated-build.yaml b/.github/workflows/github-automated-build.yaml index 509d0cd..96ed031 100644 --- a/.github/workflows/github-automated-build.yaml +++ b/.github/workflows/github-automated-build.yaml @@ -8,7 +8,7 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: java-version: '17' diff --git a/.gitignore b/.gitignore index 09cd281..c476faf 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,10 @@ bin/ # fabric run/ + +# java + +hs_err_*.log +replay_*.log +*.hprof +*.jfr diff --git a/README.md b/README.md index ffdb2e6..d5679f9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Backrooms Exploration -This is a Fabric 1.18.2 mod adding the Backrooms to Minecraft. +This is a Fabric 1.20.1 mod adding the Backrooms to Minecraft. -\[README still incomplete\] +\[README incomplete\] ## Features @@ -54,24 +54,24 @@ Snapshots are still work-in-progress builds, but they are considered as more sta ### Install the mod -This is a Fabric 1.18.2 mod, so you need a Fabric 1.18.2 profile with a *mods* folder. Place the .jar file there. +This is a Fabric 1.20.1 mod, so you need a Fabric 1.20.1 (Fabric 0.15.11) profile with a *mods* folder. Place the .jar file there. -The Backrooms mod depends on some other mods and libraries. You must install them with the right version (compatible with 1.18.2): -- ClothConfig (6.5.116) -- Mod Menu (3.2.5) -- Satin API (1.7.2) (there is no 1.18.2 version, so we use 1.18.1 version) -- Geckolib (3.0.80) +The Backrooms mod depends on some other mods and libraries. You must install them with the right version (compatible with 1.20.1): +- ClothConfig (11.1.118) +- Mod Menu (7.2.2) +- Satin API (1.14.0) +- Geckolib (4.4.7) Other versions may work, but it is not guaranteed. ### Settings -You can change some settings. In Mod Menu, click on the Backrooms and open the configuration screen. +You can change some settings. In Mod Menu, click on the Backrooms and open the configuration screen. Some of them have no effect yet. ## Building and Running -If you are a developer, you can build the mod on your own and run a debug build. Make sure you have JDK 17 installed on your machine, since we use 1.18.2 and Gradle 7.4. Clone this Repository and open it in your preferred IDE. Follow the instructions on [the Fabric Wiki](https://fabricmc.net/wiki/tutorial:setup). You can skip "Mod Setup". +If you are a developer, you can build the mod on your own and run a debug build. Make sure you have JDK 17 or higher installed on your machine, since we use 1.20.1 and Gradle 8.8. Clone this Repository and open it in your preferred IDE. Follow the instructions on [the Fabric Wiki](https://fabricmc.net/wiki/tutorial:setup). You can skip "Mod Setup". ## License diff --git a/build.gradle b/build.gradle index ed8c77b..f8b453d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,17 +1,14 @@ - - plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' + id 'fabric-loom' version '1.7-SNAPSHOT' id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - -archivesBaseName = project.archives_base_name version = project.mod_version group = project.maven_group +base { + archivesName = project.archives_base_name +} loom { accessWidenerPath = file("src/main/resources/backrooms.accesswidener") @@ -45,12 +42,15 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "io.github.ladysnake:satin:${satin_version}" - modImplementation "software.bernie.geckolib:geckolib-fabric-1.18:${geckolib_version}" + modImplementation "software.bernie.geckolib:geckolib-fabric-${minecraft_version}:${geckolib_version}" modApi "com.terraformersmc:modmenu:${project.modmenu_version}" - modImplementation "me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}" + modApi ("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { + exclude(group: "net.fabricmc.fabric-api") + exclude(group: "net.fabricmc", module: "fabric-loader") + } modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cardinal_components_version}" modImplementation "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cardinal_components_version}" @@ -60,8 +60,6 @@ dependencies { include "dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cardinal_components_version}" } - - processResources { inputs.property "version", project.version @@ -77,6 +75,9 @@ tasks.withType(JavaCompile).configureEach { java { withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } jar { diff --git a/gradle.properties b/gradle.properties index a6a2b25..b83f9ae 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,17 +1,18 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx4G +org.gradle.parallel=true # Fabric Properties - # check these on https://fabricmc.net/develop -minecraft_version=1.18.2 -yarn_mappings=1.18.2+build.4 -loader_version=0.15.7 +# check these on https://fabricmc.net/develop +minecraft_version=1.20.1 +yarn_mappings=1.20.1+build.10 +loader_version=0.15.11 # Mod Depencies - cloth_config_version=6.5.116 - modmenu_version=3.2.5 - satin_version=1.7.2 - cardinal_components_version=4.2.0 - geckolib_version=3.0.80 + cloth_config_version=11.1.118 + modmenu_version=7.2.2 + satin_version=1.14.0 + cardinal_components_version=5.2.2 + geckolib_version=4.4.7 # Mod Properties mod_version = 0.6.10 maven_group = net.synchlabs @@ -19,4 +20,4 @@ maven_group = net.synchlabs archives_base_name = the-backrooms # Dependencies -fabric_version=0.77.0+1.18.2 +fabric_version=0.92.2+1.20.1 diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties new file mode 100644 index 0000000..858feb7 --- /dev/null +++ b/gradle/gradle-daemon-jvm.properties @@ -0,0 +1,2 @@ +#This file is generated by updateDaemonJvm +toolchainVersion=17 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2ae8848c63b8b4dea2cb829da983f2fa..e6441136f3d4ba8a0da8d277868979cfbc8ad796 100644 GIT binary patch literal 43453 zcma&N1CXTcmMvW9vTb(Rwr$&4wr$(C?dmSu>@vG-+vuvg^_??!{yS%8zW-#zn-LkA z5&1^$^{lnmUON?}LBF8_K|(?T0Ra(xUH{($5eN!MR#ZihR#HxkUPe+_R8Cn`RRs(P z_^*#_XlXmGv7!4;*Y%p4nw?{bNp@UZHv1?Um8r6)Fei3p@ClJn0ECfg1hkeuUU@Or zD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0Hg#!EtFhRuOm$u8e~a9 z5(roy7m$Kh+zjW6@zw{&20u?1f2uP&boD}$#Zy)4o&T;vyBoqFiF2t;*g=|1=)PxB z8eM3Mp=l_obbc?I^xyLz?4Y1YDWPa+nm;O<$Cn;@ane616`J9OO2r=rZr{I_Kizyc zP#^^WCdIEp*()rRT+*YZK>V@^Zs=ht32x>Kwe zab)@ZEffz;VM4{XA6e421^h~`ji5r%)B{wZu#hD}f3$y@L0JV9f3g{-RK!A?vBUA}${YF(vO4)@`6f1 z-A|}e#LN{)(eXloDnX4Vs7eH|<@{r#LodP@Nz--$Dg_Par%DCpu2>2jUnqy~|J?eZ zBG4FVsz_A+ibdwv>mLp>P!(t}E>$JGaK$R~;fb{O3($y1ssQQo|5M;^JqC?7qe|hg zu0ZOqeFcp?qVn&Qu7FQJ4hcFi&|nR!*j)MF#b}QO^lN%5)4p*D^H+B){n8%VPUzi! zDihoGcP71a6!ab`l^hK&*dYrVYzJ0)#}xVrp!e;lI!+x+bfCN0KXwUAPU9@#l7@0& QuEJmfE|#`Dqx|px0L@K;Y5)KL diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 41dfb87..a441313 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index c53aefa..b740cf1 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +80,11 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +131,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +214,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..25da30d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,13 +41,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/src/main/java/com/kpabr/backrooms/BackroomsComponents.java b/src/main/java/com/kpabr/backrooms/BackroomsComponents.java index dda0fee..a1fbefc 100644 --- a/src/main/java/com/kpabr/backrooms/BackroomsComponents.java +++ b/src/main/java/com/kpabr/backrooms/BackroomsComponents.java @@ -9,8 +9,8 @@ import dev.onyxstudios.cca.api.v3.entity.RespawnCopyStrategy; public final class BackroomsComponents implements EntityComponentInitializer { - public static final ComponentKey WRETCHED = - ComponentRegistryV3.INSTANCE.getOrCreate(BackroomsMod.id("wretched"), WretchedComponent.class); + public static final ComponentKey WRETCHED = ComponentRegistryV3.INSTANCE + .getOrCreate(BackroomsMod.id("wretched"), WretchedComponent.class); @Override public void registerEntityComponentFactories(EntityComponentFactoryRegistry registry) { diff --git a/src/main/java/com/kpabr/backrooms/BackroomsMod.java b/src/main/java/com/kpabr/backrooms/BackroomsMod.java index 92a6dc7..fa71ca1 100644 --- a/src/main/java/com/kpabr/backrooms/BackroomsMod.java +++ b/src/main/java/com/kpabr/backrooms/BackroomsMod.java @@ -4,7 +4,6 @@ import com.kpabr.backrooms.config.BackroomsConfig; import com.kpabr.backrooms.init.*; import name.trimsky.lib_ai.LibAI; -import name.trimsky.lib_ai.example.LibAIMod; import net.fabricmc.api.ModInitializer; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; import net.minecraft.entity.SpawnReason; @@ -13,7 +12,6 @@ import net.minecraft.util.Identifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import software.bernie.example.GeckoLibMod; import static com.kpabr.backrooms.BackroomsComponents.WRETCHED; @@ -34,8 +32,8 @@ public void onInitialize() { BackroomsProjectiles.init(); BackroomsFluids.init(); BackroomsBlocks.init(); - BackroomsGroups.init(); BackroomsItems.init(); + BackroomsGroups.init(); BackroomsEntities.init(); BackroomsLevels.init(); @@ -44,13 +42,14 @@ public void onInitialize() { ServerTickEvents.END_SERVER_TICK.register((server) -> { // Iterating through every player - // And check if they're on the server for at least (wretchedCycleStepTime) seconds + // And check if they're on the server for at least (wretchedCycleStepTime) + // seconds for (ServerPlayerEntity player : server.getPlayerManager().getPlayerList()) { - if((player.age % (20 * BackroomsConfig.getInstance().wretchedCycleStepTime)) == 0 && player.age != 0) { - applyWretchedCycle(player); + if ((player.age % (20 * BackroomsConfig.getInstance().wretchedCycleStepTime)) == 0 && player.age != 0) { + applyWretchedCycle(player); } } - }); + }); } public static Identifier id(String name) { @@ -58,7 +57,7 @@ public static Identifier id(String name) { } public static void applyWretchedCycle(ServerPlayerEntity player) { - if(player.isCreative() || player.isSpectator()) { + if (player.isCreative() || player.isSpectator()) { if (player.hasStatusEffect(BackroomStatusEffects.RAGGED)) { player.removeStatusEffect(BackroomStatusEffects.RAGGED); } else if (player.hasStatusEffect(BackroomStatusEffects.ROTTEN)) { @@ -71,11 +70,13 @@ public static void applyWretchedCycle(ServerPlayerEntity player) { WretchedComponent wretched = WRETCHED.get(player); final var currentWorld = player.getWorld().getRegistryKey().getValue().getNamespace(); - if(currentWorld.equals("backrooms") && player.isAlive()) { - if(wretched.increment()) { + if (currentWorld.equals("backrooms") && player.isAlive()) { + if (wretched.increment()) { wretched.remove(100); - BackroomsEntities.WRETCH.spawn(player.getWorld(), null, null, player, player.getBlockPos(), SpawnReason.MOB_SUMMONED, false, false); - player.damage(BackroomsDamageSource.WRETCHED_CYCLE_DEATH, Float.MAX_VALUE); + BackroomsEntities.WRETCH.spawn(player.getServerWorld(), player.getBlockPos(), SpawnReason.MOB_SUMMONED); + player.damage( + BackroomsDamageTypes.of(player.getWorld(), BackroomsDamageTypes.WRETCHED_CYCLE_DAMAGE_TYPE), + Float.MAX_VALUE); player.removeStatusEffect(BackroomStatusEffects.WRETCHED); return; } @@ -83,20 +84,17 @@ public static void applyWretchedCycle(ServerPlayerEntity player) { wretched.decrement(); } - if(wretched.getValue() >= 24 && wretched.getValue() < 50 && !player.hasStatusEffect(BackroomStatusEffects.RAGGED)) { + if (wretched.getValue() >= 24 && wretched.getValue() < 50 + && !player.hasStatusEffect(BackroomStatusEffects.RAGGED)) { player.addStatusEffect(new StatusEffectInstance(BackroomStatusEffects.RAGGED, 9999999)); - } else if(wretched.getValue() >= 50 && wretched.getValue() < 75 && !player.hasStatusEffect(BackroomStatusEffects.ROTTEN)) { + } else if (wretched.getValue() >= 50 && wretched.getValue() < 75 + && !player.hasStatusEffect(BackroomStatusEffects.ROTTEN)) { player.removeStatusEffect(BackroomStatusEffects.RAGGED); player.addStatusEffect(new StatusEffectInstance(BackroomStatusEffects.ROTTEN, 9999999)); - } else if(wretched.getValue() >= 75 && !player.hasStatusEffect(BackroomStatusEffects.WRETCHED)) { + } else if (wretched.getValue() >= 75 && !player.hasStatusEffect(BackroomStatusEffects.WRETCHED)) { player.removeStatusEffect(BackroomStatusEffects.RAGGED); player.removeStatusEffect(BackroomStatusEffects.ROTTEN); player.addStatusEffect(new StatusEffectInstance(BackroomStatusEffects.WRETCHED, 9999999)); } } - - static { - GeckoLibMod.DISABLE_IN_DEV = true; - LibAIMod.DISABLE_IN_DEV_ENVIRONMENT = true; - } } diff --git a/src/main/java/com/kpabr/backrooms/api/LevelsApi.java b/src/main/java/com/kpabr/backrooms/api/LevelsApi.java index 5aaf905..62a7e4d 100644 --- a/src/main/java/com/kpabr/backrooms/api/LevelsApi.java +++ b/src/main/java/com/kpabr/backrooms/api/LevelsApi.java @@ -3,13 +3,14 @@ import com.kpabr.backrooms.init.BackroomsLevels; import com.mojang.serialization.Codec; -import net.minecraft.util.registry.RegistryKey; +import net.minecraft.registry.RegistryKey; import net.minecraft.world.World; import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.gen.chunk.ChunkGenerator; public class LevelsApi { - public static RegistryKey addLevel(String namespace, String levelName, String biomeSourceName, Codec chunkGenerator, Codec biomeSource) { + public static RegistryKey addLevel(String namespace, String levelName, String biomeSourceName, + Codec chunkGenerator, Codec biomeSource) { return BackroomsLevels.addLevel(namespace, levelName, biomeSourceName, chunkGenerator, biomeSource); } } diff --git a/src/main/java/com/kpabr/backrooms/api/WretchedCycleApi.java b/src/main/java/com/kpabr/backrooms/api/WretchedCycleApi.java index 7561fa7..c2d454a 100644 --- a/src/main/java/com/kpabr/backrooms/api/WretchedCycleApi.java +++ b/src/main/java/com/kpabr/backrooms/api/WretchedCycleApi.java @@ -1,4 +1,5 @@ package com.kpabr.backrooms.api; public class WretchedCycleApi { + // TODO } diff --git a/src/main/java/com/kpabr/backrooms/block/AbstractPipeBlock.java b/src/main/java/com/kpabr/backrooms/block/AbstractPipeBlock.java index 4faac88..9569b70 100644 --- a/src/main/java/com/kpabr/backrooms/block/AbstractPipeBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/AbstractPipeBlock.java @@ -16,11 +16,10 @@ import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.minecraft.world.WorldAccess; -import com.kpabr.backrooms.block.PipeBlock; import java.util.Map; -public class AbstractPipeBlock extends Block implements Waterloggable{ +public class AbstractPipeBlock extends Block implements Waterloggable { public static final BooleanProperty NORTH = ConnectingBlock.NORTH; public static final BooleanProperty EAST = ConnectingBlock.EAST; public static final BooleanProperty SOUTH = ConnectingBlock.SOUTH; @@ -32,7 +31,8 @@ public class AbstractPipeBlock extends Block implements Waterloggable{ public AbstractPipeBlock(Settings settings) { super(settings); - this.setDefaultState(this.stateManager.getDefaultState().with(NORTH, true).with(EAST, true).with(SOUTH, true).with(WEST, true).with(UP, true).with(DOWN, true).with(WATERLOGGED, false)); + this.setDefaultState(this.stateManager.getDefaultState().with(NORTH, true).with(EAST, true).with(SOUTH, true) + .with(WEST, true).with(UP, true).with(DOWN, true).with(WATERLOGGED, false)); } public BlockState getPlacementState(ItemPlacementContext ctx) { @@ -49,15 +49,16 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @SuppressWarnings("deprecation") - public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, + WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world. createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } - if(shouldConnect(neighborState)) return state.with(FACING_PROPERTIES.get(direction), true); + if (shouldConnect(neighborState)) + return state.with(FACING_PROPERTIES.get(direction), true); return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); } - @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state .with(FACING_PROPERTIES.get(rotation.rotate(Direction.NORTH)), state.get(NORTH)) @@ -68,7 +69,6 @@ public BlockState rotate(BlockState state, BlockRotation rotation) { .with(FACING_PROPERTIES.get(rotation.rotate(Direction.UP)), state.get(UP)); } - @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return state .with(FACING_PROPERTIES.get(mirror.apply(Direction.NORTH)), state.get(NORTH)) @@ -79,32 +79,41 @@ public BlockState mirror(BlockState state, BlockMirror mirror) { .with(FACING_PROPERTIES.get(mirror.apply(Direction.UP)), state.get(UP)); } - protected boolean shouldConnect(BlockState blockState){ + protected boolean shouldConnect(BlockState blockState) { return false; } + protected void appendProperties(Builder builder) { builder.add(UP, DOWN, NORTH, EAST, SOUTH, WEST, WATERLOGGED); } + + @SuppressWarnings("deprecation") @Override public FluidState getFluidState(BlockState state) { return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); } - @SuppressWarnings("deprecation") + @Override public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { VoxelShape finalShape = VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f); if (state.get(NORTH)) - finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.0f, 0.75f, 0.75f, 0.75f), BooleanBiFunction.OR); + finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.0f, 0.75f, 0.75f, 0.75f), + BooleanBiFunction.OR); if (state.get(SOUTH)) - finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 1.0f), BooleanBiFunction.OR); + finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 1.0f), + BooleanBiFunction.OR); if (state.get(EAST)) - finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 1.0f, 0.75f, 0.75f), BooleanBiFunction.OR); + finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 1.0f, 0.75f, 0.75f), + BooleanBiFunction.OR); if (state.get(WEST)) - finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.0f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f), BooleanBiFunction.OR); + finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.0f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f), + BooleanBiFunction.OR); if (state.get(DOWN)) - finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.0f, 0.25f, 0.75f, 0.75f, 0.75f), BooleanBiFunction.OR); + finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.0f, 0.25f, 0.75f, 0.75f, 0.75f), + BooleanBiFunction.OR); if (state.get(UP)) - finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 0.75f, 1.0f, 0.75f), BooleanBiFunction.OR); + finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 0.75f, 1.0f, 0.75f), + BooleanBiFunction.OR); return finalShape; } diff --git a/src/main/java/com/kpabr/backrooms/block/BackroomsDoorBlock.java b/src/main/java/com/kpabr/backrooms/block/BackroomsDoorBlock.java index 7df650e..7bfe628 100644 --- a/src/main/java/com/kpabr/backrooms/block/BackroomsDoorBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/BackroomsDoorBlock.java @@ -1,10 +1,11 @@ package com.kpabr.backrooms.block; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; +import net.minecraft.block.BlockSetType; import net.minecraft.block.DoorBlock; public class BackroomsDoorBlock extends DoorBlock { - public BackroomsDoorBlock(FabricBlockSettings fabricBlockSettings) { - super(fabricBlockSettings); + public BackroomsDoorBlock(FabricBlockSettings fabricBlockSettings, BlockSetType type) { + super(fabricBlockSettings, type); } } diff --git a/src/main/java/com/kpabr/backrooms/block/ComputerBlock.java b/src/main/java/com/kpabr/backrooms/block/ComputerBlock.java index 656a94d..a1b4961 100644 --- a/src/main/java/com/kpabr/backrooms/block/ComputerBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/ComputerBlock.java @@ -38,7 +38,7 @@ protected void appendProperties(StateManager.Builder stateMan @Override public BlockState getPlacementState(ItemPlacementContext ctx) { - return this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getPlayerFacing().getOpposite()); + return this.getDefaultState().with(Properties.HORIZONTAL_FACING, ctx.getHorizontalPlayerFacing().getOpposite()); } @Nullable @@ -49,8 +49,9 @@ public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { @Nullable @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { - if(type == BackroomsBlocks.COMPUTER_BLOCK_ENTITY) { + public BlockEntityTicker getTicker(World world, BlockState state, + BlockEntityType type) { + if (type == BackroomsBlocks.COMPUTER_BLOCK_ENTITY) { return (theWorld, blockPos, blockState, entity) -> ComputerBlockEntity.tick(theWorld, blockPos, blockState); } return null; diff --git a/src/main/java/com/kpabr/backrooms/block/CrackedCopperPipeBlock.java b/src/main/java/com/kpabr/backrooms/block/CrackedCopperPipeBlock.java index 36b1bd3..2701b24 100644 --- a/src/main/java/com/kpabr/backrooms/block/CrackedCopperPipeBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/CrackedCopperPipeBlock.java @@ -19,7 +19,7 @@ import java.util.Map; -public class CrackedCopperPipeBlock extends Block implements Waterloggable{ +public class CrackedCopperPipeBlock extends Block implements Waterloggable { public static final BooleanProperty NORTH = ConnectingBlock.NORTH; public static final BooleanProperty EAST = ConnectingBlock.EAST; public static final BooleanProperty SOUTH = ConnectingBlock.SOUTH; @@ -31,7 +31,8 @@ public class CrackedCopperPipeBlock extends Block implements Waterloggable{ public CrackedCopperPipeBlock(Settings settings) { super(settings); - this.setDefaultState(this.stateManager.getDefaultState().with(NORTH, true).with(EAST, true).with(SOUTH, true).with(WEST, true).with(UP, true).with(DOWN, true).with(WATERLOGGED, false)); + this.setDefaultState(this.stateManager.getDefaultState().with(NORTH, true).with(EAST, true).with(SOUTH, true) + .with(WEST, true).with(UP, true).with(DOWN, true).with(WATERLOGGED, false)); } public BlockState getPlacementState(ItemPlacementContext ctx) { @@ -48,15 +49,16 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { } @SuppressWarnings("deprecation") - public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, + WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world. createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } - if(neighborState.isOf(this)) return state.with(FACING_PROPERTIES.get(direction), true); + if (neighborState.isOf(this)) + return state.with(FACING_PROPERTIES.get(direction), true); return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); } - @SuppressWarnings("deprecation") public BlockState rotate(BlockState state, BlockRotation rotation) { return state .with(FACING_PROPERTIES.get(rotation.rotate(Direction.NORTH)), state.get(NORTH)) @@ -67,7 +69,6 @@ public BlockState rotate(BlockState state, BlockRotation rotation) { .with(FACING_PROPERTIES.get(rotation.rotate(Direction.UP)), state.get(UP)); } - @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { return state .with(FACING_PROPERTIES.get(mirror.apply(Direction.NORTH)), state.get(NORTH)) @@ -81,26 +82,34 @@ public BlockState mirror(BlockState state, BlockMirror mirror) { protected void appendProperties(Builder builder) { builder.add(UP, DOWN, NORTH, EAST, SOUTH, WEST, WATERLOGGED); } + + @SuppressWarnings("deprecation") @Override public FluidState getFluidState(BlockState state) { return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); } - @SuppressWarnings("deprecation") + @Override public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { VoxelShape finalShape = VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f); if (state.get(NORTH)) - finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.0f, 0.75f, 0.75f, 0.75f), BooleanBiFunction.OR); + finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.0f, 0.75f, 0.75f, 0.75f), + BooleanBiFunction.OR); if (state.get(SOUTH)) - finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 1.0f), BooleanBiFunction.OR); + finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 0.75f, 0.75f, 1.0f), + BooleanBiFunction.OR); if (state.get(EAST)) - finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 1.0f, 0.75f, 0.75f), BooleanBiFunction.OR); + finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 1.0f, 0.75f, 0.75f), + BooleanBiFunction.OR); if (state.get(WEST)) - finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.0f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f), BooleanBiFunction.OR); + finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.0f, 0.25f, 0.25f, 0.75f, 0.75f, 0.75f), + BooleanBiFunction.OR); if (state.get(DOWN)) - finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.0f, 0.25f, 0.75f, 0.75f, 0.75f), BooleanBiFunction.OR); + finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.0f, 0.25f, 0.75f, 0.75f, 0.75f), + BooleanBiFunction.OR); if (state.get(UP)) - finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 0.75f, 1.0f, 0.75f), BooleanBiFunction.OR); + finalShape = VoxelShapes.combine(finalShape, VoxelShapes.cuboid(0.25f, 0.25f, 0.25f, 0.75f, 1.0f, 0.75f), + BooleanBiFunction.OR); return finalShape; } diff --git a/src/main/java/com/kpabr/backrooms/block/CrackedPipeBlock.java b/src/main/java/com/kpabr/backrooms/block/CrackedPipeBlock.java index 80dc9f5..651280b 100644 --- a/src/main/java/com/kpabr/backrooms/block/CrackedPipeBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/CrackedPipeBlock.java @@ -1,37 +1,21 @@ package com.kpabr.backrooms.block; import net.minecraft.block.*; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager.Builder; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.function.BooleanBiFunction; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldAccess; -import com.kpabr.backrooms.block.AbstractPipeBlock; -import com.kpabr.backrooms.block.PipeBlock; -import java.util.Map; - -public class CrackedPipeBlock extends AbstractPipeBlock{ +public class CrackedPipeBlock extends AbstractPipeBlock { public CrackedPipeBlock(Settings settings) { super(settings); - this.setDefaultState(this.stateManager.getDefaultState().with(NORTH, true).with(EAST, true).with(SOUTH, true).with(WEST, true).with(UP, true).with(DOWN, true).with(WATERLOGGED, false)); + this.setDefaultState(this.stateManager.getDefaultState().with(NORTH, true).with(EAST, true).with(SOUTH, true) + .with(WEST, true).with(UP, true).with(DOWN, true).with(WATERLOGGED, false)); } @Override - protected boolean shouldConnect(BlockState blockState){ - if(blockState.isOf(this)) { return true; } - if(PipeBlock.class.isInstance(blockState.getBlock())){ - return ((PipeBlock)blockState.getBlock()).crackedPipe==this; + protected boolean shouldConnect(BlockState blockState) { + if (blockState.isOf(this)) { + return true; + } + if (PipeBlock.class.isInstance(blockState.getBlock())) { + return ((PipeBlock) blockState.getBlock()).crackedPipe == this; } return false; } diff --git a/src/main/java/com/kpabr/backrooms/block/CrateBlock.java b/src/main/java/com/kpabr/backrooms/block/CrateBlock.java index 6728e92..832de14 100644 --- a/src/main/java/com/kpabr/backrooms/block/CrateBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/CrateBlock.java @@ -1,6 +1,6 @@ package com.kpabr.backrooms.block; -import java.util.Random; +import net.minecraft.util.math.random.Random; import net.minecraft.block.*; import com.kpabr.backrooms.block.entity.CrateBlockEntity; import net.minecraft.block.entity.BlockEntity; @@ -39,13 +39,14 @@ public CrateBlock(Settings settings) { } @Override - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, + BlockHitResult hit) { if (world.isClient) { return ActionResult.SUCCESS; } else { BlockEntity blockEntity = world.getBlockEntity(pos); if (blockEntity instanceof CrateBlockEntity) { - player.openHandledScreen((CrateBlockEntity)blockEntity); + player.openHandledScreen((CrateBlockEntity) blockEntity); player.incrementStat(Stats.OPEN_BARREL); PiglinBrain.onGuardedBlockInteracted(player, true); } @@ -54,12 +55,13 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt } } + @SuppressWarnings("deprecation") @Override public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { if (!state.isOf(newState.getBlock())) { BlockEntity blockEntity = world.getBlockEntity(pos); if (blockEntity instanceof Inventory) { - ItemScatterer.spawn(world, pos, (Inventory)blockEntity); + ItemScatterer.spawn(world, pos, (Inventory) blockEntity); world.updateComparators(pos, this); } super.onStateReplaced(state, world, pos, newState, moved); @@ -82,32 +84,36 @@ public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { @Override public BlockState getPlacementState(ItemPlacementContext ctx) { - - FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); - return (BlockState)this.getDefaultState() - .with(OPEN, false) - .with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + + FluidState fluidState = ctx.getWorld().getFluidState(ctx.getBlockPos()); + return (BlockState) this.getDefaultState() + .with(OPEN, false) + .with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); } - @Override + @SuppressWarnings("deprecation") + @Override public FluidState getFluidState(BlockState state) { return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); } - + + @SuppressWarnings("deprecation") @Override - public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, + WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } - + return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); } - + public BlockRenderType getRenderType(BlockState state) { return BlockRenderType.MODEL; } - public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { + public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, + ItemStack itemStack) { if (itemStack.hasCustomName()) { BlockEntity blockEntity = world.getBlockEntity(pos); if (blockEntity instanceof CrateBlockEntity crateBlockEntity) { diff --git a/src/main/java/com/kpabr/backrooms/block/FiresaltCrystalBlock.java b/src/main/java/com/kpabr/backrooms/block/FiresaltCrystalBlock.java index 1d2c7ce..bf6012b 100644 --- a/src/main/java/com/kpabr/backrooms/block/FiresaltCrystalBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/FiresaltCrystalBlock.java @@ -2,23 +2,6 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; -import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import com.kpabr.backrooms.block.entity.ComputerBlockEntity; -import com.kpabr.backrooms.init.BackroomsBlocks; -import net.minecraft.world.WorldView; -import org.jetbrains.annotations.Nullable; public class FiresaltCrystalBlock extends AmethystClusterBlock { public FiresaltCrystalBlock(FabricBlockSettings fabricBlockSettings) { diff --git a/src/main/java/com/kpabr/backrooms/block/FluorescentLightBlock.java b/src/main/java/com/kpabr/backrooms/block/FluorescentLightBlock.java index bf137a9..5d69c74 100644 --- a/src/main/java/com/kpabr/backrooms/block/FluorescentLightBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/FluorescentLightBlock.java @@ -1,6 +1,6 @@ package com.kpabr.backrooms.block; -import java.util.Random; +import net.minecraft.util.math.random.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -23,7 +23,8 @@ public FluorescentLightBlock(Settings settings) { super(settings); } - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, + BlockHitResult hit) { state = state.cycle(LIT); world.setBlockState(pos, state, 1, 0); diff --git a/src/main/java/com/kpabr/backrooms/block/MachineryBlock.java b/src/main/java/com/kpabr/backrooms/block/MachineryBlock.java index c1f14c3..c2cde9f 100644 --- a/src/main/java/com/kpabr/backrooms/block/MachineryBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/MachineryBlock.java @@ -3,18 +3,17 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import com.kpabr.backrooms.init.BackroomsBlocks; -import net.minecraft.item.ItemPlacementContext; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.state.StateManager; -import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.Properties; import net.minecraft.state.property.BooleanProperty; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; import net.minecraft.world.World; +import net.minecraft.world.WorldAccess; +import net.minecraft.world.explosion.Explosion; public class MachineryBlock extends Block { public static final BooleanProperty POWERED = Properties.POWERED; @@ -23,18 +22,33 @@ public MachineryBlock(Settings settings) { super(settings); setDefaultState(this.stateManager.getDefaultState().with(POWERED, false)); } - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + + @Override + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, + BlockHitResult hit) { state = state.cycle(POWERED); world.setBlockState(pos, state, 1, 0); - if(state.get(POWERED)){ + if (state.get(POWERED)) { + for (int i = -14; i <= 14; i++) { + for (int j = 0; j <= 4; j++) { + for (int k = -14; k <= 14; k++) { + BlockPos lightPos = pos.add(i, j, k); + if (world.getBlockState(lightPos).getBlock() == BackroomsBlocks.REPAIRED_FLUORESCENT_LIGHT) { + world.setBlockState(lightPos, world.getBlockState(lightPos) + .with(BooleanProperty.of("powered_by_machinery"), true)); + } + } + } + } + } else { for (int i = -14; i <= 14; i++) { for (int j = 0; j <= 4; j++) { for (int k = -14; k <= 14; k++) { - BlockPos lightPos = pos.add(i,j,k); - //BackroomsMod.LOGGER.info(lightPos.toString()); - if(world.getBlockState(lightPos).getBlock()==BackroomsBlocks.REPAIRED_FLUORESCENT_LIGHT){ - world.setBlockState(lightPos, BackroomsBlocks.REPAIRED_FLUORESCENT_LIGHT.getDefaultState().with(Properties.LIT, true), 1, 0); + BlockPos lightPos = pos.add(i, j, k); + if (world.getBlockState(lightPos).getBlock() == BackroomsBlocks.REPAIRED_FLUORESCENT_LIGHT) { + world.setBlockState(lightPos, world.getBlockState(lightPos) + .with(BooleanProperty.of("powered_by_machinery"), false)); } } } @@ -43,7 +57,42 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt return ActionResult.success(world.isClient); } + @Override protected void appendProperties(StateManager.Builder stateManager) { stateManager.add(POWERED); } + + @Override + public void onBroken(WorldAccess world, BlockPos pos, BlockState state) { + super.onBroken(world, pos, state); + for (int i = -14; i <= 14; i++) { + for (int j = 0; j <= 4; j++) { + for (int k = -14; k <= 14; k++) { + BlockPos lightPos = pos.add(i, j, k); + if (world.getBlockState(lightPos).getBlock() == BackroomsBlocks.REPAIRED_FLUORESCENT_LIGHT) { + world.setBlockState(lightPos, + world.getBlockState(lightPos).with(BooleanProperty.of("powered_by_machinery"), false), + 0); + } + } + } + } + } + + @Override + public void onDestroyedByExplosion(World world, BlockPos pos, Explosion explosion) { + super.onDestroyedByExplosion(world, pos, explosion); + for (int i = -14; i <= 14; i++) { + for (int j = 0; j <= 4; j++) { + for (int k = -14; k <= 14; k++) { + BlockPos lightPos = pos.add(i, j, k); + if (world.getBlockState(lightPos).getBlock() == BackroomsBlocks.REPAIRED_FLUORESCENT_LIGHT) { + world.setBlockState(lightPos, + world.getBlockState(lightPos).with(BooleanProperty.of("powered_by_machinery"), false), + 0); + } + } + } + } + } } diff --git a/src/main/java/com/kpabr/backrooms/block/MaskBlock.java b/src/main/java/com/kpabr/backrooms/block/MaskBlock.java index a13b4e6..e34ad66 100644 --- a/src/main/java/com/kpabr/backrooms/block/MaskBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/MaskBlock.java @@ -11,11 +11,12 @@ import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityTicker; import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.ai.pathing.NavigationType; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Equipment; import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.ItemStack; -import net.minecraft.item.Wearable; import net.minecraft.stat.Stats; import net.minecraft.state.StateManager; import net.minecraft.state.property.DirectionProperty; @@ -29,40 +30,31 @@ import net.minecraft.world.World; import net.minecraft.world.WorldView; -import javax.annotation.Nullable; - -public class MaskBlock extends BlockWithEntity implements Wearable { +public class MaskBlock extends BlockWithEntity implements Equipment { public static final DirectionProperty FACING = HorizontalFacingBlock.FACING; private static final Map HARLEQUIN_OUTLINE_SHAPE = Maps.newEnumMap(ImmutableMap.of( Direction.NORTH, Block.createCuboidShape(4.0, 3.0, 14.0, 12.0, 13.0, 16.0), Direction.SOUTH, Block.createCuboidShape(4.0, 3.0, 0.0, 12.0, 13.0, 2.0), Direction.EAST, Block.createCuboidShape(0.0, 3.0, 4.0, 2.0, 13.0, 12.0), - Direction.WEST, Block.createCuboidShape(14.0, 3.0, 4.0, 16.0, 13.0, 12.0) - )); + Direction.WEST, Block.createCuboidShape(14.0, 3.0, 4.0, 16.0, 13.0, 12.0))); private static final Map COLOMBINA_OUTLINE_SHAPE = Maps.newEnumMap(ImmutableMap.of( Direction.NORTH, Block.createCuboidShape(3.0, 5.0, 15.0, 13.0, 10.0, 16.0), Direction.SOUTH, Block.createCuboidShape(3.0, 5.0, 0.0, 13.0, 10.0, 1.0), Direction.EAST, Block.createCuboidShape(0.0, 5.0, 10.0, 1.0, 10.0, 13.0), - Direction.WEST, Block.createCuboidShape(15.0, 5.0, 3.0, 16.0, 10.0, 13.0) - )); + Direction.WEST, Block.createCuboidShape(15.0, 5.0, 3.0, 16.0, 10.0, 13.0))); private static final Map SOCK_BUSKIN_OUTLINE_SHAPE = Maps.newEnumMap(ImmutableMap.of( Direction.NORTH, VoxelShapes.union( Block.createCuboidShape(3.0, 0.0, 13.0, 13.0, 7.0, 16.0), - Block.createCuboidShape(2.0, 7.0, 13.0, 14.0, 16.0, 16.0) - ), + Block.createCuboidShape(2.0, 7.0, 13.0, 14.0, 16.0, 16.0)), Direction.SOUTH, VoxelShapes.union( Block.createCuboidShape(3.0, 0.0, 0.0, 13.0, 7.0, 3.0), - Block.createCuboidShape(2.0, 7.0, 0.0, 12.0, 16.0, 3.0) - ), + Block.createCuboidShape(2.0, 7.0, 0.0, 12.0, 16.0, 3.0)), Direction.EAST, VoxelShapes.union( Block.createCuboidShape(0.0, 0.0, 3.0, 3.0, 7.0, 13.0), - Block.createCuboidShape(0.0, 7.0, 2.0, 3.0, 16.0, 14.0) - ), + Block.createCuboidShape(0.0, 7.0, 2.0, 3.0, 16.0, 14.0)), Direction.WEST, VoxelShapes.union( Block.createCuboidShape(13.0, 0.0, 3.0, 16.0, 7.0, 13.0), - Block.createCuboidShape(13.0, 7.0, 2.0, 16.0, 16.0, 14.0) - ) - )); + Block.createCuboidShape(13.0, 7.0, 2.0, 16.0, 16.0, 14.0)))); private final MaskType maskType; public MaskBlock(MaskType maskType, Block.Settings settings) { @@ -72,7 +64,8 @@ public MaskBlock(MaskType maskType, Block.Settings settings) { } @Override - public void afterBreak(World world, PlayerEntity player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack stack) { + public void afterBreak(World world, PlayerEntity player, BlockPos pos, BlockState state, BlockEntity blockEntity, + ItemStack stack) { player.incrementStat(Stats.MINED.getOrCreateStat(this)); player.addExhaustion(0.005F); dropStack(world, pos, switch (maskType) { @@ -84,7 +77,7 @@ public void afterBreak(World world, PlayerEntity player, BlockPos pos, BlockStat @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { - return switch(maskType) { + return switch (maskType) { case COLOMBINA -> COLOMBINA_OUTLINE_SHAPE.get(state.get(FACING)); case HARLEQUIN -> HARLEQUIN_OUTLINE_SHAPE.get(state.get(FACING)); case SOCK_BUSKIN -> SOCK_BUSKIN_OUTLINE_SHAPE.get(state.get(FACING)); @@ -92,7 +85,6 @@ public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos po } @Override - @Nullable public BlockState getPlacementState(ItemPlacementContext ctx) { final Direction[] directions = ctx.getPlacementDirections(); final World world = ctx.getWorld(); @@ -131,10 +123,11 @@ public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { return new MaskBlockEntity(pos, state); } - @Nullable - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + public BlockEntityTicker getTicker(World world, BlockState state, + BlockEntityType type) { return !world.isClient ? null : checkType(type, BackroomsBlocks.MASK, MaskBlockEntity::tick); } + public BlockRenderType getRenderType(BlockState state) { return BlockRenderType.MODEL; } @@ -163,4 +156,9 @@ public enum MaskType { this.maskKey = maskKey; } } + + @Override + public EquipmentSlot getSlotType() { + return EquipmentSlot.HEAD; + } } diff --git a/src/main/java/com/kpabr/backrooms/block/MoldyTileBlock.java b/src/main/java/com/kpabr/backrooms/block/MoldyTileBlock.java index 739e4e4..304e0b4 100644 --- a/src/main/java/com/kpabr/backrooms/block/MoldyTileBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/MoldyTileBlock.java @@ -1,6 +1,6 @@ package com.kpabr.backrooms.block; -import java.util.Random; +import net.minecraft.util.math.random.Random; import com.kpabr.backrooms.init.BackroomsBlocks; import net.minecraft.block.Block; diff --git a/src/main/java/com/kpabr/backrooms/block/PipeBlock.java b/src/main/java/com/kpabr/backrooms/block/PipeBlock.java index 989977c..aab1b25 100644 --- a/src/main/java/com/kpabr/backrooms/block/PipeBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/PipeBlock.java @@ -1,69 +1,47 @@ package com.kpabr.backrooms.block; -import java.util.Random; import java.util.function.Consumer; import net.minecraft.block.Block; -import net.minecraft.block.Blocks; -import net.minecraft.block.Waterloggable; import net.minecraft.block.BlockState; -import net.minecraft.block.ConnectingBlock; -import net.minecraft.block.ShapeContext; -import net.minecraft.fluid.FluidState; -import net.minecraft.fluid.Fluids; -import net.minecraft.item.ItemPlacementContext; import net.minecraft.item.PickaxeItem; import net.minecraft.item.ItemStack; -import net.minecraft.state.StateManager.Builder; -import net.minecraft.state.property.BooleanProperty; -import net.minecraft.state.property.DirectionProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.BlockMirror; -import net.minecraft.util.BlockRotation; -import net.minecraft.util.function.BooleanBiFunction; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.EquipmentSlot; -import net.minecraft.sound.SoundEvents; -import net.minecraft.world.BlockView; -import net.minecraft.world.WorldAccess; import net.minecraft.world.World; -import com.kpabr.backrooms.block.AbstractPipeBlock; -import java.util.Map; - -public class PipeBlock extends AbstractPipeBlock{ +public class PipeBlock extends AbstractPipeBlock { public final Block crackedPipe; + public PipeBlock(Settings settings, Block crackedPipe) { super(settings); this.crackedPipe = crackedPipe; - this.setDefaultState(this.stateManager.getDefaultState().with(NORTH, true).with(EAST, true).with(SOUTH, true).with(WEST, true).with(UP, true).with(DOWN, true).with(WATERLOGGED, false)); + this.setDefaultState(this.stateManager.getDefaultState().with(NORTH, true).with(EAST, true).with(SOUTH, true) + .with(WEST, true).with(UP, true).with(DOWN, true).with(WATERLOGGED, false)); } - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - Random rand = world.random; + + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, + BlockHitResult hit) { ItemStack itemStack = player.getStackInHand(hand); if (itemStack.getItem() instanceof PickaxeItem) { if (!world.isClient) { - itemStack.damage(1, player, (Consumer) ((e) -> - e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND) - )); + itemStack.damage(1, player, + (Consumer) ((e) -> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND))); } world.setBlockState(pos, this.crackedPipe.getStateWithProperties(state), Block.FORCE_STATE, 0); - //player.playSound(BackroomsSounds.ITEM_AXE_STRIP, 0.5f, rand.nextFloat()); return ActionResult.SUCCESS; } return ActionResult.FAIL; } + @Override - protected boolean shouldConnect(BlockState blockState){ - return blockState.isOf(this)||blockState.isOf(this.crackedPipe); + protected boolean shouldConnect(BlockState blockState) { + return blockState.isOf(this) || blockState.isOf(this.crackedPipe); } } \ No newline at end of file diff --git a/src/main/java/com/kpabr/backrooms/block/PlateDoor.java b/src/main/java/com/kpabr/backrooms/block/PlateDoor.java index a98b49d..c3821d2 100644 --- a/src/main/java/com/kpabr/backrooms/block/PlateDoor.java +++ b/src/main/java/com/kpabr/backrooms/block/PlateDoor.java @@ -1,10 +1,11 @@ package com.kpabr.backrooms.block; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; +import net.minecraft.block.BlockSetType; import net.minecraft.block.DoorBlock; public class PlateDoor extends DoorBlock { public PlateDoor(FabricBlockSettings settings) { - super(settings); + super(settings, BlockSetType.IRON); } } diff --git a/src/main/java/com/kpabr/backrooms/block/PortalBlock.java b/src/main/java/com/kpabr/backrooms/block/PortalBlock.java index 036e1b1..d4f53d5 100644 --- a/src/main/java/com/kpabr/backrooms/block/PortalBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/PortalBlock.java @@ -17,11 +17,10 @@ import net.minecraft.util.Identifier; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.world.World; - public class PortalBlock extends Block { public static final IntProperty LEVEL = IntProperty.of("backrooms_level", 0, BackroomsLevels.LEVELS_AMOUNT); @@ -30,20 +29,20 @@ public PortalBlock() { this.setDefaultState(this.stateManager.getDefaultState().with(LEVEL, 0)); } + @SuppressWarnings("deprecation") @Override public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) { super.onEntityCollision(state, world, pos, entity); - if(world.isClient) { + if (world.isClient) { return; } - if(entity.isPlayer()) { + if (entity.isPlayer()) { World portalBlockWorld = entity.getServer().getWorld( RegistryKey.of( - Registry.WORLD_KEY, - new Identifier("backrooms:level_"+state.get(LEVEL)))); - + RegistryKeys.WORLD, + new Identifier("backrooms:level_" + state.get(LEVEL)))); EntityHelper.teleportToLevel((ServerPlayerEntity) entity, portalBlockWorld); } @@ -54,19 +53,19 @@ protected void appendProperties(StateManager.Builder stateMan stateManager.add(LEVEL); } - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - if(player.hasPermissionLevel(4) && (player.isCreative() || player.isSpectator())) { + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, + BlockHitResult hit) { + if (player.hasPermissionLevel(4) && (player.isCreative() || player.isSpectator())) { int level = world.getBlockState(pos).get(LEVEL); - if(level == BackroomsLevels.LEVELS_AMOUNT-1) { + if (level == BackroomsLevels.LEVELS_AMOUNT - 1) { level = 0; } else { level += 1; } - world.setBlockState(pos, state.with(LEVEL, level)); - player.sendMessage(Text.of("Stored level has been set to "+level), true); + player.sendMessage(Text.of("Stored level has been set to " + level), true); return ActionResult.SUCCESS; } diff --git a/src/main/java/com/kpabr/backrooms/block/PyroilLineBlock.java b/src/main/java/com/kpabr/backrooms/block/PyroilLineBlock.java index 17f43be..1325b87 100644 --- a/src/main/java/com/kpabr/backrooms/block/PyroilLineBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/PyroilLineBlock.java @@ -29,29 +29,37 @@ import java.util.Map; import java.util.Random; - -public class PyroilLineBlock extends BlockWithEntity implements BlockEntityProvider { +public class PyroilLineBlock extends BlockWithEntity { private static final EnumProperty WIRE_CONNECTION_NORTH = Properties.NORTH_WIRE_CONNECTION; private static final EnumProperty WIRE_CONNECTION_EAST = Properties.EAST_WIRE_CONNECTION; private static final EnumProperty WIRE_CONNECTION_SOUTH = Properties.SOUTH_WIRE_CONNECTION; private static final EnumProperty WIRE_CONNECTION_WEST = Properties.WEST_WIRE_CONNECTION; - private static final Map> DIRECTION_TO_WIRE_CONNECTION_PROPERTY = Maps.newEnumMap(ImmutableMap.of(Direction.NORTH, WIRE_CONNECTION_NORTH, Direction.EAST, WIRE_CONNECTION_EAST, Direction.SOUTH, WIRE_CONNECTION_SOUTH, Direction.WEST, WIRE_CONNECTION_WEST)); + private static final Map> DIRECTION_TO_WIRE_CONNECTION_PROPERTY = Maps + .newEnumMap(ImmutableMap.of(Direction.NORTH, WIRE_CONNECTION_NORTH, Direction.EAST, WIRE_CONNECTION_EAST, + Direction.SOUTH, WIRE_CONNECTION_SOUTH, Direction.WEST, WIRE_CONNECTION_WEST)); private static final Map SHAPES = Maps.newHashMap(); - //Idk what does that means, TODO: + // Idk what does that means, TODO: private static final Map field_24414 = Maps.newEnumMap(ImmutableMap.of( Direction.NORTH, Block.createCuboidShape(3.0, 0.0, 0.0, 13.0, 1.0, 13.0), Direction.SOUTH, Block.createCuboidShape(3.0, 0.0, 3.0, 13.0, 1.0, 16.0), Direction.EAST, Block.createCuboidShape(3.0, 0.0, 3.0, 16.0, 1.0, 13.0), Direction.WEST, Block.createCuboidShape(0.0, 0.0, 3.0, 13.0, 1.0, 13.0))); private static final Map field_24415 = Maps.newEnumMap(ImmutableMap.of( - Direction.NORTH, VoxelShapes.union(field_24414.get(Direction.NORTH), Block.createCuboidShape(3.0, 0.0, 0.0, 13.0, 16.0, 1.0)), - Direction.SOUTH, VoxelShapes.union(field_24414.get(Direction.SOUTH), Block.createCuboidShape(3.0, 0.0, 15.0, 13.0, 16.0, 16.0)), - Direction.EAST, VoxelShapes.union(field_24414.get(Direction.EAST), Block.createCuboidShape(15.0, 0.0, 3.0, 16.0, 16.0, 13.0)), - Direction.WEST, VoxelShapes.union(field_24414.get(Direction.WEST), Block.createCuboidShape(0.0, 0.0, 3.0, 1.0, 16.0, 13.0)))); + Direction.NORTH, + VoxelShapes.union(field_24414.get(Direction.NORTH), + Block.createCuboidShape(3.0, 0.0, 0.0, 13.0, 16.0, 1.0)), + Direction.SOUTH, + VoxelShapes.union(field_24414.get(Direction.SOUTH), + Block.createCuboidShape(3.0, 0.0, 15.0, 13.0, 16.0, 16.0)), + Direction.EAST, + VoxelShapes.union(field_24414.get(Direction.EAST), + Block.createCuboidShape(15.0, 0.0, 3.0, 16.0, 16.0, 13.0)), + Direction.WEST, VoxelShapes.union(field_24414.get(Direction.WEST), + Block.createCuboidShape(0.0, 0.0, 3.0, 1.0, 16.0, 13.0)))); private static final Vec3d[] COLORS = Util.make(new Vec3d[16], (vec3ds) -> { - for(int i = 0; i < 16; ++i) { + for (int i = 0; i < 16; ++i) { float r = (float) i / 15.0F; float g = r * 0.6F + (r > 0.0F ? 0.4F : 0.3F); float h = MathHelper.clamp(r * r * 0.7F - 0.5F, 0.0F, 1.0F); @@ -104,17 +112,18 @@ public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState this.updateOffsetNeighbors(world, pos); } } + @Override public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return SHAPES.get(state); } private void updateOffsetNeighbors(World world, BlockPos pos) { - for(Direction direction : Direction.Type.HORIZONTAL) { + for (Direction direction : Direction.Type.HORIZONTAL) { this.updateNeighbors(world, pos.offset(direction)); } - for(Direction direction : Direction.Type.HORIZONTAL) { + for (Direction direction : Direction.Type.HORIZONTAL) { final BlockPos blockPos = pos.offset(direction); if (world.getBlockState(blockPos).isSolidBlock(world, blockPos)) { this.updateNeighbors(world, blockPos.up()); @@ -125,7 +134,6 @@ private void updateOffsetNeighbors(World world, BlockPos pos) { } - private void updateNeighbors(World world, BlockPos pos) { if (world.getBlockState(pos).isOf(this)) { world.updateNeighborsAlways(pos, this); @@ -136,6 +144,7 @@ private void updateNeighbors(World world, BlockPos pos) { } } + @SuppressWarnings("deprecation") @Override public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { if (!moved && !state.isOf(newState.getBlock())) { @@ -154,18 +163,20 @@ public void prepare(BlockState state, WorldAccess world, BlockPos pos, int flags BlockPos.Mutable mutable = new BlockPos.Mutable(); for (Direction direction : Direction.Type.HORIZONTAL) { - WireConnection wireConnection = state.get( DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction)); + WireConnection wireConnection = state.get(DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction)); if (wireConnection != WireConnection.NONE && !world.getBlockState(mutable.set(pos, direction)).isOf(this)) { mutable.move(Direction.DOWN); BlockState blockState = world.getBlockState(mutable); BlockPos blockPos = mutable.offset(direction.getOpposite()); - BlockState blockState2 = blockState.getStateForNeighborUpdate(direction.getOpposite(), world.getBlockState(blockPos), world, mutable, blockPos); + BlockState blockState2 = blockState.getStateForNeighborUpdate(direction.getOpposite(), + world.getBlockState(blockPos), world, mutable, blockPos); replace(blockState, blockState2, world, mutable, flags, maxUpdateDepth); mutable.set(pos, direction).move(Direction.UP); BlockState blockState3 = world.getBlockState(mutable); BlockPos blockPos2 = mutable.offset(direction.getOpposite()); - BlockState blockState4 = blockState3.getStateForNeighborUpdate(direction.getOpposite(), world.getBlockState(blockPos2), world, mutable, blockPos2); + BlockState blockState4 = blockState3.getStateForNeighborUpdate(direction.getOpposite(), + world.getBlockState(blockPos2), world, mutable, blockPos2); replace(blockState3, blockState4, world, mutable, flags, maxUpdateDepth); } } @@ -173,17 +184,21 @@ public void prepare(BlockState state, WorldAccess world, BlockPos pos, int flags } @Override - public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, + WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (direction == Direction.DOWN) { return state; } else if (direction == Direction.UP) { return this.getPlacementState(world, state, pos); } else { final WireConnection wireConnection = this.getRenderConnectionType(world, pos, direction); - return wireConnection.isConnected() == state.get(DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction)).isConnected() + return wireConnection.isConnected() == state.get(DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction)) + .isConnected() && - !isFullyConnected(state) ? state.with(DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction), wireConnection) - : this.getPlacementState(world, this.dotState.with(DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction), wireConnection), pos); + !isFullyConnected(state) + ? state.with(DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction), wireConnection) + : this.getPlacementState(world, this.dotState + .with(DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction), wireConnection), pos); } } @@ -220,7 +235,8 @@ private BlockState getPlacementState(BlockView world, BlockState state, BlockPos } @Override - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, + BlockHitResult hit) { if (player.getAbilities().allowModifyWorld) { if (isFullyConnected(state) || isNotConnected(state)) { BlockState blockState = isFullyConnected(state) ? this.getDefaultState() : this.dotState; @@ -238,19 +254,22 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt private void updateForNewState(World world, BlockPos pos, BlockState oldState, BlockState newState) { for (Direction direction : Direction.Type.HORIZONTAL) { BlockPos blockPos = pos.offset(direction); - if (oldState.get(DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction)).isConnected() != newState.get(DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction)).isConnected() && world.getBlockState(blockPos).isSolidBlock(world, blockPos)) { + if (oldState.get(DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction)).isConnected() != newState + .get(DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction)).isConnected() + && world.getBlockState(blockPos).isSolidBlock(world, blockPos)) { world.updateNeighborsExcept(blockPos, newState.getBlock(), direction.getOpposite()); } } } + @SuppressWarnings("deprecation") @Override public BlockState mirror(BlockState state, BlockMirror mirror) { - if(mirror == BlockMirror.LEFT_RIGHT) + if (mirror == BlockMirror.LEFT_RIGHT) return state .with(WIRE_CONNECTION_NORTH, state.get(WIRE_CONNECTION_SOUTH)) .with(WIRE_CONNECTION_SOUTH, state.get(WIRE_CONNECTION_NORTH)); - else if(mirror == BlockMirror.FRONT_BACK) + else if (mirror == BlockMirror.FRONT_BACK) return state .with(WIRE_CONNECTION_EAST, state.get(WIRE_CONNECTION_WEST)) .with(WIRE_CONNECTION_WEST, state.get(WIRE_CONNECTION_EAST)); @@ -262,49 +281,50 @@ else if(mirror == BlockMirror.FRONT_BACK) public BlockState rotate(BlockState state, BlockRotation rotation) { return switch (rotation) { case CLOCKWISE_180 -> state - .with(WIRE_CONNECTION_NORTH, state.get(WIRE_CONNECTION_SOUTH)) - .with(WIRE_CONNECTION_EAST, state.get(WIRE_CONNECTION_WEST)) - .with(WIRE_CONNECTION_SOUTH, state.get(WIRE_CONNECTION_NORTH)) - .with(WIRE_CONNECTION_WEST, state.get(WIRE_CONNECTION_EAST)); + .with(WIRE_CONNECTION_NORTH, state.get(WIRE_CONNECTION_SOUTH)) + .with(WIRE_CONNECTION_EAST, state.get(WIRE_CONNECTION_WEST)) + .with(WIRE_CONNECTION_SOUTH, state.get(WIRE_CONNECTION_NORTH)) + .with(WIRE_CONNECTION_WEST, state.get(WIRE_CONNECTION_EAST)); case COUNTERCLOCKWISE_90 -> state - .with(WIRE_CONNECTION_NORTH, state.get(WIRE_CONNECTION_EAST)) - .with(WIRE_CONNECTION_EAST, state.get(WIRE_CONNECTION_SOUTH)) - .with(WIRE_CONNECTION_SOUTH, state.get(WIRE_CONNECTION_WEST)) - .with(WIRE_CONNECTION_WEST, state.get(WIRE_CONNECTION_NORTH)); + .with(WIRE_CONNECTION_NORTH, state.get(WIRE_CONNECTION_EAST)) + .with(WIRE_CONNECTION_EAST, state.get(WIRE_CONNECTION_SOUTH)) + .with(WIRE_CONNECTION_SOUTH, state.get(WIRE_CONNECTION_WEST)) + .with(WIRE_CONNECTION_WEST, state.get(WIRE_CONNECTION_NORTH)); case CLOCKWISE_90 -> state - .with(WIRE_CONNECTION_NORTH, state.get(WIRE_CONNECTION_WEST)) - .with(WIRE_CONNECTION_EAST, state.get(WIRE_CONNECTION_NORTH)) - .with(WIRE_CONNECTION_SOUTH, state.get(WIRE_CONNECTION_EAST)) - .with(WIRE_CONNECTION_WEST, state.get(WIRE_CONNECTION_SOUTH)); + .with(WIRE_CONNECTION_NORTH, state.get(WIRE_CONNECTION_WEST)) + .with(WIRE_CONNECTION_EAST, state.get(WIRE_CONNECTION_NORTH)) + .with(WIRE_CONNECTION_SOUTH, state.get(WIRE_CONNECTION_EAST)) + .with(WIRE_CONNECTION_WEST, state.get(WIRE_CONNECTION_SOUTH)); default -> state; }; } private static boolean isFullyConnected(BlockState state) { - return state.get(WIRE_CONNECTION_NORTH).isConnected() && + return state.get(WIRE_CONNECTION_NORTH).isConnected() && state.get(WIRE_CONNECTION_SOUTH).isConnected() && state.get(WIRE_CONNECTION_EAST).isConnected() && state.get(WIRE_CONNECTION_WEST).isConnected(); } private static boolean isNotConnected(BlockState state) { - return !state.get(WIRE_CONNECTION_NORTH).isConnected() && + return !state.get(WIRE_CONNECTION_NORTH).isConnected() && !state.get(WIRE_CONNECTION_SOUTH).isConnected() && !state.get(WIRE_CONNECTION_EAST).isConnected() && !state.get(WIRE_CONNECTION_WEST).isConnected(); } @Override - public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { + public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, + boolean notify) { if (!world.isClient && !state.canPlaceAt(world, pos)) { dropStacks(state, world, pos); world.removeBlock(pos, false); } } - private WireConnection getRenderConnectionType(BlockView world, BlockPos pos, Direction direction) { - return this.getRenderConnectionType(world, pos, direction, !world.getBlockState(pos.up()).isSolidBlock(world, pos)); + return this.getRenderConnectionType(world, pos, direction, + !world.getBlockState(pos.up()).isSolidBlock(world, pos)); } private WireConnection getRenderConnectionType(BlockView world, BlockPos pos, Direction direction, boolean bl) { @@ -319,7 +339,10 @@ private WireConnection getRenderConnectionType(BlockView world, BlockPos pos, Di return WireConnection.SIDE; } } - return !connectsTo(blockState, direction) && (blockState.isSolidBlock(world, blockPos) || !connectsTo(world.getBlockState(blockPos.down()))) ? WireConnection.NONE : WireConnection.SIDE; + return !connectsTo(blockState, direction) + && (blockState.isSolidBlock(world, blockPos) || !connectsTo(world.getBlockState(blockPos.down()))) + ? WireConnection.NONE + : WireConnection.SIDE; } public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { @@ -327,6 +350,7 @@ public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { BlockState blockState = world.getBlockState(blockPos); return this.canRunOnTop(world, blockPos, blockState); } + private BlockState getDefaultWireState(BlockView world, BlockState state, BlockPos pos) { final boolean noBlocksOnTop = !world.getBlockState(pos.up()).isSolidBlock(world, pos); @@ -339,6 +363,7 @@ private BlockState getDefaultWireState(BlockView world, BlockState state, BlockP return state; } + private boolean canRunOnTop(BlockView world, BlockPos pos, BlockState floor) { return floor.isSideSolidFullSquare(world, pos, Direction.UP) || floor.isOf(Blocks.HOPPER); } @@ -352,14 +377,19 @@ protected static boolean connectsTo(BlockState state, @Nullable Direction dir) { || dir != null && state.emitsRedstonePower(); } - private void addPoweredParticles(World world, Random random, BlockPos pos, Vec3d color, Direction direction, Direction direction2, float f, float g) { + private void addPoweredParticles(World world, Random random, BlockPos pos, Vec3d color, Direction direction, + Direction direction2, float f, float g) { float h = g - f; if (!(random.nextFloat() >= 0.1F * h)) { float j = f + h * random.nextFloat(); - double d = 0.5 + (double)(0.4375F * (float)direction.getOffsetX()) + (double)(j * (float)direction2.getOffsetX()); - double e = 0.5 + (double)(0.4375F * (float)direction.getOffsetY()) + (double)(j * (float)direction2.getOffsetY()); - double k = 0.5 + (double)(0.4375F * (float)direction.getOffsetZ()) + (double)(j * (float)direction2.getOffsetZ()); - world.addParticle(ParticleTypes.FLAME, (double)pos.getX() + d, (double)pos.getY() + e, (double)pos.getZ() + k, 0.0, 0.0, 0.0); + double d = 0.5 + (double) (0.4375F * (float) direction.getOffsetX()) + + (double) (j * (float) direction2.getOffsetX()); + double e = 0.5 + (double) (0.4375F * (float) direction.getOffsetY()) + + (double) (j * (float) direction2.getOffsetY()); + double k = 0.5 + (double) (0.4375F * (float) direction.getOffsetZ()) + + (double) (j * (float) direction2.getOffsetZ()); + world.addParticle(ParticleTypes.FLAME, (double) pos.getX() + d, (double) pos.getY() + e, + (double) pos.getZ() + k, 0.0, 0.0, 0.0); } } @@ -369,12 +399,15 @@ public void randomDisplayTick(BlockState state, World world, BlockPos pos, Rando WireConnection wireConnection = state.get(DIRECTION_TO_WIRE_CONNECTION_PROPERTY.get(direction)); switch (wireConnection) { case UP: - this.addPoweredParticles(world, random, pos, COLORS[random.nextInt(2,16)], direction, Direction.UP, -0.5F, 0.5F); + this.addPoweredParticles(world, random, pos, COLORS[random.nextInt(2, 16)], direction, Direction.UP, + -0.5F, 0.5F); case SIDE: - this.addPoweredParticles(world, random, pos, COLORS[random.nextInt(2,16)], Direction.DOWN, direction, 0.0F, 0.5F); + this.addPoweredParticles(world, random, pos, COLORS[random.nextInt(2, 16)], Direction.DOWN, + direction, 0.0F, 0.5F); break; case NONE: - this.addPoweredParticles(world, random, pos, COLORS[random.nextInt(2,16)], Direction.DOWN, direction, 0.0F, 0.3F); + this.addPoweredParticles(world, random, pos, COLORS[random.nextInt(2, 16)], Direction.DOWN, + direction, 0.0F, 0.3F); } } } @@ -395,7 +428,8 @@ protected void appendProperties(StateManager.Builder builder) } @Override - public BlockEntityTicker getTicker(World world, BlockState state, BlockEntityType type) { + public BlockEntityTicker getTicker(World world, BlockState state, + BlockEntityType type) { return checkType(type, BackroomsBlocks.PYROIL_LINE_BLOCK_ENTITY, PyroilLineBlockEntity::tick); } } \ No newline at end of file diff --git a/src/main/java/com/kpabr/backrooms/block/RepairedFluorescentLightBlock.java b/src/main/java/com/kpabr/backrooms/block/RepairedFluorescentLightBlock.java index 636f963..3a57895 100644 --- a/src/main/java/com/kpabr/backrooms/block/RepairedFluorescentLightBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/RepairedFluorescentLightBlock.java @@ -1,5 +1,7 @@ package com.kpabr.backrooms.block; +import com.kpabr.backrooms.init.BackroomsBlocks; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; @@ -11,32 +13,69 @@ import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import net.minecraft.world.WorldAccess; public class RepairedFluorescentLightBlock extends Block { public static final BooleanProperty LIT = Properties.LIT; public static final BooleanProperty POWERED = Properties.POWERED; + public static final BooleanProperty POWERED_BY_MACHINERY = BooleanProperty.of("powered_by_machinery"); + public static final BooleanProperty TURNED_ON_BY_PLAYER = BooleanProperty.of("turned_on_by_player"); public RepairedFluorescentLightBlock(Settings settings) { super(settings); this.setDefaultState(getStateManager().getDefaultState() .with(POWERED, false) - .with(LIT, false)); + .with(LIT, false) + .with(POWERED_BY_MACHINERY, false) + .with(TURNED_ON_BY_PLAYER, false)); } @Override - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - state = state.cycle(LIT); - world.setBlockState(pos, state, Block.NOTIFY_LISTENERS, 0); + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, + BlockHitResult hit) { + if (!world.isClient) { + if (state.get(POWERED_BY_MACHINERY)) { + state = state.with(POWERED_BY_MACHINERY, false).with(TURNED_ON_BY_PLAYER, false); + } else { + state = state.cycle(TURNED_ON_BY_PLAYER); + } + world.setBlockState(pos, state, Block.NOTIFY_LISTENERS); + checkForLit(state, world, pos); + } return ActionResult.success(world.isClient); } + @Override - public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) { + public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, + boolean notify) { if (!world.isClient) { boolean isPowered = world.isReceivingRedstonePower(pos); if (isPowered != state.get(POWERED)) { - if (state.get(LIT) != isPowered) state = state.with(LIT, isPowered); - world.setBlockState(pos, state.with(POWERED, isPowered), Block.NOTIFY_LISTENERS, 0); + state = state.with(POWERED, isPowered); + world.setBlockState(pos, state, Block.NOTIFY_LISTENERS); } + checkForLit(state, world, pos); + } + } + + @SuppressWarnings("deprecation") + @Override + public BlockState getStateForNeighborUpdate(BlockState state, net.minecraft.util.math.Direction direction, + BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + if (!world.isClient()) { + checkForLit(state, (World) world, pos); + } + return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); + } + + @SuppressWarnings("deprecation") + @Override + public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { + super.onStateReplaced(state, world, pos, newState, moved); + if (!world.isClient() && newState.getBlock() == BackroomsBlocks.REPAIRED_FLUORESCENT_LIGHT + && state.get(BooleanProperty.of("powered_by_machinery")) != newState + .get(BooleanProperty.of("powered_by_machinery"))) { + checkForLit(newState, (World) world, pos); } } @@ -44,5 +83,14 @@ public void neighborUpdate(BlockState state, World world, BlockPos pos, Block bl protected void appendProperties(Builder builder) { builder.add(LIT); builder.add(POWERED); + builder.add(POWERED_BY_MACHINERY); + builder.add(TURNED_ON_BY_PLAYER); + } + + private boolean checkForLit(BlockState state, World world, BlockPos pos) { + boolean lit = state.get(POWERED) || state.get(POWERED_BY_MACHINERY) || state.get(TURNED_ON_BY_PLAYER); + world.setBlockState(pos, state.with(LIT, lit), Block.NOTIFY_LISTENERS); + + return lit; } } diff --git a/src/main/java/com/kpabr/backrooms/block/RoofWiringBlock.java b/src/main/java/com/kpabr/backrooms/block/RoofWiringBlock.java index 6e8c3da..dc130ea 100644 --- a/src/main/java/com/kpabr/backrooms/block/RoofWiringBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/RoofWiringBlock.java @@ -1,14 +1,7 @@ -// -// Source code recreated from a .class file by IntelliJ IDEA -// (powered by FernFlower decompiler) -// - package com.kpabr.backrooms.block; import net.minecraft.block.*; -import net.minecraft.block.AbstractBlock.Settings; import net.minecraft.entity.ai.pathing.NavigationType; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.state.property.BooleanProperty; @@ -16,36 +9,32 @@ import net.minecraft.util.BlockMirror; import net.minecraft.util.BlockRotation; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; -import net.minecraft.item.LeadItem; import net.minecraft.state.StateManager.Builder; import net.minecraft.state.property.Property; -import net.minecraft.tag.BlockTags; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction.Type; import net.minecraft.util.shape.VoxelShape; import net.minecraft.world.BlockView; -import net.minecraft.world.World; import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; import java.util.Map; -public class RoofWiringBlock extends Block implements Waterloggable{ +public class RoofWiringBlock extends Block implements Waterloggable { public static final BooleanProperty NORTH = ConnectingBlock.NORTH; public static final BooleanProperty EAST = ConnectingBlock.EAST; public static final BooleanProperty SOUTH = ConnectingBlock.SOUTH; public static final BooleanProperty WEST = ConnectingBlock.WEST; private static final Map FACING_PROPERTIES = ConnectingBlock.FACING_PROPERTIES; public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED; + public RoofWiringBlock(Settings settings) { super(settings); - this.setDefaultState((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)((BlockState)this.stateManager.getDefaultState()).with(NORTH, false)).with(EAST, false)).with(SOUTH, false)).with(WEST, false)).with(WATERLOGGED, false)); + this.setDefaultState( + (BlockState) ((BlockState) ((BlockState) ((BlockState) ((BlockState) ((BlockState) this.stateManager + .getDefaultState()).with(NORTH, false)).with(EAST, false)).with(SOUTH, false)) + .with(WEST, false)).with(WATERLOGGED, false)); } public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) { @@ -76,47 +65,78 @@ public BlockState getPlacementState(ItemPlacementContext ctx) { BlockState blockState2 = blockView.getBlockState(blockPos3); BlockState blockState3 = blockView.getBlockState(blockPos4); BlockState blockState4 = blockView.getBlockState(blockPos5); - return (BlockState)((BlockState)((BlockState)((BlockState)((BlockState)super.getPlacementState(ctx).with(NORTH, this.canConnect(blockState, blockState.isSideSolidFullSquare(blockView, blockPos2, Direction.SOUTH), Direction.SOUTH))).with(EAST, this.canConnect(blockState2, blockState2.isSideSolidFullSquare(blockView, blockPos3, Direction.WEST), Direction.WEST))).with(SOUTH, this.canConnect(blockState3, blockState3.isSideSolidFullSquare(blockView, blockPos4, Direction.NORTH), Direction.NORTH))).with(WEST, this.canConnect(blockState4, blockState4.isSideSolidFullSquare(blockView, blockPos5, Direction.EAST), Direction.EAST))).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); + return (BlockState) ((BlockState) ((BlockState) ((BlockState) ((BlockState) super.getPlacementState(ctx).with( + NORTH, + this.canConnect(blockState, blockState.isSideSolidFullSquare(blockView, blockPos2, Direction.SOUTH), + Direction.SOUTH))) + .with(EAST, this.canConnect(blockState2, + blockState2.isSideSolidFullSquare(blockView, blockPos3, Direction.WEST), Direction.WEST))) + .with(SOUTH, this.canConnect(blockState3, + blockState3.isSideSolidFullSquare(blockView, blockPos4, Direction.NORTH), Direction.NORTH))) + .with(WEST, this.canConnect(blockState4, + blockState4.isSideSolidFullSquare(blockView, blockPos5, Direction.EAST), Direction.EAST))) + .with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER); } - public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + @SuppressWarnings("deprecation") + public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, + WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (direction == Direction.UP && !this.canPlaceAt(state, world, pos)) { return Blocks.AIR.getDefaultState(); } - if ((Boolean)state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + if ((Boolean) state.get(WATERLOGGED)) { + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } - return direction.getAxis().getType() == Type.HORIZONTAL ? (BlockState)state.with((Property)FACING_PROPERTIES.get(direction), this.canConnect(neighborState, neighborState.isSideSolidFullSquare(world, neighborPos, direction.getOpposite()), direction.getOpposite())) : super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); + return direction.getAxis().getType() == Type.HORIZONTAL + ? (BlockState) state + .with(FACING_PROPERTIES.get(direction), + this.canConnect(neighborState, + neighborState.isSideSolidFullSquare(world, neighborPos, + direction.getOpposite()), + direction.getOpposite())) + : super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); } + public BlockState rotate(BlockState state, BlockRotation rotation) { - switch(rotation) { + switch (rotation) { case CLOCKWISE_180: - return (BlockState)((BlockState)((BlockState)((BlockState)state.with(NORTH, (Boolean)state.get(SOUTH))).with(EAST, (Boolean)state.get(WEST))).with(SOUTH, (Boolean)state.get(NORTH))).with(WEST, (Boolean)state.get(EAST)); + return (BlockState) ((BlockState) ((BlockState) ((BlockState) state.with(NORTH, + (Boolean) state.get(SOUTH))).with(EAST, (Boolean) state.get(WEST))) + .with(SOUTH, (Boolean) state.get(NORTH))).with(WEST, (Boolean) state.get(EAST)); case COUNTERCLOCKWISE_90: - return (BlockState)((BlockState)((BlockState)((BlockState)state.with(NORTH, (Boolean)state.get(EAST))).with(EAST, (Boolean)state.get(SOUTH))).with(SOUTH, (Boolean)state.get(WEST))).with(WEST, (Boolean)state.get(NORTH)); + return (BlockState) ((BlockState) ((BlockState) ((BlockState) state.with(NORTH, + (Boolean) state.get(EAST))).with(EAST, (Boolean) state.get(SOUTH))) + .with(SOUTH, (Boolean) state.get(WEST))).with(WEST, (Boolean) state.get(NORTH)); case CLOCKWISE_90: - return (BlockState)((BlockState)((BlockState)((BlockState)state.with(NORTH, (Boolean)state.get(WEST))).with(EAST, (Boolean)state.get(NORTH))).with(SOUTH, (Boolean)state.get(EAST))).with(WEST, (Boolean)state.get(SOUTH)); + return (BlockState) ((BlockState) ((BlockState) ((BlockState) state.with(NORTH, + (Boolean) state.get(WEST))).with(EAST, (Boolean) state.get(NORTH))) + .with(SOUTH, (Boolean) state.get(EAST))).with(WEST, (Boolean) state.get(SOUTH)); default: return state; } } + @SuppressWarnings("deprecation") public BlockState mirror(BlockState state, BlockMirror mirror) { - switch(mirror) { + switch (mirror) { case LEFT_RIGHT: - return (BlockState)((BlockState)state.with(NORTH, (Boolean)state.get(SOUTH))).with(SOUTH, (Boolean)state.get(NORTH)); + return (BlockState) ((BlockState) state.with(NORTH, (Boolean) state.get(SOUTH))).with(SOUTH, + (Boolean) state.get(NORTH)); case FRONT_BACK: - return (BlockState)((BlockState)state.with(EAST, (Boolean)state.get(WEST))).with(WEST, (Boolean)state.get(EAST)); + return (BlockState) ((BlockState) state.with(EAST, (Boolean) state.get(WEST))).with(WEST, + (Boolean) state.get(EAST)); default: return super.mirror(state, mirror); } } + public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { return Block.createCuboidShape(0, 14, 0, 16, 16.0, 16); } + protected void appendProperties(Builder builder) { - builder.add(new Property[]{NORTH, EAST, WEST, SOUTH, WATERLOGGED}); + builder.add(new Property[] { NORTH, EAST, WEST, SOUTH, WATERLOGGED }); } } \ No newline at end of file diff --git a/src/main/java/com/kpabr/backrooms/block/TileBlock.java b/src/main/java/com/kpabr/backrooms/block/TileBlock.java index eaf5096..5f12f89 100644 --- a/src/main/java/com/kpabr/backrooms/block/TileBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/TileBlock.java @@ -1,14 +1,6 @@ package com.kpabr.backrooms.block; import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.StateManager; -import net.minecraft.state.property.DirectionProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.World; public class TileBlock extends Block { diff --git a/src/main/java/com/kpabr/backrooms/block/TilemoldBlock.java b/src/main/java/com/kpabr/backrooms/block/TilemoldBlock.java index d1251ea..d239266 100644 --- a/src/main/java/com/kpabr/backrooms/block/TilemoldBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/TilemoldBlock.java @@ -1,37 +1,20 @@ package com.kpabr.backrooms.block; -import com.fasterxml.jackson.databind.annotation.JsonAppend; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.minecraft.block.*; -import net.minecraft.block.entity.BlockEntity; -import net.minecraft.block.entity.BlockEntityTicker; -import net.minecraft.block.entity.BlockEntityType; -import net.minecraft.block.piston.PistonBehavior; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.sound.SoundCategory; -import net.minecraft.sound.SoundEvent; -import net.minecraft.sound.SoundEvents; import net.minecraft.state.StateManager; import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; -import net.minecraft.util.ActionResult; import net.minecraft.util.BlockMirror; import net.minecraft.util.BlockRotation; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; -import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; -import net.minecraft.world.World; -import com.kpabr.backrooms.block.entity.ComputerBlockEntity; -import com.kpabr.backrooms.init.BackroomsBlocks; import net.minecraft.world.WorldAccess; import net.minecraft.world.WorldView; import org.jetbrains.annotations.Nullable; @@ -78,12 +61,14 @@ public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) { return world.getBlockState(blockPos).isSideSolidFullSquare(world, blockPos, direction); } + @SuppressWarnings("deprecation") @Override - public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { + public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, + WorldAccess world, BlockPos pos, BlockPos neighborPos) { if (state.get(WATERLOGGED)) { - world.createAndScheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); + world.scheduleFluidTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } - if(direction == state.get(FACING).getOpposite() && !state.canPlaceAt(world, pos)) + if (direction == state.get(FACING).getOpposite() && !state.canPlaceAt(world, pos)) return Blocks.AIR.getDefaultState(); return super.getStateForNeighborUpdate(state, direction, neighborState, world, pos, neighborPos); @@ -108,6 +93,7 @@ public BlockState mirror(BlockState state, BlockMirror mirror) { return state.rotate(mirror.getRotation(state.get(FACING))); } + @SuppressWarnings("deprecation") @Override public FluidState getFluidState(BlockState state) { return state.get(WATERLOGGED) ? Fluids.WATER.getStill(false) : super.getFluidState(state); @@ -116,9 +102,4 @@ public FluidState getFluidState(BlockState state) { protected void appendProperties(StateManager.Builder builder) { builder.add(WATERLOGGED, FACING); } - - @Override - public PistonBehavior getPistonBehavior(BlockState state) { - return PistonBehavior.DESTROY; - } } \ No newline at end of file diff --git a/src/main/java/com/kpabr/backrooms/block/WallpaperBlock.java b/src/main/java/com/kpabr/backrooms/block/WallpaperBlock.java index 35be313..774a610 100644 --- a/src/main/java/com/kpabr/backrooms/block/WallpaperBlock.java +++ b/src/main/java/com/kpabr/backrooms/block/WallpaperBlock.java @@ -1,6 +1,6 @@ package com.kpabr.backrooms.block; -import java.util.Random; +import net.minecraft.util.math.random.Random; import java.util.function.Consumer; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; @@ -21,18 +21,20 @@ public class WallpaperBlock extends Block { - public WallpaperBlock(FabricBlockSettings fabricBlockSettings) { super(fabricBlockSettings);} + public WallpaperBlock(FabricBlockSettings fabricBlockSettings) { + super(fabricBlockSettings); + } @Override - public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { + public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, + BlockHitResult hit) { Random rand = world.random; ItemStack itemStack = player.getStackInHand(hand); if (itemStack.getItem() instanceof AxeItem) { if (!world.isClient) { - itemStack.damage(1, player, (Consumer) ((e) -> - e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND) - )); + itemStack.damage(1, player, + (Consumer) ((e) -> e.sendEquipmentBreakStatus(EquipmentSlot.MAINHAND))); } world.setBlockState(pos, Blocks.OAK_PLANKS.getDefaultState(), Block.FORCE_STATE, 0); player.playSound(SoundEvents.ITEM_AXE_STRIP, 0.5f, rand.nextFloat()); diff --git a/src/main/java/com/kpabr/backrooms/block/entity/ComputerBlockEntity.java b/src/main/java/com/kpabr/backrooms/block/entity/ComputerBlockEntity.java index 5e8d623..78ad7fd 100644 --- a/src/main/java/com/kpabr/backrooms/block/entity/ComputerBlockEntity.java +++ b/src/main/java/com/kpabr/backrooms/block/entity/ComputerBlockEntity.java @@ -4,10 +4,8 @@ import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import com.kpabr.backrooms.BackroomsMod; import com.kpabr.backrooms.block.ComputerBlock; import com.kpabr.backrooms.init.BackroomsBlocks; -import net.minecraft.block.Blocks; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; @@ -20,10 +18,9 @@ public ComputerBlockEntity(BlockEntityType type, BlockPos pos, BlockState sta public ComputerBlockEntity(BlockPos pos, BlockState state) { super(BackroomsBlocks.COMPUTER_BLOCK_ENTITY, pos, state); } - public static void tick(World world, BlockPos pos, BlockState state) { - if(world.isReceivingRedstonePower(pos)) { + if (world.isReceivingRedstonePower(pos)) { world.setBlockState(pos, state.with(ComputerBlock.LIT, true), Block.FORCE_STATE, 0); } else { world.setBlockState(pos, state.with(ComputerBlock.LIT, false), Block.FORCE_STATE, 0); diff --git a/src/main/java/com/kpabr/backrooms/block/entity/CrateBlockEntity.java b/src/main/java/com/kpabr/backrooms/block/entity/CrateBlockEntity.java index 23f0fb9..6b75024 100644 --- a/src/main/java/com/kpabr/backrooms/block/entity/CrateBlockEntity.java +++ b/src/main/java/com/kpabr/backrooms/block/entity/CrateBlockEntity.java @@ -15,12 +15,10 @@ import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvent; import net.minecraft.sound.SoundEvents; +import net.minecraft.text.MutableText; import net.minecraft.text.Text; -import net.minecraft.text.TranslatableText; import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec3i; import net.minecraft.world.World; public class CrateBlockEntity extends LootableContainerBlockEntity { @@ -41,12 +39,13 @@ protected void onContainerClose(World world, BlockPos pos, BlockState state) { CrateBlockEntity.this.setOpen(state, false); } - protected void onViewerCountUpdate(World world, BlockPos pos, BlockState state, int oldViewerCount, int newViewerCount) { + protected void onViewerCountUpdate(World world, BlockPos pos, BlockState state, int oldViewerCount, + int newViewerCount) { } protected boolean isPlayerViewing(PlayerEntity player) { if (player.currentScreenHandler instanceof GenericContainerScreenHandler) { - Inventory inventory = ((GenericContainerScreenHandler)player.currentScreenHandler).getInventory(); + Inventory inventory = ((GenericContainerScreenHandler) player.currentScreenHandler).getInventory(); return inventory == CrateBlockEntity.this; } else { return false; @@ -84,8 +83,8 @@ protected void setInvStackList(DefaultedList list) { this.inventory = list; } - protected Text getContainerName() { - return new TranslatableText("container.backrooms.crate"); + protected MutableText getContainerName() { + return Text.translatable("container.backrooms.crate"); } protected ScreenHandler createScreenHandler(int syncId, PlayerInventory playerInventory) { @@ -114,13 +113,14 @@ public void tick() { } void setOpen(BlockState state, boolean open) { - this.world.setBlockState(this.getPos(), (BlockState)state.with(CrateBlock.OPEN, open), 3); + this.world.setBlockState(this.getPos(), (BlockState) state.with(CrateBlock.OPEN, open), 3); } void playSound(BlockState state, SoundEvent soundEvent) { - double d = (double)this.pos.getX() + 0.5D; - double e = (double)this.pos.getY() + 0.5D; - double f = (double)this.pos.getZ() + 0.5D; - world.playSound((PlayerEntity)null, d, e, f, soundEvent, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F); + double d = (double) this.pos.getX() + 0.5D; + double e = (double) this.pos.getY() + 0.5D; + double f = (double) this.pos.getZ() + 0.5D; + world.playSound((PlayerEntity) null, d, e, f, soundEvent, SoundCategory.BLOCKS, 0.5F, + world.random.nextFloat() * 0.1F + 0.9F); } } diff --git a/src/main/java/com/kpabr/backrooms/block/entity/MaskBlockEntity.java b/src/main/java/com/kpabr/backrooms/block/entity/MaskBlockEntity.java index 19407d9..0a871bd 100644 --- a/src/main/java/com/kpabr/backrooms/block/entity/MaskBlockEntity.java +++ b/src/main/java/com/kpabr/backrooms/block/entity/MaskBlockEntity.java @@ -82,7 +82,7 @@ public static void tick(World world, BlockPos pos, BlockState state, MaskBlockEn } public float getTicksPowered(float tickDelta) { - return this.powered ? (float)this.ticksPowered + tickDelta : (float)this.ticksPowered; + return this.powered ? (float) this.ticksPowered + tickDelta : (float) this.ticksPowered; } @Nullable @@ -101,7 +101,7 @@ public NbtCompound toInitialChunkDataNbt() { } public void setOwner(@Nullable GameProfile owner) { - synchronized(this) { + synchronized (this) { this.owner = owner; } @@ -116,11 +116,14 @@ private void loadOwnerProperties() { } public static void loadProperties(@Nullable GameProfile owner, Consumer callback) { - if (owner != null && !StringHelper.isEmpty(owner.getName()) && (!owner.isComplete() || !owner.getProperties().containsKey("textures")) && userCache != null && sessionService != null) { + if (owner != null && !StringHelper.isEmpty(owner.getName()) + && (!owner.isComplete() || !owner.getProperties().containsKey("textures")) && userCache != null + && sessionService != null) { userCache.findByNameAsync(owner.getName(), (profile) -> { Util.getMainWorkerExecutor().execute(() -> { Util.ifPresentOrElse(profile, (profilex) -> { - Property property = (Property)Iterables.getFirst(profilex.getProperties().get("textures"), (Object)null); + Property property = (Property) Iterables.getFirst(profilex.getProperties().get("textures"), + (Object) null); if (property == null) { profilex = sessionService.fillProfileProperties(profilex, true); } diff --git a/src/main/java/com/kpabr/backrooms/block/entity/PyroilLineBlockEntity.java b/src/main/java/com/kpabr/backrooms/block/entity/PyroilLineBlockEntity.java index c525f04..7edaed7 100644 --- a/src/main/java/com/kpabr/backrooms/block/entity/PyroilLineBlockEntity.java +++ b/src/main/java/com/kpabr/backrooms/block/entity/PyroilLineBlockEntity.java @@ -5,28 +5,29 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.tag.BlockTags; +import net.minecraft.registry.tag.BlockTags; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class PyroilLineBlockEntity extends BlockEntity { private long Timer = 3L; + public PyroilLineBlockEntity(BlockPos pos, BlockState state) { super(BackroomsBlocks.PYROIL_LINE_BLOCK_ENTITY, pos, state); } public static boolean isAroundFire(World world, BlockPos center) { - return BlockPos.stream(center.add(-1, -1, -1), center.add(1, 1, 1)).anyMatch((pos) -> world.getBlockState(pos).isIn(BlockTags.FIRE)); + return BlockPos.stream(center.add(-1, -1, -1), center.add(1, 1, 1)) + .anyMatch((pos) -> world.getBlockState(pos).isIn(BlockTags.FIRE)); } - public static void tick(World world, BlockPos pos, BlockState state, PyroilLineBlockEntity blockEntity) { - if(isAroundFire(world, pos)){ - Block block = world.getBlockState(pos.add(0,1,0)).getBlock(); - if(block == Blocks.AIR || block == Blocks.CAVE_AIR || block == Blocks.VOID_AIR || block == Blocks.TNT){ - if(--blockEntity.Timer <= 0L){ + if (isAroundFire(world, pos)) { + Block block = world.getBlockState(pos.add(0, 1, 0)).getBlock(); + if (block == Blocks.AIR || block == Blocks.CAVE_AIR || block == Blocks.VOID_AIR || block == Blocks.TNT) { + if (--blockEntity.Timer <= 0L) { world.setBlockState(pos, Blocks.FIRE.getDefaultState()); } } diff --git a/src/main/java/com/kpabr/backrooms/client/BackroomsClient.java b/src/main/java/com/kpabr/backrooms/client/BackroomsClient.java index 5efaa59..1262b76 100644 --- a/src/main/java/com/kpabr/backrooms/client/BackroomsClient.java +++ b/src/main/java/com/kpabr/backrooms/client/BackroomsClient.java @@ -6,38 +6,31 @@ import com.kpabr.backrooms.particle.FireSaltParticle; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap; -import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry; import net.fabricmc.fabric.api.client.render.fluid.v1.FluidRenderHandlerRegistry; import net.fabricmc.fabric.api.client.render.fluid.v1.SimpleFluidRenderHandler; import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; -import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback; -import net.minecraft.client.option.KeyBinding; -import net.minecraft.client.option.StickyKeyBinding; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.entity.FlyingItemEntityRenderer; -import net.minecraft.client.util.InputUtil; -import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.util.Identifier; -import org.lwjgl.glfw.GLFW; public class BackroomsClient implements ClientModInitializer { @Override public void onInitializeClient() { - ClientSpriteRegistryCallback.event(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE).register(((atlasTexture, registry) -> - registry.register(new Identifier("minecraft", "particle/flame")) - )); - //almond water fluid rendering - FluidRenderHandlerRegistry.INSTANCE.register(BackroomsFluids.STILL_ALMOND_WATER, BackroomsFluids.FLOWING_ALMOND_WATER, + // almond water fluid rendering + FluidRenderHandlerRegistry.INSTANCE.register(BackroomsFluids.STILL_ALMOND_WATER, + BackroomsFluids.FLOWING_ALMOND_WATER, new SimpleFluidRenderHandler( new Identifier("minecraft:block/water_still"), new Identifier("minecraft:block/water_flow"), 0xE0E0FF)); - ParticleFactoryRegistry.getInstance().register(BackroomsParticles.FIRESALT_PARTICLE, new FireSaltParticle.FireSaltFactory()); + ParticleFactoryRegistry.getInstance().register(BackroomsParticles.FIRESALT_PARTICLE, + new FireSaltParticle.FireSaltFactory()); - EntityRendererRegistry.register(BackroomsProjectiles.FIRE_SALT_PROJECTILE_ENTITY_TYPE, FlyingItemEntityRenderer::new); + EntityRendererRegistry.register(BackroomsProjectiles.FIRE_SALT_PROJECTILE_ENTITY_TYPE, + FlyingItemEntityRenderer::new); BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), BackroomsBlocks.FIRESALT_CRYSTAL, BackroomsBlocks.TILEMOLD, @@ -47,8 +40,7 @@ public void onInitializeClient() { BackroomsBlocks.OFFICE_DOOR, BackroomsBlocks.HARLEQUIN_MASK, BackroomsBlocks.COLOMBINA_MASK, - BackroomsBlocks.PLATE_DOOR - ); + BackroomsBlocks.PLATE_DOOR); BlockRenderLayerMap.INSTANCE.putFluids(RenderLayer.getTranslucent(), BackroomsFluids.STILL_ALMOND_WATER, BackroomsFluids.FLOWING_ALMOND_WATER); diff --git a/src/main/java/com/kpabr/backrooms/client/entity/model/HoundModel.java b/src/main/java/com/kpabr/backrooms/client/entity/model/HoundModel.java index 0bfa888..2a7a62f 100644 --- a/src/main/java/com/kpabr/backrooms/client/entity/model/HoundModel.java +++ b/src/main/java/com/kpabr/backrooms/client/entity/model/HoundModel.java @@ -3,22 +3,22 @@ import com.kpabr.backrooms.BackroomsMod; import com.kpabr.backrooms.entity.HoundEntity; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.model.AnimatedGeoModel; +import software.bernie.geckolib.model.GeoModel; -public class HoundModel extends AnimatedGeoModel { +public class HoundModel extends GeoModel { @Override - public Identifier getModelLocation(HoundEntity object) { + public Identifier getModelResource(HoundEntity object) { return new Identifier(BackroomsMod.ModId, "geo/entities/hound.geo.json"); } @Override - public Identifier getTextureLocation(HoundEntity object) { + public Identifier getTextureResource(HoundEntity object) { return new Identifier(BackroomsMod.ModId, "textures/entity/hound.png"); } @Override - public Identifier getAnimationFileLocation(HoundEntity animatable) { + public Identifier getAnimationResource(HoundEntity animatable) { return new Identifier(BackroomsMod.ModId, "animations/entities/hound.animation.json"); } } diff --git a/src/main/java/com/kpabr/backrooms/client/entity/model/WretchModel.java b/src/main/java/com/kpabr/backrooms/client/entity/model/WretchModel.java index 3469735..6438ee7 100644 --- a/src/main/java/com/kpabr/backrooms/client/entity/model/WretchModel.java +++ b/src/main/java/com/kpabr/backrooms/client/entity/model/WretchModel.java @@ -3,21 +3,21 @@ import com.kpabr.backrooms.BackroomsMod; import com.kpabr.backrooms.entity.WretchEntity; import net.minecraft.util.Identifier; -import software.bernie.geckolib3.model.AnimatedGeoModel; +import software.bernie.geckolib.model.GeoModel; -public class WretchModel extends AnimatedGeoModel { +public class WretchModel extends GeoModel { @Override - public Identifier getModelLocation(WretchEntity object) { + public Identifier getModelResource(WretchEntity object) { return BackroomsMod.id("geo/entities/wretch.geo.json"); } @Override - public Identifier getTextureLocation(WretchEntity object) { + public Identifier getTextureResource(WretchEntity object) { return BackroomsMod.id("textures/entity/wretch.png"); } @Override - public Identifier getAnimationFileLocation(WretchEntity animatable) { + public Identifier getAnimationResource(WretchEntity animatable) { return BackroomsMod.id("animations/entities/wretch.animation.json"); } } diff --git a/src/main/java/com/kpabr/backrooms/client/entity/renderer/HoundEntityRenderer.java b/src/main/java/com/kpabr/backrooms/client/entity/renderer/HoundEntityRenderer.java index 200aa22..f807dc0 100644 --- a/src/main/java/com/kpabr/backrooms/client/entity/renderer/HoundEntityRenderer.java +++ b/src/main/java/com/kpabr/backrooms/client/entity/renderer/HoundEntityRenderer.java @@ -3,14 +3,11 @@ import com.kpabr.backrooms.entity.HoundEntity; import com.kpabr.backrooms.client.entity.model.HoundModel; import net.minecraft.client.render.entity.EntityRendererFactory; -import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; +import software.bernie.geckolib.renderer.GeoEntityRenderer; public class HoundEntityRenderer extends GeoEntityRenderer { - public HoundEntityRenderer(EntityRendererFactory.Context renderManager) { super(renderManager, new HoundModel()); } } - - diff --git a/src/main/java/com/kpabr/backrooms/client/entity/renderer/WretchEntityRenderer.java b/src/main/java/com/kpabr/backrooms/client/entity/renderer/WretchEntityRenderer.java index 803a5c7..ff30f0b 100644 --- a/src/main/java/com/kpabr/backrooms/client/entity/renderer/WretchEntityRenderer.java +++ b/src/main/java/com/kpabr/backrooms/client/entity/renderer/WretchEntityRenderer.java @@ -3,9 +3,10 @@ import com.kpabr.backrooms.entity.WretchEntity; import com.kpabr.backrooms.client.entity.model.WretchModel; import net.minecraft.client.render.entity.EntityRendererFactory; -import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; +import software.bernie.geckolib.renderer.GeoEntityRenderer; public class WretchEntityRenderer extends GeoEntityRenderer { + public WretchEntityRenderer(EntityRendererFactory.Context renderManager) { super(renderManager, new WretchModel()); } diff --git a/src/main/java/com/kpabr/backrooms/client/render/sky/RemoveSkyboxQuadsBakedModel.java b/src/main/java/com/kpabr/backrooms/client/render/sky/RemoveSkyboxQuadsBakedModel.java index d6695bc..cfe0eee 100644 --- a/src/main/java/com/kpabr/backrooms/client/render/sky/RemoveSkyboxQuadsBakedModel.java +++ b/src/main/java/com/kpabr/backrooms/client/render/sky/RemoveSkyboxQuadsBakedModel.java @@ -1,7 +1,7 @@ package com.kpabr.backrooms.client.render.sky; import java.util.List; -import java.util.Random; +import net.minecraft.util.math.random.Random; import net.minecraft.block.BlockState; import net.minecraft.client.render.model.BakedModel; @@ -25,7 +25,7 @@ public List getQuads(BlockState state, Direction face, Random random) if (quads == null) { return null; } - return quads.stream().filter((quad) -> !quad.getSprite().getId().getPath().startsWith("sky/")).toList(); + return quads.stream().filter((quad) -> !quad.getSprite().getAtlasId().getPath().startsWith("sky/")).toList(); } @Override diff --git a/src/main/java/com/kpabr/backrooms/client/render/sky/SkyboxShaders.java b/src/main/java/com/kpabr/backrooms/client/render/sky/SkyboxShaders.java index dca7268..8153b39 100644 --- a/src/main/java/com/kpabr/backrooms/client/render/sky/SkyboxShaders.java +++ b/src/main/java/com/kpabr/backrooms/client/render/sky/SkyboxShaders.java @@ -3,32 +3,32 @@ import java.nio.ByteBuffer; import java.nio.IntBuffer; import java.util.List; -import java.util.Random; +import net.minecraft.util.math.random.Random; import java.util.function.Consumer; import org.lwjgl.system.MemoryStack; import net.minecraft.block.BlockState; -import net.minecraft.client.render.RenderPhase; -import net.minecraft.client.render.Shader; +import net.minecraft.client.gl.ShaderProgram; import net.minecraft.client.render.VertexFormats; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedQuad; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Matrix4f; -import net.minecraft.util.math.Vec3f; -import net.minecraft.util.math.Vector4f; +import org.joml.Matrix4f; +import org.joml.Vector3f; +import org.joml.Vector4f; public class SkyboxShaders { - public static Shader SKYBOX_SHADER; + public static ShaderProgram SKYBOX_SHADER; public static void addAll(List list, BakedModel model, BlockState state, Direction dir, Random random) { - list.addAll(model.getQuads(state, dir, random).stream().filter((quad) -> quad.getSprite().getId().getPath().startsWith("sky/")).toList()); + list.addAll(model.getQuads(state, dir, random).stream() + .filter((quad) -> quad.getSprite().getAtlasId().getPath().startsWith("sky/")).toList()); } public static void addAll(List list, BakedModel model, BlockState state, Direction dir) { - addAll(list, model, state, dir, new Random(0)); + addAll(list, model, state, dir, Random.create(0)); } public static void addAll(List list, BakedModel model, BlockState state) { @@ -39,12 +39,13 @@ public static void addAll(List list, BakedModel model, BlockState sta addAll(list, model, state, null, random); } - public static void quad(Consumer consumer, Matrix4f matrix4f, BakedQuad quad) { + public static void quad(Consumer consumer, Matrix4f matrix4f, BakedQuad quad) { int[] js = quad.getVertexData(); int j = js.length / 8; MemoryStack memoryStack = MemoryStack.stackPush(); try { - ByteBuffer byteBuffer = memoryStack.malloc(VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL.getVertexSize()); + ByteBuffer byteBuffer = memoryStack + .malloc(VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL.getVertexSizeByte()); IntBuffer intBuffer = byteBuffer.asIntBuffer(); for (int k = 0; k < j; ++k) { @@ -55,8 +56,8 @@ public static void quad(Consumer consumer, Matrix4f matrix4f, BakedQuad q float h = byteBuffer.getFloat(8); Vector4f vector4f = new Vector4f(f, g, h, 1.0F); - vector4f.transform(matrix4f); - consumer.accept(new Vec3f(vector4f.getX(), vector4f.getY(), vector4f.getZ())); + matrix4f.transform(vector4f); + consumer.accept(new Vector3f(vector4f.x, vector4f.y, vector4f.z)); } } catch (Throwable var33) { try { diff --git a/src/main/java/com/kpabr/backrooms/component/PlayerWretchedComponent.java b/src/main/java/com/kpabr/backrooms/component/PlayerWretchedComponent.java index 8a339e0..68baff2 100644 --- a/src/main/java/com/kpabr/backrooms/component/PlayerWretchedComponent.java +++ b/src/main/java/com/kpabr/backrooms/component/PlayerWretchedComponent.java @@ -30,7 +30,8 @@ public boolean increment() { @Override public void decrement() { - if(wretched != 0) --this.wretched; + if (wretched != 0) + --this.wretched; } @Override diff --git a/src/main/java/com/kpabr/backrooms/component/WretchedComponent.java b/src/main/java/com/kpabr/backrooms/component/WretchedComponent.java index edb9d12..d41c336 100644 --- a/src/main/java/com/kpabr/backrooms/component/WretchedComponent.java +++ b/src/main/java/com/kpabr/backrooms/component/WretchedComponent.java @@ -4,8 +4,12 @@ public interface WretchedComponent extends Component { int getValue(); + void setValue(int value); + void remove(int amount); + boolean increment(); + void decrement(); } diff --git a/src/main/java/com/kpabr/backrooms/config/BackroomsConfig.java b/src/main/java/com/kpabr/backrooms/config/BackroomsConfig.java index a8bdc93..db6d437 100644 --- a/src/main/java/com/kpabr/backrooms/config/BackroomsConfig.java +++ b/src/main/java/com/kpabr/backrooms/config/BackroomsConfig.java @@ -6,11 +6,11 @@ import me.shedaniel.autoconfig.annotation.ConfigEntry; import me.shedaniel.autoconfig.serializer.GsonConfigSerializer; - @Config.Gui.Background("backrooms:textures/block/patterned_wallpaper.png") @Config(name = "backrooms") public class BackroomsConfig implements ConfigData { @ConfigEntry.Category("Gameplay") + @ConfigEntry.BoundedDiscrete(min = 0, max = 100) public int suffocationChance = 10; @ConfigEntry.Category("Gameplay") @@ -18,13 +18,11 @@ public class BackroomsConfig implements ConfigData { @ConfigEntry.Category("Gameplay") public int wretchedCycleStepTime = 20; // by default every 20 seconds we increment player's wretched parameter + @ConfigEntry.Category("Gameplay") public double moldyCorkTileChance = 0.05; - @ConfigEntry.Category("Render") - public boolean disableStrongShaders = true; - - @ConfigEntry.Category("Miscellaneous") + @ConfigEntry.Category("Entities/AI") public boolean aiDebug = false; public static void init() { diff --git a/src/main/java/com/kpabr/backrooms/effect/RaggedStatusEffect.java b/src/main/java/com/kpabr/backrooms/effect/RaggedStatusEffect.java index add4b01..cc722cd 100644 --- a/src/main/java/com/kpabr/backrooms/effect/RaggedStatusEffect.java +++ b/src/main/java/com/kpabr/backrooms/effect/RaggedStatusEffect.java @@ -10,14 +10,18 @@ public class RaggedStatusEffect extends StatusEffect { public RaggedStatusEffect() { super(StatusEffectCategory.BENEFICIAL, 8171462); - this.addAttributeModifier(EntityAttributes.GENERIC_MOVEMENT_SPEED, "7107DE5E-7CE8-4030-940E-514C1F160890", -0.15f, EntityAttributeModifier.Operation.MULTIPLY_TOTAL); - this.addAttributeModifier(EntityAttributes.GENERIC_MAX_HEALTH, "5D6F0BA2-1186-46AC-B896-C61C5CEE99CC", -2.0, EntityAttributeModifier.Operation.ADDITION); - this.addAttributeModifier(EntityAttributes.GENERIC_ATTACK_DAMAGE, "648D7064-6A60-4F59-8ABE-C2C23A6DD7A9", 1.0, EntityAttributeModifier.Operation.ADDITION); + this.addAttributeModifier(EntityAttributes.GENERIC_MOVEMENT_SPEED, "7107DE5E-7CE8-4030-940E-514C1F160890", + -0.15f, EntityAttributeModifier.Operation.MULTIPLY_TOTAL); + this.addAttributeModifier(EntityAttributes.GENERIC_MAX_HEALTH, "5D6F0BA2-1186-46AC-B896-C61C5CEE99CC", -2.0, + EntityAttributeModifier.Operation.ADDITION); + this.addAttributeModifier(EntityAttributes.GENERIC_ATTACK_DAMAGE, "648D7064-6A60-4F59-8ABE-C2C23A6DD7A9", 1.0, + EntityAttributeModifier.Operation.ADDITION); } @Override public boolean canApplyUpdateEffect(int duration, int amplifier) { - // In our case, we just make it return true so that it applies the status effect every tick. + // In our case, we just make it return true so that it applies the status effect + // every tick. return true; } diff --git a/src/main/java/com/kpabr/backrooms/effect/RottenStatusEffect.java b/src/main/java/com/kpabr/backrooms/effect/RottenStatusEffect.java index b52e51d..33d46db 100644 --- a/src/main/java/com/kpabr/backrooms/effect/RottenStatusEffect.java +++ b/src/main/java/com/kpabr/backrooms/effect/RottenStatusEffect.java @@ -11,14 +11,18 @@ public class RottenStatusEffect extends StatusEffect { public RottenStatusEffect() { super(StatusEffectCategory.BENEFICIAL, 8171462); - this.addAttributeModifier(EntityAttributes.GENERIC_MOVEMENT_SPEED, "7107DE5E-7CE8-4030-940E-514C1F160890", -0.35f, EntityAttributeModifier.Operation.MULTIPLY_TOTAL); - this.addAttributeModifier(EntityAttributes.GENERIC_MAX_HEALTH, "5D6F0BA2-1186-46AC-B896-C61C5CEE99CC", -6.0, EntityAttributeModifier.Operation.ADDITION); - this.addAttributeModifier(EntityAttributes.GENERIC_ATTACK_DAMAGE, "648D7064-6A60-4F59-8ABE-C2C23A6DD7A9", 2.0, EntityAttributeModifier.Operation.ADDITION); + this.addAttributeModifier(EntityAttributes.GENERIC_MOVEMENT_SPEED, "7107DE5E-7CE8-4030-940E-514C1F160890", + -0.35f, EntityAttributeModifier.Operation.MULTIPLY_TOTAL); + this.addAttributeModifier(EntityAttributes.GENERIC_MAX_HEALTH, "5D6F0BA2-1186-46AC-B896-C61C5CEE99CC", -6.0, + EntityAttributeModifier.Operation.ADDITION); + this.addAttributeModifier(EntityAttributes.GENERIC_ATTACK_DAMAGE, "648D7064-6A60-4F59-8ABE-C2C23A6DD7A9", 2.0, + EntityAttributeModifier.Operation.ADDITION); } @Override public boolean canApplyUpdateEffect(int duration, int amplifier) { - // In our case, we just make it return true so that it applies the status effect every tick. + // In our case, we just make it return true so that it applies the status effect + // every tick. return true; } diff --git a/src/main/java/com/kpabr/backrooms/effect/WretchedStatusEffect.java b/src/main/java/com/kpabr/backrooms/effect/WretchedStatusEffect.java index ba247d7..daa321d 100644 --- a/src/main/java/com/kpabr/backrooms/effect/WretchedStatusEffect.java +++ b/src/main/java/com/kpabr/backrooms/effect/WretchedStatusEffect.java @@ -11,14 +11,18 @@ public class WretchedStatusEffect extends StatusEffect { public WretchedStatusEffect() { super(StatusEffectCategory.BENEFICIAL, 8171462); - this.addAttributeModifier(EntityAttributes.GENERIC_MOVEMENT_SPEED, "7107DE5E-7CE8-4030-940E-514C1F160890", -0.5f, EntityAttributeModifier.Operation.MULTIPLY_TOTAL); - this.addAttributeModifier(EntityAttributes.GENERIC_MAX_HEALTH, "5D6F0BA2-1186-46AC-B896-C61C5CEE99CC", -12.0, EntityAttributeModifier.Operation.ADDITION); - this.addAttributeModifier(EntityAttributes.GENERIC_ATTACK_DAMAGE, "648D7064-6A60-4F59-8ABE-C2C23A6DD7A9", 3.0, EntityAttributeModifier.Operation.ADDITION); + this.addAttributeModifier(EntityAttributes.GENERIC_MOVEMENT_SPEED, "7107DE5E-7CE8-4030-940E-514C1F160890", + -0.5f, EntityAttributeModifier.Operation.MULTIPLY_TOTAL); + this.addAttributeModifier(EntityAttributes.GENERIC_MAX_HEALTH, "5D6F0BA2-1186-46AC-B896-C61C5CEE99CC", -12.0, + EntityAttributeModifier.Operation.ADDITION); + this.addAttributeModifier(EntityAttributes.GENERIC_ATTACK_DAMAGE, "648D7064-6A60-4F59-8ABE-C2C23A6DD7A9", 3.0, + EntityAttributeModifier.Operation.ADDITION); } @Override public boolean canApplyUpdateEffect(int duration, int amplifier) { - // In our case, we just make it return true so that it applies the status effect every tick. + // In our case, we just make it return true so that it applies the status effect + // every tick. return true; } diff --git a/src/main/java/com/kpabr/backrooms/entity/FireSaltProjectileEntity.java b/src/main/java/com/kpabr/backrooms/entity/FireSaltProjectileEntity.java index 08e0341..c2ba967 100644 --- a/src/main/java/com/kpabr/backrooms/entity/FireSaltProjectileEntity.java +++ b/src/main/java/com/kpabr/backrooms/entity/FireSaltProjectileEntity.java @@ -10,7 +10,6 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.damage.DamageSource; import net.minecraft.entity.projectile.thrown.ThrownItemEntity; import net.minecraft.item.Item; import net.minecraft.particle.ParticleEffect; @@ -18,7 +17,6 @@ import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.world.World; -import net.minecraft.world.explosion.Explosion; public class FireSaltProjectileEntity extends ThrownItemEntity { @@ -50,7 +48,7 @@ public void handleStatus(byte status) { // particles WIP if (status == 3) { ParticleEffect particleEffect = this.getParticleParameters(); for (int i = 0; i < 8; ++i) { - this.world.addParticle(particleEffect, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D); + this.getWorld().addParticle(particleEffect, this.getX(), this.getY(), this.getZ(), 0.0D, 0.0D, 0.0D); } } } @@ -59,20 +57,20 @@ protected void onEntityHit(EntityHitResult entityHitResult) { super.onEntityHit(entityHitResult); Entity entity = entityHitResult.getEntity(); - world.playSound(null, entity.getBlockPos(), FIRESALT_LAND_EVENT, SoundCategory.BLOCKS, 1f, 1f); + this.getWorld().playSound(null, entity.getBlockPos(), FIRESALT_LAND_EVENT, SoundCategory.BLOCKS, 1f, 1f); entity.setOnFire(true); - entity.damage(DamageSource.thrownProjectile(this, this.getOwner()), 4.0f); - this.world.createExplosion(this, entity.getBlockX(), entity.getBlockY() + 0.5, entity.getBlockZ(), 0.5f, true, Explosion.DestructionType.BREAK); + this.getWorld().createExplosion(this, (double) entity.getBlockX(), (double) entity.getBlockY() + 0.5, + (double) entity.getBlockZ(), 0.5f, true, World.ExplosionSourceType.NONE); } - protected void onCollision(HitResult hitResult) { super.onCollision(hitResult); - if (!this.world.isClient) { - this.world.sendEntityStatus(this, (byte) 3); // particles - world.playSound(null, this.getBlockPos(), FIRESALT_LAND_EVENT, SoundCategory.BLOCKS, 1f, 1f); + if (!this.getWorld().isClient()) { + this.getWorld().sendEntityStatus(this, (byte) 3); // particles + this.getWorld().playSound(null, this.getBlockPos(), FIRESALT_LAND_EVENT, SoundCategory.BLOCKS, 1f, 1f); this.kill(); - this.world.createExplosion(this, this.getBlockX(), this.getBlockY() + 0.5, this.getBlockZ(), 0.5f, true, Explosion.DestructionType.BREAK); + this.getWorld().createExplosion(this, (double) this.getBlockX(), (double) this.getBlockY() + 0.5, + (double) this.getBlockZ(), 0.5f, true, World.ExplosionSourceType.NONE); } } } \ No newline at end of file diff --git a/src/main/java/com/kpabr/backrooms/entity/HoundEntity.java b/src/main/java/com/kpabr/backrooms/entity/HoundEntity.java index 35845da..f46b4c2 100644 --- a/src/main/java/com/kpabr/backrooms/entity/HoundEntity.java +++ b/src/main/java/com/kpabr/backrooms/entity/HoundEntity.java @@ -9,6 +9,7 @@ import net.minecraft.entity.attribute.DefaultAttributeContainer; import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.damage.DamageTypes; import net.minecraft.entity.data.DataTracker; import net.minecraft.entity.data.TrackedData; import net.minecraft.entity.data.TrackedDataHandlerRegistry; @@ -20,24 +21,27 @@ import net.minecraft.world.World; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Range; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; + +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager.ControllerRegistrar; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; +import software.bernie.geckolib.util.RenderUtils; import java.util.Optional; import java.util.function.Consumer; -public class HoundEntity extends PathAwareEntity implements IAnimatable { - private static final TrackedData CURRENT_ANIMATION = - DataTracker.registerData(HoundEntity.class, TrackedDataHandlerRegistry.INTEGER); - private static final TrackedData> AI_TASK = - DataTracker.registerData(HoundEntity.class, TrackedDataHandlerRegistry.OPTIONAL_TEXT_COMPONENT); +public class HoundEntity extends PathAwareEntity implements GeoAnimatable { + private static final TrackedData CURRENT_ANIMATION = DataTracker.registerData(HoundEntity.class, + TrackedDataHandlerRegistry.INTEGER); + private static final TrackedData> AI_TASK = DataTracker.registerData(HoundEntity.class, + TrackedDataHandlerRegistry.OPTIONAL_TEXT_COMPONENT); - private final AnimationFactory factory = new AnimationFactory(this); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); public final long uniqueId; public HoundEntity(EntityType entityType, World world) { @@ -50,7 +54,7 @@ public HoundEntity(EntityType entityType, World world) { @Override public void onDeath(DamageSource source) { - LibAI.removeEntity(this.world, uniqueId); + LibAI.removeEntity(this.getWorld(), uniqueId); super.onDeath(source); } @@ -93,10 +97,11 @@ public void setAiTask(@NotNull Text text) { public Text getName() { MutableText firstName = super.getName().copy(); - if(BackroomsConfig.getInstance().aiDebug) { + if (BackroomsConfig.getInstance().aiDebug) { Text aiTask = this.getAiTask(); firstName.append("; "); - if (aiTask != null) firstName.append(aiTask); + if (aiTask != null) + firstName.append(aiTask); return firstName; } return firstName; @@ -111,17 +116,15 @@ public void setAnimationCallback(ServerAnimationCallback callback, long millisec SACallbackManager.addNewCallback(callback, milliseconds); } - private PlayState predicate(AnimationEvent event) { - AnimationEnum.values()[this.getAnimation()] - .animation.accept(event); + private PlayState predicate(AnimationState event) { + AnimationEnum.values()[this.getAnimation()].animation.accept(event); return PlayState.CONTINUE; } @Override - public void registerControllers(AnimationData animationData) { - var controller = new AnimationController<>(this, "controller", 2, this::predicate); - animationData.addAnimationController(controller); + public void registerControllers(ControllerRegistrar controllers) { + controllers.add(new AnimationController<>(this, "controller", 2, this::predicate)); } @Override @@ -140,35 +143,47 @@ protected SoundEvent getAmbientSound() { } @Override - public AnimationFactory getFactory() { - return this.factory; + public boolean isInvulnerableTo(DamageSource damageSource) { + if (damageSource.isOf(DamageTypes.HOT_FLOOR)) { + return true; + } + return super.isInvulnerableTo(damageSource); } @Override public boolean damage(DamageSource source, float amount) { - if (source == DamageSource.HOT_FLOOR) { + if (isInvulnerableTo(source)) { return false; } return super.damage(source, amount); } - - public enum AnimationEnum { + public static enum AnimationEnum { IDLING((event) -> event.getController().setAnimation( - new AnimationBuilder().addAnimation("animation.hound.idle", true))), + RawAnimation.begin().thenPlay("animation.hound.idle"))), WALKING((event) -> event.getController().setAnimation( - new AnimationBuilder().addAnimation("animation.hound.walk", true))), + RawAnimation.begin().thenPlay("animation.hound.walk"))), RUNNING((event) -> event.getController().setAnimation( - new AnimationBuilder().addAnimation("animation.hound.run", true))), + RawAnimation.begin().thenPlay("animation.hound.run"))), ATTACKING((event) -> event.getController().setAnimation( - new AnimationBuilder().addAnimation("animation.hound.attack", false))), + RawAnimation.begin().thenPlay("animation.hound.attack"))), LOOKING((event) -> event.getController().setAnimation( - new AnimationBuilder().addAnimation("animation.hound.look", false))); + RawAnimation.begin().thenPlay("animation.hound.look"))); - private final Consumer> animation; - AnimationEnum(Consumer> animation) { + private final Consumer> animation; + + AnimationEnum(Consumer> animation) { this.animation = animation; } } -} + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } + + @Override + public double getTick(Object object) { + return RenderUtils.getCurrentTick(); + } +} diff --git a/src/main/java/com/kpabr/backrooms/entity/HoundEntityTasks.java b/src/main/java/com/kpabr/backrooms/entity/HoundEntityTasks.java index 95976b1..1beba47 100644 --- a/src/main/java/com/kpabr/backrooms/entity/HoundEntityTasks.java +++ b/src/main/java/com/kpabr/backrooms/entity/HoundEntityTasks.java @@ -5,7 +5,7 @@ import net.minecraft.entity.ai.FuzzyTargeting; import net.minecraft.entity.ai.TargetPredicate; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import net.minecraft.util.math.Vec3d; import org.jetbrains.annotations.NotNull; @@ -18,6 +18,7 @@ public final class HoundEntityTasks { private static final double SPEED_WHEN_FOLLOWING_PER_SECOND = 2.8d; private static final double SPEED_WHEN_PLAYER_HID_PER_SECOND = 1.0d; private static final long ATTACK_ANIMATION_LENGTH_IN_MS = 480; + /** * All information about all entities tasks presented in dev channel */ @@ -26,44 +27,42 @@ static final class IdleTask extends SingleTask { public IdleTask(HoundEntity owner) { super(owner); - this.owner.setAiTask(new LiteralText("Idling:Nothing")); + this.owner.setAiTask(Text.literal("Idling:Nothing")); } @Override public void tick() { - if(this.owner.getTarget() == null && isPlayerFound()) return; + if (this.owner.getTarget() == null && isPlayerFound()) + return; - if (canCreateNewPathWhenIdling()) - { + if (canCreateNewPathWhenIdling()) { final Vec3d randomPath = FuzzyTargeting.find(this.owner, 15, 4); - if(randomPath != null && this.owner.getNavigation().startMovingTo( - randomPath.x, randomPath.y, randomPath.z, SPEED_WHEN_IDLING_PER_SECOND)) - { + if (randomPath != null && this.owner.getNavigation().startMovingTo( + randomPath.x, randomPath.y, randomPath.z, SPEED_WHEN_IDLING_PER_SECOND)) { this.owner.setAnimation(AnimationEnum.WALKING); - this.owner.setAiTask(new LiteralText("Idling:Moving")); - } - else - { + this.owner.setAiTask(Text.literal("Idling:Moving")); + } else { this.owner.setAnimation(AnimationEnum.IDLING); - this.owner.setAiTask(new LiteralText("Idling:Idling")); + this.owner.setAiTask(Text.literal("Idling:Idling")); } } } private boolean isPlayerFound() { - final var player = this.owner.world.getClosestPlayer( + final var player = this.owner.getWorld().getClosestPlayer( TargetPredicate.createAttackable().setBaseMaxDistance(20.0F).setPredicate(null), this.owner, this.owner.getX(), this.owner.getEyeY(), this.owner.getZ()); if (player != null && this.owner.canSee(player) && !player.isCreative() && !player.isSpectator()) { // I messed up something in the check, and it didn't work lol - //if (Math.abs(MathUtil.getYawBetweenEntities(this.owner, player) - this.owner.getYaw()) <= 180) { + // if (Math.abs(MathUtil.getYawBetweenEntities(this.owner, player) - + // this.owner.getYaw()) <= 180) { this.controller.popState(); this.controller.pushState(new AttackingTask(this.owner, player)); this.owner.getNavigation().stop(); return true; - //} + // } } return false; } @@ -85,15 +84,15 @@ public AttackingTask(HoundEntity owner, @NotNull PlayerEntity targetPlayer) { this.targetPlayer = Objects.requireNonNull(targetPlayer, "targetPlayer parameter must be not null!"); this.cooldown = 0; - this.owner.setAiTask(new LiteralText("Attacking:Nothing")); + this.owner.setAiTask(Text.literal("Attacking:Nothing")); } @Override public void tick() { - if(this.cooldown > 0) --this.cooldown; + if (this.cooldown > 0) + --this.cooldown; - if(!isPlayerTargetable(targetPlayer)) - { + if (!isPlayerTargetable(targetPlayer)) { this.owner.getNavigation().stop(); this.owner.setAnimation(AnimationEnum.IDLING); this.controller.popState(); @@ -102,28 +101,24 @@ public void tick() { final boolean cannotSeePlayer = !this.owner.canSee(targetPlayer); - if(cannotSeePlayer) - { + if (cannotSeePlayer) { this.controller.popState(); this.owner.getNavigation().stop(); - if(this.owner.getNavigation().startMovingTo(this.targetPlayer, SPEED_WHEN_PLAYER_HID_PER_SECOND)) - { + if (this.owner.getNavigation().startMovingTo(this.targetPlayer, SPEED_WHEN_PLAYER_HID_PER_SECOND)) { this.controller.pushState(new SearchingPlayerTask(owner, targetPlayer)); } return; } - if(!isAttackAnimationInProgress()) { - if(cooldown == 0 && this.owner.squaredDistanceTo(this.targetPlayer) <= getSquaredMaxAttackDistance()) - { + if (!isAttackAnimationInProgress()) { + if (cooldown == 0 && this.owner.squaredDistanceTo(this.targetPlayer) <= getSquaredMaxAttackDistance()) { attackPlayer(); return; } - if(this.owner.getNavigation().startMovingTo(this.targetPlayer, SPEED_WHEN_FOLLOWING_PER_SECOND)) - { + if (this.owner.getNavigation().startMovingTo(this.targetPlayer, SPEED_WHEN_FOLLOWING_PER_SECOND)) { this.owner.setAnimation(AnimationEnum.RUNNING); - this.owner.setAiTask(new LiteralText("Attacking:Running")); + this.owner.setAiTask(Text.literal("Attacking:Running")); } } } @@ -131,15 +126,18 @@ public void tick() { private float getSquaredMaxAttackDistance() { return this.owner.getWidth() * 2.0F * this.owner.getWidth() * 2.0F + this.targetPlayer.getWidth(); } + private static boolean isPlayerTargetable(PlayerEntity player) { return player.isAlive() && !player.isSpectator() && !player.isCreative(); } + private boolean isAttackAnimationInProgress() { return this.owner.getAnimation() == AnimationEnum.ATTACKING.ordinal(); } + private void attackPlayer() { - if(this.owner.tryAttack(this.targetPlayer)) { - this.owner.setAiTask(new LiteralText("Attacking:Attacking")); + if (this.owner.tryAttack(this.targetPlayer)) { + this.owner.setAiTask(Text.literal("Attacking:Attacking")); this.owner.playSound( BackroomsSounds.HOUND_ATTACK, 1.0f, @@ -166,7 +164,7 @@ static final class SearchingPlayerTask extends SingleTask { public SearchingPlayerTask(HoundEntity owner, PlayerEntity targetPlayer) { super(owner); this.targetPlayer = targetPlayer; - this.owner.setAiTask(new LiteralText("Searching")); + this.owner.setAiTask(Text.literal("Searching")); } @Override @@ -175,10 +173,10 @@ public void tick() { this.controller.popState(); this.controller.pushState(new AttackingTask(this.owner, this.targetPlayer)); } else if (this.owner.getNavigation().isIdle()) { - if(this.isAnimationDone) { + if (this.isAnimationDone) { this.controller.popState(); } else { - this.owner.setAiTask(new LiteralText("Searching:Looking")); + this.owner.setAiTask(Text.literal("Searching:Looking")); this.owner.setAnimation(AnimationEnum.LOOKING); this.owner.setAnimationCallback( diff --git a/src/main/java/com/kpabr/backrooms/entity/WretchEntity.java b/src/main/java/com/kpabr/backrooms/entity/WretchEntity.java index 930534c..2a5ef81 100644 --- a/src/main/java/com/kpabr/backrooms/entity/WretchEntity.java +++ b/src/main/java/com/kpabr/backrooms/entity/WretchEntity.java @@ -8,6 +8,7 @@ import net.minecraft.entity.attribute.DefaultAttributeContainer; import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.damage.DamageTypes; import net.minecraft.entity.data.DataTracker; import net.minecraft.entity.data.TrackedData; import net.minecraft.entity.data.TrackedDataHandlerRegistry; @@ -18,24 +19,27 @@ import net.minecraft.world.World; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Range; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; + +import software.bernie.geckolib.core.animatable.GeoAnimatable; +import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; +import software.bernie.geckolib.core.animation.AnimatableManager.ControllerRegistrar; +import software.bernie.geckolib.core.animation.AnimationController; +import software.bernie.geckolib.core.animation.AnimationState; +import software.bernie.geckolib.core.animation.RawAnimation; +import software.bernie.geckolib.core.object.PlayState; +import software.bernie.geckolib.util.GeckoLibUtil; +import software.bernie.geckolib.util.RenderUtils; import java.util.Optional; import java.util.function.Consumer; -public final class WretchEntity extends PathAwareEntity implements IAnimatable { - private static final TrackedData CURRENT_ANIMATION = - DataTracker.registerData(WretchEntity.class, TrackedDataHandlerRegistry.INTEGER); - private static final TrackedData> AI_TASK = - DataTracker.registerData(WretchEntity.class, TrackedDataHandlerRegistry.OPTIONAL_TEXT_COMPONENT); +public final class WretchEntity extends PathAwareEntity implements GeoAnimatable { + private static final TrackedData CURRENT_ANIMATION = DataTracker.registerData(WretchEntity.class, + TrackedDataHandlerRegistry.INTEGER); + private static final TrackedData> AI_TASK = DataTracker.registerData(WretchEntity.class, + TrackedDataHandlerRegistry.OPTIONAL_TEXT_COMPONENT); - private final AnimationFactory factory = new AnimationFactory(this); + private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); public final long uniqueId; public WretchEntity(EntityType entityType, World world) { @@ -47,7 +51,7 @@ public WretchEntity(EntityType entityType, World world) { @Override public void onDeath(DamageSource source) { - LibAI.removeEntity(this.world, uniqueId); + LibAI.removeEntity(this.getWorld(), uniqueId); super.onDeath(source); } @@ -92,10 +96,11 @@ public void setAiTask(@NotNull Text text) { public Text getName() { MutableText firstName = super.getName().copy(); - if(BackroomsConfig.getInstance().aiDebug) { + if (BackroomsConfig.getInstance().aiDebug) { Text aiTask = this.getAiTask(); firstName.append("; "); - if (aiTask != null) firstName.append(aiTask); + if (aiTask != null) + firstName.append(aiTask); return firstName; } return firstName; @@ -110,50 +115,62 @@ public void setAnimationCallback(ServerAnimationCallback callback, long millisec SACallbackManager.addNewCallback(callback, milliseconds); } - private PlayState predicate(AnimationEvent event) { - AnimationEnum.values()[this.getAnimation()] - .animation.accept(event); + private PlayState predicate(AnimationState event) { + AnimationEnum.values()[this.getAnimation()].animation.accept(event); return PlayState.CONTINUE; } @Override - public void registerControllers(AnimationData animationData) { - var controller = new AnimationController<>(this, "controller", 2, this::predicate); - animationData.addAnimationController(controller); + public void registerControllers(ControllerRegistrar controllers) { + controllers.add(new AnimationController<>(this, "controller", 2, this::predicate)); } @Override - public AnimationFactory getFactory() { - return this.factory; + public boolean isInvulnerableTo(DamageSource damageSource) { + if (damageSource.isOf(DamageTypes.HOT_FLOOR)) { + return true; + } + return super.isInvulnerableTo(damageSource); } @Override public boolean damage(DamageSource source, float amount) { - if (source == DamageSource.HOT_FLOOR) { + if (isInvulnerableTo(source)) { return false; } return super.damage(source, amount); } - public enum AnimationEnum { IDLING((event) -> event.getController().setAnimation( - new AnimationBuilder().addAnimation("animation.wretch.idle", true))), + RawAnimation.begin().thenPlay("animation.wretch.idle"))), MOVING((event) -> event.getController().setAnimation( - new AnimationBuilder().addAnimation("animation.wretch.walk", true))), + RawAnimation.begin().thenPlay("animation.wretch.walk"))), ATTACKING((event) -> event.getController().setAnimation( - new AnimationBuilder().addAnimation("animation.wretch.attack", false))), + RawAnimation.begin().thenPlay("animation.wretch.attack"))), SEARCHING((event) -> event.getController().setAnimation( - new AnimationBuilder().addAnimation("animation.wretch.search", false))), - NONE((event) -> {}); + RawAnimation.begin().thenPlay("animation.wretch.search"))), + NONE((event) -> { + }); - private final Consumer> animation; - AnimationEnum(Consumer> animation) { + private final Consumer> animation; + + AnimationEnum(Consumer> animation) { this.animation = animation; } } + + @Override + public AnimatableInstanceCache getAnimatableInstanceCache() { + return cache; + } + + @Override + public double getTick(Object object) { + return RenderUtils.getCurrentTick(); + } } diff --git a/src/main/java/com/kpabr/backrooms/entity/WretchEntityTasks.java b/src/main/java/com/kpabr/backrooms/entity/WretchEntityTasks.java index 25d3d66..76cb9e1 100644 --- a/src/main/java/com/kpabr/backrooms/entity/WretchEntityTasks.java +++ b/src/main/java/com/kpabr/backrooms/entity/WretchEntityTasks.java @@ -4,7 +4,7 @@ import net.minecraft.entity.ai.FuzzyTargeting; import net.minecraft.entity.ai.TargetPredicate; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import net.minecraft.util.math.Vec3d; import org.jetbrains.annotations.NotNull; @@ -26,44 +26,42 @@ static final class IdleTask extends SingleTask { public IdleTask(WretchEntity owner) { super(owner); - this.owner.setAiTask(new LiteralText("Idling:Nothing")); + this.owner.setAiTask(Text.literal("Idling:Nothing")); } @Override public void tick() { - if(this.owner.getTarget() == null && isPlayerFound()) return; + if (this.owner.getTarget() == null && isPlayerFound()) + return; - if (canCreateNewPathWhenIdling()) - { + if (canCreateNewPathWhenIdling()) { final Vec3d randomPath = FuzzyTargeting.find(this.owner, 15, 4); - if(randomPath != null && this.owner.getNavigation().startMovingTo( - randomPath.x, randomPath.y, randomPath.z, SPEED_WHEN_IDLING_PER_SECOND)) - { + if (randomPath != null && this.owner.getNavigation().startMovingTo( + randomPath.x, randomPath.y, randomPath.z, SPEED_WHEN_IDLING_PER_SECOND)) { this.owner.setAnimation(AnimationEnum.MOVING); - this.owner.setAiTask(new LiteralText("Idling:Moving")); - } - else - { + this.owner.setAiTask(Text.literal("Idling:Moving")); + } else { this.owner.setAnimation(AnimationEnum.IDLING); - this.owner.setAiTask(new LiteralText("Idling:Idling")); + this.owner.setAiTask(Text.literal("Idling:Idling")); } } } private boolean isPlayerFound() { - final var player = this.owner.world.getClosestPlayer( + final var player = this.owner.getWorld().getClosestPlayer( TargetPredicate.createAttackable().setBaseMaxDistance(20.0F).setPredicate(null), this.owner, this.owner.getX(), this.owner.getEyeY(), this.owner.getZ()); if (player != null && this.owner.canSee(player) && !player.isCreative() && !player.isSpectator()) { // I messed up something in the check, and it didn't work lol - //if (Math.abs(MathUtil.getYawBetweenEntities(this.owner, player) - this.owner.getYaw()) <= 180) { - this.controller.popState(); - this.controller.pushState(new AttackingTask(this.owner, player)); - this.owner.getNavigation().stop(); - return true; - //} + // if (Math.abs(MathUtil.getYawBetweenEntities(this.owner, player) - + // this.owner.getYaw()) <= 180) { + this.controller.popState(); + this.controller.pushState(new AttackingTask(this.owner, player)); + this.owner.getNavigation().stop(); + return true; + // } } return false; } @@ -82,18 +80,19 @@ static final class AttackingTask extends SingleTask { public AttackingTask(WretchEntity owner, @NotNull PlayerEntity targetPlayer) { super(owner); - this.targetPlayer = Objects.requireNonNull(targetPlayer, "targetPlayer parameter must be not null!");; + this.targetPlayer = Objects.requireNonNull(targetPlayer, "targetPlayer parameter must be not null!"); + ; this.cooldown = 0; - owner.setAiTask(new LiteralText("Attacking:Nothing")); + owner.setAiTask(Text.literal("Attacking:Nothing")); } @Override public void tick() { - if(this.cooldown > 0) --this.cooldown; + if (this.cooldown > 0) + --this.cooldown; - if(!isPlayerTargetable(targetPlayer)) - { + if (!isPlayerTargetable(targetPlayer)) { this.owner.getNavigation().stop(); this.owner.setAnimation(AnimationEnum.IDLING); @@ -103,28 +102,24 @@ public void tick() { final boolean cannotSeePlayer = !this.owner.canSee(targetPlayer); - if(cannotSeePlayer) - { + if (cannotSeePlayer) { this.controller.popState(); this.owner.getNavigation().stop(); - if(this.owner.getNavigation().startMovingTo(this.targetPlayer, SPEED_WHEN_PLAYER_HID_PER_SECOND)) - { + if (this.owner.getNavigation().startMovingTo(this.targetPlayer, SPEED_WHEN_PLAYER_HID_PER_SECOND)) { this.controller.pushState(new SearchingPlayerTask(owner, targetPlayer)); } return; } - if(!isAttackAnimationInProgress()) { - if(cooldown == 0 && this.owner.squaredDistanceTo(this.targetPlayer) <= getSquaredMaxAttackDistance()) - { + if (!isAttackAnimationInProgress()) { + if (cooldown == 0 && this.owner.squaredDistanceTo(this.targetPlayer) <= getSquaredMaxAttackDistance()) { attackPlayer(); return; } - if(this.owner.getNavigation().startMovingTo(this.targetPlayer, SPEED_WHEN_FOLLOWING_PER_SECOND)) - { + if (this.owner.getNavigation().startMovingTo(this.targetPlayer, SPEED_WHEN_FOLLOWING_PER_SECOND)) { this.owner.setAnimation(AnimationEnum.MOVING); - this.owner.setAiTask(new LiteralText("Attacking:Moving")); + this.owner.setAiTask(Text.literal("Attacking:Moving")); } } } @@ -132,15 +127,18 @@ public void tick() { private float getSquaredMaxAttackDistance() { return this.owner.getWidth() * 2.0F * this.owner.getWidth() * 2.0F + this.targetPlayer.getWidth(); } + private static boolean isPlayerTargetable(PlayerEntity player) { return player.isAlive() && !player.isSpectator() && !player.isCreative(); } + private boolean isAttackAnimationInProgress() { return this.owner.getAnimation() == AnimationEnum.ATTACKING.ordinal(); } + private void attackPlayer() { - if(this.owner.tryAttack(this.targetPlayer)) { - this.owner.setAiTask(new LiteralText("Attacking:Attacking")); + if (this.owner.tryAttack(this.targetPlayer)) { + this.owner.setAiTask(Text.literal("Attacking:Attacking")); this.owner.setAnimation(AnimationEnum.ATTACKING); this.owner.setAnimationCallback( @@ -161,7 +159,7 @@ static final class SearchingPlayerTask extends SingleTask { public SearchingPlayerTask(WretchEntity owner, PlayerEntity targetPlayer) { super(owner); this.targetPlayer = targetPlayer; - owner.setAiTask(new LiteralText("Searching player")); + owner.setAiTask(Text.literal("Searching player")); } @Override diff --git a/src/main/java/com/kpabr/backrooms/fluid/AlmondWaterFluid.java b/src/main/java/com/kpabr/backrooms/fluid/AlmondWaterFluid.java index 84308ef..3530d44 100644 --- a/src/main/java/com/kpabr/backrooms/fluid/AlmondWaterFluid.java +++ b/src/main/java/com/kpabr/backrooms/fluid/AlmondWaterFluid.java @@ -9,6 +9,7 @@ import net.minecraft.item.Item; import net.minecraft.state.StateManager; import net.minecraft.state.property.Properties; +import net.minecraft.world.World; public abstract class AlmondWaterFluid extends DefaultFluid { @@ -48,6 +49,11 @@ public int getLevel(FluidState fluidState) { public boolean isStill(FluidState fluidState) { return false; } + + @Override + protected boolean isInfinite(World world) { + return false; + } } public static class Still extends AlmondWaterFluid { @@ -60,5 +66,10 @@ public int getLevel(FluidState state) { public boolean isStill(FluidState state) { return true; } + + @Override + protected boolean isInfinite(World world) { + return false; + } } } \ No newline at end of file diff --git a/src/main/java/com/kpabr/backrooms/fluid/DefaultFluid.java b/src/main/java/com/kpabr/backrooms/fluid/DefaultFluid.java index 0986771..dc8a689 100644 --- a/src/main/java/com/kpabr/backrooms/fluid/DefaultFluid.java +++ b/src/main/java/com/kpabr/backrooms/fluid/DefaultFluid.java @@ -23,10 +23,6 @@ public abstract class DefaultFluid extends FlowableFluid { public boolean matchesType(Fluid fluid) { return fluid == getStill() || fluid == getFlowing(); } - @Override - protected boolean isInfinite() { - return false; - } /** * Perform actions when the fluid flows into a replaceable block. Water drops @@ -39,7 +35,8 @@ protected void beforeBreakingBlock(WorldAccess world, BlockPos pos, BlockState s } @Override - protected boolean canBeReplacedWith(FluidState fluidState, BlockView blockView, BlockPos blockPos, Fluid fluid, Direction direction) { + protected boolean canBeReplacedWith(FluidState fluidState, BlockView blockView, BlockPos blockPos, Fluid fluid, + Direction direction) { return false; } diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomStatusEffects.java b/src/main/java/com/kpabr/backrooms/init/BackroomStatusEffects.java index d7e1090..025bd38 100644 --- a/src/main/java/com/kpabr/backrooms/init/BackroomStatusEffects.java +++ b/src/main/java/com/kpabr/backrooms/init/BackroomStatusEffects.java @@ -5,7 +5,8 @@ import com.kpabr.backrooms.effect.RottenStatusEffect; import com.kpabr.backrooms.effect.WretchedStatusEffect; import net.minecraft.entity.effect.StatusEffect; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; public class BackroomStatusEffects { public static final StatusEffect RAGGED = new RaggedStatusEffect(); @@ -13,8 +14,8 @@ public class BackroomStatusEffects { public static final StatusEffect WRETCHED = new WretchedStatusEffect(); public static void init() { - Registry.register(Registry.STATUS_EFFECT, BackroomsMod.id("ragged"), RAGGED); - Registry.register(Registry.STATUS_EFFECT, BackroomsMod.id("rotten"), ROTTEN); - Registry.register(Registry.STATUS_EFFECT, BackroomsMod.id("wretched"), WRETCHED); + Registry.register(Registries.STATUS_EFFECT, BackroomsMod.id("ragged"), RAGGED); + Registry.register(Registries.STATUS_EFFECT, BackroomsMod.id("rotten"), ROTTEN); + Registry.register(Registries.STATUS_EFFECT, BackroomsMod.id("wretched"), WRETCHED); } } diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsBlocks.java b/src/main/java/com/kpabr/backrooms/init/BackroomsBlocks.java index f485914..13a17f4 100644 --- a/src/main/java/com/kpabr/backrooms/init/BackroomsBlocks.java +++ b/src/main/java/com/kpabr/backrooms/init/BackroomsBlocks.java @@ -1,8 +1,14 @@ package com.kpabr.backrooms.init; import java.util.ArrayList; +import java.util.HashMap; + +import org.spongepowered.asm.mixin.injection.struct.InjectorGroupInfo.Map; import com.kpabr.backrooms.block.entity.MaskBlockEntity; + +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; @@ -21,154 +27,309 @@ import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; +import net.minecraft.item.ItemGroups; import net.minecraft.sound.BlockSoundGroup; import net.minecraft.util.DyeColor; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; @SuppressWarnings("unused") public class BackroomsBlocks { + private static HashMap, ArrayList> GROUPED_ITEMS = new HashMap, ArrayList>(); + public static ArrayList ITEMS = new ArrayList<>(); private static final ArrayList BLOCK_ENTITIES = new ArrayList<>(); private static final ArrayList BLOCKS = new ArrayList<>(); - public static final Block CORK_TILE = add("cork_tile", new TileBlock(FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.WHITE)), ItemGroup.BUILDING_BLOCKS); - public static final Block MOLDY_CORK_TILE = add("moldy_cork_tile", new MoldyTileBlock(FabricBlockSettings.copyOf(Blocks.BUDDING_AMETHYST).mapColor(DyeColor.WHITE).sounds(BlockSoundGroup.TUFF)), ItemGroup.BUILDING_BLOCKS); - public static final Block TILEMOLD = add("tilemold", new TilemoldBlock(FabricBlockSettings.copyOf(Blocks.AMETHYST_CLUSTER).mapColor(DyeColor.BROWN).strength(0F).noCollision().sounds(BlockSoundGroup.SMALL_DRIPLEAF)), ItemGroup.BUILDING_BLOCKS); - public static final Block FAKE_CEILING = add("fake_ceiling", new TileBlock(FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.WHITE).noCollision().sounds(BlockSoundGroup.SMALL_DRIPLEAF)), ItemGroup.BUILDING_BLOCKS); - public static final Block FLUORESCENT_LIGHT = add("fluorescent_light", new FluorescentLightBlock(FabricBlockSettings.copyOf(Blocks.REDSTONE_LAMP).ticksRandomly().requiresTool().mapColor(DyeColor.WHITE)), ItemGroup.BUILDING_BLOCKS); - public static final Block REPAIRED_FLUORESCENT_LIGHT = add("repaired_fluorescent_light", new RepairedFluorescentLightBlock(FabricBlockSettings.copyOf(Blocks.REDSTONE_LAMP).requiresTool().mapColor(DyeColor.WHITE)), ItemGroup.BUILDING_BLOCKS); - public static final Block PATTERNED_WALLPAPER = add("patterned_wallpaper", new WallpaperBlock(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).mapColor(DyeColor.YELLOW)), ItemGroup.BUILDING_BLOCKS); - public static final Block FAKE_WALL = add("fake_wall", new Block(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).mapColor(DyeColor.YELLOW).noCollision()), ItemGroup.BUILDING_BLOCKS); - public static final Block STRIPED_WALLPAPER = add("striped_wallpaper", new WallpaperBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER)), ItemGroup.BUILDING_BLOCKS); - public static final Block DOTTED_WALLPAPER = add("dotted_wallpaper", new WallpaperBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER)), ItemGroup.BUILDING_BLOCKS); - public static final Block BLANK_WALLPAPER = add("blank_wallpaper", new WallpaperBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER)), ItemGroup.BUILDING_BLOCKS); - public static final Block WOOLEN_CARPET = add("moist_carpet", new Block(FabricBlockSettings.copyOf(Blocks.WHITE_WOOL).mapColor(DyeColor.YELLOW)), ItemGroup.BUILDING_BLOCKS); - public static final Block FAKE_CARPET = add("fake_carpet", new Block(FabricBlockSettings.copyOf(Blocks.WHITE_WOOL).mapColor(DyeColor.YELLOW).noCollision()), ItemGroup.BUILDING_BLOCKS); - public static final Block MOLDY_WOOLEN_CARPET = add("moldy_carpet", new Block(FabricBlockSettings.copyOf(WOOLEN_CARPET)), ItemGroup.BUILDING_BLOCKS); + public static final Block CORK_TILE = add("cork_tile", + new TileBlock(FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.WHITE)), + ItemGroups.BUILDING_BLOCKS); + + public static final Block MOLDY_CORK_TILE = add("moldy_cork_tile", new MoldyTileBlock( + FabricBlockSettings.copyOf(Blocks.BUDDING_AMETHYST).mapColor(DyeColor.WHITE).sounds(BlockSoundGroup.TUFF)), + ItemGroups.BUILDING_BLOCKS); + + public static final Block TILEMOLD = add("tilemold", + new TilemoldBlock(FabricBlockSettings.copyOf(Blocks.AMETHYST_CLUSTER).mapColor(DyeColor.BROWN).strength(0F) + .noCollision().sounds(BlockSoundGroup.SMALL_DRIPLEAF)), + ItemGroups.NATURAL); + + public static final Block FAKE_CEILING = add("fake_ceiling", new TileBlock(FabricBlockSettings.copyOf(Blocks.STONE) + .mapColor(DyeColor.WHITE).noCollision().sounds(BlockSoundGroup.SMALL_DRIPLEAF)), + ItemGroups.BUILDING_BLOCKS); + + public static final Block FLUORESCENT_LIGHT = add("fluorescent_light", new FluorescentLightBlock( + FabricBlockSettings.copyOf(Blocks.REDSTONE_LAMP).ticksRandomly().requiresTool().mapColor(DyeColor.WHITE)), + ItemGroups.FUNCTIONAL); + + public static final Block REPAIRED_FLUORESCENT_LIGHT = add("repaired_fluorescent_light", + new RepairedFluorescentLightBlock( + FabricBlockSettings.copyOf(Blocks.REDSTONE_LAMP).requiresTool().mapColor(DyeColor.WHITE)), + ItemGroups.FUNCTIONAL); + + public static final Block PATTERNED_WALLPAPER = add("patterned_wallpaper", + new WallpaperBlock(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).mapColor(DyeColor.YELLOW)), + ItemGroups.BUILDING_BLOCKS); + + public static final Block FAKE_WALL = add("fake_wall", + new Block(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).mapColor(DyeColor.YELLOW).noCollision()), + ItemGroups.BUILDING_BLOCKS); + public static final Block STRIPED_WALLPAPER = add("striped_wallpaper", + new WallpaperBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER)), ItemGroups.BUILDING_BLOCKS); + + public static final Block DOTTED_WALLPAPER = add("dotted_wallpaper", + new WallpaperBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER)), ItemGroups.BUILDING_BLOCKS); + + public static final Block BLANK_WALLPAPER = add("blank_wallpaper", + new WallpaperBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER)), ItemGroups.BUILDING_BLOCKS); + + public static final Block WOOLEN_CARPET = add("moist_carpet", + new Block(FabricBlockSettings.copyOf(Blocks.WHITE_WOOL).mapColor(DyeColor.YELLOW)), + ItemGroups.BUILDING_BLOCKS); + + public static final Block FAKE_CARPET = add("fake_carpet", + new Block(FabricBlockSettings.copyOf(Blocks.WHITE_WOOL).mapColor(DyeColor.YELLOW).noCollision()), + ItemGroups.BUILDING_BLOCKS); + + public static final Block MOLDY_WOOLEN_CARPET = add("moldy_carpet", + new Block(FabricBlockSettings.copyOf(WOOLEN_CARPET)), ItemGroups.BUILDING_BLOCKS); + + // Cement public static final Block CEMENT = add("cement", - new Block(FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.GRAY).sounds(BlockSoundGroup.TUFF)), ItemGroup.BUILDING_BLOCKS); + new Block(FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.GRAY).sounds(BlockSoundGroup.TUFF)), + ItemGroups.BUILDING_BLOCKS); + public static final Block CEMENT_SLAB = add("cement_slab", - new SlabBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new SlabBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroups.BUILDING_BLOCKS); + public static final Block CEMENT_STAIRS = add("cement_stairs", - new BackroomsStairsBlock(CEMENT.getDefaultState(),FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new BackroomsStairsBlock(CEMENT.getDefaultState(), FabricBlockSettings.copyOf(CEMENT)), + ItemGroups.BUILDING_BLOCKS); + public static final Block CEMENT_WALL = add("cement_wall", - new WallBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new WallBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroups.BUILDING_BLOCKS); + public static final Block CUT_CEMENT = add("cut_cement", - new Block(FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new Block(FabricBlockSettings.copyOf(CEMENT)), ItemGroups.BUILDING_BLOCKS); + public static final Block CUT_CEMENT_SLAB = add("cut_cement_slab", - new SlabBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new SlabBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroups.BUILDING_BLOCKS); + public static final Block CUT_CEMENT_STAIRS = add("cut_cement_stairs", - new BackroomsStairsBlock(CEMENT.getDefaultState(),FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new BackroomsStairsBlock(CEMENT.getDefaultState(), FabricBlockSettings.copyOf(CEMENT)), + ItemGroups.BUILDING_BLOCKS); + public static final Block CUT_CEMENT_WALL = add("cut_cement_wall", - new WallBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new WallBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroups.BUILDING_BLOCKS); + public static final Block CEMENT_BRICKS = add("cement_bricks", - new Block(FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new Block(FabricBlockSettings.copyOf(CEMENT)), ItemGroups.BUILDING_BLOCKS); + public static final Block CEMENT_BRICK_SLAB = add("cement_brick_slab", - new SlabBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new SlabBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroups.BUILDING_BLOCKS); + public static final Block CEMENT_BRICK_STAIRS = add("cement_brick_stairs", - new BackroomsStairsBlock(CEMENT.getDefaultState(),FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new BackroomsStairsBlock(CEMENT.getDefaultState(), FabricBlockSettings.copyOf(CEMENT)), + ItemGroups.BUILDING_BLOCKS); + public static final Block CEMENT_BRICK_WALL = add("cement_brick_wall", - new WallBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new WallBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroups.BUILDING_BLOCKS); + public static final Block CEMENT_TILES = add("cement_tiles", - new Block(FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new Block(FabricBlockSettings.copyOf(CEMENT)), ItemGroups.BUILDING_BLOCKS); + public static final Block CEMENT_TILE_SLAB = add("cement_tile_slab", - new SlabBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new SlabBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroups.BUILDING_BLOCKS); + public static final Block CEMENT_TILE_STAIRS = add("cement_tile_stairs", - new BackroomsStairsBlock(CEMENT.getDefaultState(),FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new BackroomsStairsBlock(CEMENT.getDefaultState(), FabricBlockSettings.copyOf(CEMENT)), + ItemGroups.BUILDING_BLOCKS); + public static final Block CEMENT_TILE_WALL = add("cement_tile_wall", - new WallBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroup.BUILDING_BLOCKS); + new WallBlock(FabricBlockSettings.copyOf(CEMENT)), ItemGroups.BUILDING_BLOCKS); + public static final Block HOTEL_CARPET = add("hotel_carpet", - new Block(FabricBlockSettings.copyOf(Blocks.WHITE_WOOL).mapColor(DyeColor.YELLOW)), ItemGroup.BUILDING_BLOCKS); + new Block(FabricBlockSettings.copyOf(Blocks.WHITE_WOOL).mapColor(DyeColor.YELLOW)), + ItemGroups.BUILDING_BLOCKS); + public static final Block MACHINERY_BLOCK = add("machinery", - new MachineryBlock(FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.GRAY).sounds(BlockSoundGroup.TUFF)), ItemGroup.BUILDING_BLOCKS); - public static final Block ROOF_WIRING = add("roof_wiring", new RoofWiringBlock(FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.BROWN).strength(0F).noCollision().sounds(BlockSoundGroup.SMALL_DRIPLEAF).nonOpaque()), ItemGroup.BUILDING_BLOCKS); + new MachineryBlock( + FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.GRAY).sounds(BlockSoundGroup.TUFF)), + ItemGroups.BUILDING_BLOCKS); + + public static final Block ROOF_WIRING = add( + "roof_wiring", new RoofWiringBlock(FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.BROWN) + .strength(0F).noCollision().sounds(BlockSoundGroup.SMALL_DRIPLEAF).nonOpaque()), + ItemGroups.BUILDING_BLOCKS); - public static final Block CRATE = add("crate", new CrateBlock(FabricBlockSettings.copyOf(CEMENT).nonOpaque()), ItemGroup.BUILDING_BLOCKS); - public static final BlockEntityType CRATE_BLOCK_ENTITY = add("crate", FabricBlockEntityTypeBuilder.create(CrateBlockEntity::new, CRATE).build(null)); + public static final Block CRATE = add("crate", new CrateBlock(FabricBlockSettings.copyOf(CEMENT).nonOpaque()), + ItemGroups.FUNCTIONAL); + + public static final BlockEntityType CRATE_BLOCK_ENTITY = add("crate", + FabricBlockEntityTypeBuilder.create(CrateBlockEntity::new, CRATE).build(null)); public static final Block COMPUTER = add("computer", - new ComputerBlock(FabricBlockSettings.copyOf(Blocks.REDSTONE_TORCH).collidable(true).mapColor(DyeColor.YELLOW).nonOpaque()), ItemGroup.BUILDING_BLOCKS); + new ComputerBlock(FabricBlockSettings.copyOf(Blocks.REDSTONE_TORCH).collidable(true) + .mapColor(DyeColor.YELLOW).nonOpaque()), + ItemGroups.BUILDING_BLOCKS); + public static final BlockEntityType COMPUTER_BLOCK_ENTITY = add("computer", FabricBlockEntityTypeBuilder.create(ComputerBlockEntity::new, COMPUTER).build(null)); + public static final Block HARLEQUIN_MASK = addWithoutItem("harlequin_mask", - new MaskBlock(MaskType.HARLEQUIN, FabricBlockSettings.of(Material.DECORATION).strength(1.0F).nonOpaque().noCollision())); + new MaskBlock(MaskType.HARLEQUIN, FabricBlockSettings.create().strength(1.0F).nonOpaque().noCollision())); + public static final Block COLOMBINA_MASK = addWithoutItem("colombina_mask", - new MaskBlock(MaskType.COLOMBINA, FabricBlockSettings.of(Material.DECORATION).strength(1.0F).nonOpaque().noCollision())); + new MaskBlock(MaskType.COLOMBINA, FabricBlockSettings.create().strength(1.0F).nonOpaque().noCollision())); + public static final Block SOCK_BUSKIN_MASK = addWithoutItem("sock_buskin_mask", - new MaskBlock(MaskType.SOCK_BUSKIN, FabricBlockSettings.of(Material.DECORATION).strength(1.0F).nonOpaque().noCollision())); + new MaskBlock(MaskType.SOCK_BUSKIN, FabricBlockSettings.create().strength(1.0F).nonOpaque().noCollision())); + public static final BlockEntityType MASK = add("mask", FabricBlockEntityTypeBuilder - .create(MaskBlockEntity::new, HARLEQUIN_MASK, COLOMBINA_MASK, SOCK_BUSKIN_MASK) - .build(null)); + .create(MaskBlockEntity::new, HARLEQUIN_MASK, COLOMBINA_MASK, SOCK_BUSKIN_MASK) + .build(null)); + + public static final Block PYROIL = add("pyroil", - new PyroilLineBlock(FabricBlockSettings.copyOf(Blocks.REDSTONE_WIRE).nonOpaque().mapColor(DyeColor.ORANGE)), ItemGroup.BUILDING_BLOCKS); + new PyroilLineBlock(FabricBlockSettings.copyOf(Blocks.REDSTONE_WIRE).nonOpaque().mapColor(DyeColor.ORANGE)), + ItemGroups.BUILDING_BLOCKS); + public static final Block CRACKED_PIPE = add("cracked_pipe", - new CrackedPipeBlock(FabricBlockSettings.copyOf(Blocks.STONE).nonOpaque()), ItemGroup.BUILDING_BLOCKS); + new CrackedPipeBlock(FabricBlockSettings.copyOf(Blocks.STONE).nonOpaque()), ItemGroups.BUILDING_BLOCKS); public static final Block CRACKED_COPPER_PIPE = add("cracked_copper_pipe", - new CrackedPipeBlock(FabricBlockSettings.copyOf(Blocks.STONE).nonOpaque()), ItemGroup.BUILDING_BLOCKS); + new CrackedPipeBlock(FabricBlockSettings.copyOf(Blocks.STONE).nonOpaque()), ItemGroups.BUILDING_BLOCKS); public static final Block PIPE = add("pipe", - new PipeBlock(FabricBlockSettings.copyOf(Blocks.STONE).nonOpaque().mapColor(DyeColor.GRAY), CRACKED_PIPE), ItemGroup.BUILDING_BLOCKS); + new PipeBlock(FabricBlockSettings.copyOf(Blocks.STONE).nonOpaque().mapColor(DyeColor.GRAY), CRACKED_PIPE), + ItemGroups.BUILDING_BLOCKS); public static final Block COPPER_PIPE = add("copper_pipe", - new PipeBlock(FabricBlockSettings.copyOf(Blocks.STONE).nonOpaque().mapColor(DyeColor.ORANGE), CRACKED_COPPER_PIPE), ItemGroup.BUILDING_BLOCKS); + new PipeBlock(FabricBlockSettings.copyOf(Blocks.STONE).nonOpaque().mapColor(DyeColor.ORANGE), + CRACKED_COPPER_PIPE), + ItemGroups.BUILDING_BLOCKS); public static final BlockEntityType PYROIL_LINE_BLOCK_ENTITY = add("pyroil", FabricBlockEntityTypeBuilder.create(PyroilLineBlockEntity::new, PYROIL).build(null)); + public static final Block RED_PATTERNED_WALLPAPER = add("red_patterned_wallpaper", - new WallpaperBlock(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).mapColor(DyeColor.YELLOW).sounds(BlockSoundGroup.STEM)), ItemGroup.BUILDING_BLOCKS); + new WallpaperBlock(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).mapColor(DyeColor.YELLOW) + .sounds(BlockSoundGroup.STEM)), + ItemGroups.BUILDING_BLOCKS); + public static final Block RED_STRIPED_WALLPAPER = add("red_striped_wallpaper", - new WallpaperBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER).sounds(BlockSoundGroup.STEM)), ItemGroup.BUILDING_BLOCKS); - - public static final Block RED_DOTTED_WALLPAPER = add("red_dotted_wallpaper", new WallpaperBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER)), ItemGroup.BUILDING_BLOCKS); - public static final Block RED_BLANK_WALLPAPER = add("red_blank_wallpaper", new WallpaperBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER)), ItemGroup.BUILDING_BLOCKS); - - public static final Block FANCY_PILLAR = add("fancy_pillar", new PillarBlock(FabricBlockSettings.copyOf(Blocks.STONE).strength(2.0F, 8.0F).requiresTool().mapColor(DyeColor.YELLOW)), ItemGroup.BUILDING_BLOCKS); - public static final Block CEMENT_PILLAR = add("cement_pillar", new PillarBlock(FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.GRAY)), ItemGroup.BUILDING_BLOCKS); - public static final Block PARKING_CEMENT_PILLAR = add("parking_cement_pillar", new PillarBlock(FabricBlockSettings.copyOf(CEMENT_PILLAR).mapColor(DyeColor.GRAY)), ItemGroup.BUILDING_BLOCKS); - public static final Block CEMENT_SANDWICH = add("cement_sandwich", new Block(FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.YELLOW)), ItemGroup.BUILDING_BLOCKS); - public static final BlockEntityType TABLE_BLOCK_ENTITY = add("table", FabricBlockEntityTypeBuilder.create(ComputerBlockEntity::new, COMPUTER).build(null)); - public static final Block OFFICE_DOOR = add("office_door", new BackroomsDoorBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER).nonOpaque()), ItemGroup.BUILDING_BLOCKS); - public static final Block PLATE_DOOR = add("plate_door", new PlateDoor(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK).nonOpaque()), ItemGroup.BUILDING_BLOCKS); - public static final Block FIRESALT_BLOCK = add("firesalt_block", new Block(FabricBlockSettings.copyOf(Blocks.COBBLESTONE).mapColor(DyeColor.ORANGE).collidable(true).sounds(BlockSoundGroup.DRIPSTONE_BLOCK)), ItemGroup.BUILDING_BLOCKS); - public static final Block FIRESALT_CRYSTAL = add("firesalt_crystal", new FiresaltCrystalBlock(FabricBlockSettings.copyOf(Blocks.AMETHYST_CLUSTER).mapColor(DyeColor.ORANGE)), ItemGroup.BUILDING_BLOCKS); - public static final Block BEDROCK_BRICKS = add("bedrock_bricks", new Block(FabricBlockSettings.copy(Blocks.BEDROCK)), ItemGroup.BUILDING_BLOCKS); + new WallpaperBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER).sounds(BlockSoundGroup.STEM)), + ItemGroups.BUILDING_BLOCKS); + + public static final Block RED_DOTTED_WALLPAPER = add("red_dotted_wallpaper", + new WallpaperBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER)), ItemGroups.BUILDING_BLOCKS); + + public static final Block RED_BLANK_WALLPAPER = add("red_blank_wallpaper", + new WallpaperBlock(FabricBlockSettings.copyOf(PATTERNED_WALLPAPER)), ItemGroups.BUILDING_BLOCKS); + + + public static final Block FANCY_PILLAR = add("fancy_pillar", new PillarBlock( + FabricBlockSettings.copyOf(Blocks.STONE).strength(2.0F, 8.0F).requiresTool().mapColor(DyeColor.YELLOW)), + ItemGroups.BUILDING_BLOCKS); + + public static final Block CEMENT_PILLAR = add("cement_pillar", + new PillarBlock(FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.GRAY)), + ItemGroups.BUILDING_BLOCKS); + + public static final Block PARKING_CEMENT_PILLAR = add("parking_cement_pillar", + new PillarBlock(FabricBlockSettings.copyOf(CEMENT_PILLAR).mapColor(DyeColor.GRAY)), + ItemGroups.BUILDING_BLOCKS); + + public static final Block CEMENT_SANDWICH = add("cement_sandwich", + new Block(FabricBlockSettings.copyOf(Blocks.STONE).mapColor(DyeColor.YELLOW)), ItemGroups.BUILDING_BLOCKS); + + public static final BlockEntityType TABLE_BLOCK_ENTITY = add("table", + FabricBlockEntityTypeBuilder.create(ComputerBlockEntity::new, COMPUTER).build(null)); + + + public static final Block OFFICE_DOOR = add("office_door", + new BackroomsDoorBlock(FabricBlockSettings.copyOf(Blocks.DARK_OAK_DOOR).nonOpaque(), BlockSetType.DARK_OAK), + ItemGroups.BUILDING_BLOCKS); + + public static final Block PLATE_DOOR = add("plate_door", + new PlateDoor(FabricBlockSettings.copyOf(Blocks.IRON_DOOR)), ItemGroups.BUILDING_BLOCKS); + + + public static final Block FIRESALT_BLOCK = add("firesalt_block", + new Block(FabricBlockSettings.copyOf(Blocks.COBBLESTONE).mapColor(DyeColor.ORANGE).collidable(true) + .sounds(BlockSoundGroup.DRIPSTONE_BLOCK)), + ItemGroups.BUILDING_BLOCKS); + + public static final Block FIRESALT_CRYSTAL = add("firesalt_crystal", + new FiresaltCrystalBlock(FabricBlockSettings.copyOf(Blocks.AMETHYST_CLUSTER).mapColor(DyeColor.ORANGE)), + ItemGroups.BUILDING_BLOCKS); + + + public static final Block BEDROCK_BRICKS = add("bedrock_bricks", + new Block(FabricBlockSettings.copy(Blocks.BEDROCK)), ItemGroups.BUILDING_BLOCKS); + + public static final Block ALMOND_WATER = addWithoutItem("almond_water", new FluidBlock(BackroomsFluids.STILL_ALMOND_WATER, FabricBlockSettings.copyOf(Blocks.WATER))); // 16 types of various carpetings - public static final Block BLACK_CARPETING = add("black_carpeting", new CarpetingBlock(DyeColor.BLACK), ItemGroup.BUILDING_BLOCKS); - public static final Block BLUE_CARPETING = add("blue_carpeting", new CarpetingBlock(DyeColor.BLUE), ItemGroup.BUILDING_BLOCKS); - public static final Block BROWN_CARPETING = add("brown_carpeting", new CarpetingBlock(DyeColor.BROWN), ItemGroup.BUILDING_BLOCKS); - public static final Block CYAN_CARPETING = add("cyan_carpeting", new CarpetingBlock(DyeColor.CYAN), ItemGroup.BUILDING_BLOCKS); - public static final Block GRAY_CARPETING = add("gray_carpeting", new CarpetingBlock(DyeColor.GRAY), ItemGroup.BUILDING_BLOCKS); - public static final Block GREEN_CARPETING = add("green_carpeting", new CarpetingBlock(DyeColor.GREEN), ItemGroup.BUILDING_BLOCKS); - public static final Block LIGHT_BLUE_CARPETING = add("light_blue_carpeting", new CarpetingBlock(DyeColor.LIGHT_BLUE), ItemGroup.BUILDING_BLOCKS); - public static final Block LIGHT_GRAY_CARPETING = add("light_gray_carpeting", new CarpetingBlock(DyeColor.LIGHT_GRAY), ItemGroup.BUILDING_BLOCKS); - public static final Block LIME_CARPETING = add("lime_carpeting", new CarpetingBlock(DyeColor.LIME), ItemGroup.BUILDING_BLOCKS); - public static final Block MAGENTA_CARPETING = add("magenta_carpeting", new CarpetingBlock(DyeColor.MAGENTA), ItemGroup.BUILDING_BLOCKS); - public static final Block ORANGE_CARPETING = add("orange_carpeting", new CarpetingBlock(DyeColor.ORANGE), ItemGroup.BUILDING_BLOCKS); - public static final Block PINK_CARPETING = add("pink_carpeting", new CarpetingBlock(DyeColor.PINK), ItemGroup.BUILDING_BLOCKS); - public static final Block PURPLE_CARPETING = add("purple_carpeting", new CarpetingBlock(DyeColor.PURPLE), ItemGroup.BUILDING_BLOCKS); - public static final Block WHITE_CARPETING = add("white_carpeting", new CarpetingBlock(DyeColor.WHITE), ItemGroup.BUILDING_BLOCKS); - public static final Block RED_CARPETING = add("red_carpeting", new CarpetingBlock(DyeColor.RED), ItemGroup.BUILDING_BLOCKS); - public static final Block PORTAL_BLOCK = add("portal_block", new PortalBlock(), ItemGroup.BUILDING_BLOCKS); + public static final Block BLACK_CARPETING = add("black_carpeting", new CarpetingBlock(DyeColor.BLACK), + ItemGroups.BUILDING_BLOCKS); + public static final Block BLUE_CARPETING = add("blue_carpeting", new CarpetingBlock(DyeColor.BLUE), + ItemGroups.BUILDING_BLOCKS); + public static final Block BROWN_CARPETING = add("brown_carpeting", new CarpetingBlock(DyeColor.BROWN), + ItemGroups.BUILDING_BLOCKS); + public static final Block CYAN_CARPETING = add("cyan_carpeting", new CarpetingBlock(DyeColor.CYAN), + ItemGroups.BUILDING_BLOCKS); + public static final Block GRAY_CARPETING = add("gray_carpeting", new CarpetingBlock(DyeColor.GRAY), + ItemGroups.BUILDING_BLOCKS); + public static final Block GREEN_CARPETING = add("green_carpeting", new CarpetingBlock(DyeColor.GREEN), + ItemGroups.BUILDING_BLOCKS); + public static final Block LIGHT_BLUE_CARPETING = add("light_blue_carpeting", + new CarpetingBlock(DyeColor.LIGHT_BLUE), ItemGroups.BUILDING_BLOCKS); + public static final Block LIGHT_GRAY_CARPETING = add("light_gray_carpeting", + new CarpetingBlock(DyeColor.LIGHT_GRAY), ItemGroups.BUILDING_BLOCKS); + public static final Block LIME_CARPETING = add("lime_carpeting", new CarpetingBlock(DyeColor.LIME), + ItemGroups.BUILDING_BLOCKS); + public static final Block MAGENTA_CARPETING = add("magenta_carpeting", new CarpetingBlock(DyeColor.MAGENTA), + ItemGroups.BUILDING_BLOCKS); + public static final Block ORANGE_CARPETING = add("orange_carpeting", new CarpetingBlock(DyeColor.ORANGE), + ItemGroups.BUILDING_BLOCKS); + public static final Block PINK_CARPETING = add("pink_carpeting", new CarpetingBlock(DyeColor.PINK), + ItemGroups.BUILDING_BLOCKS); + public static final Block PURPLE_CARPETING = add("purple_carpeting", new CarpetingBlock(DyeColor.PURPLE), + ItemGroups.BUILDING_BLOCKS); + public static final Block WHITE_CARPETING = add("white_carpeting", new CarpetingBlock(DyeColor.WHITE), + ItemGroups.BUILDING_BLOCKS); + public static final Block RED_CARPETING = add("red_carpeting", new CarpetingBlock(DyeColor.RED), + ItemGroups.BUILDING_BLOCKS); + public static final Block PORTAL_BLOCK = add("portal_block", new PortalBlock(), ItemGroups.BUILDING_BLOCKS); + private static BlockEntityType add(String name, BlockEntityType blockEntity) { Identifier id = BackroomsMod.id(name); BLOCK_ENTITIES.add(new BlockEntityEntry(id, blockEntity)); return blockEntity; } - private static B add(String name, B block, ItemGroup tab) { - return add(name, block, new BlockItem(block, new Item.Settings().group(tab))); + private static B add(String name, B block, RegistryKey tab) { + BlockItem b = new BlockItem(block, new Item.Settings()); + + if (!GROUPED_ITEMS.containsKey(tab)) { + GROUPED_ITEMS.put(tab, new ArrayList()); + } + + GROUPED_ITEMS.get(tab).add(b); + return add(name, block, b); } private static B add(String name, B block, BlockItem item) { @@ -191,18 +352,31 @@ private static void add(String name, B block) { public static void init() { for (ItemEntry entry : ITEMS) { - Registry.register(Registry.ITEM, entry.identifier, entry.item); + Registry.register(Registries.ITEM, entry.identifier, entry.item); } for (BlockEntry entry : BLOCKS) { - Registry.register(Registry.BLOCK, entry.identifier, entry.block); + Registry.register(Registries.BLOCK, entry.identifier, entry.block); } for (BlockEntityEntry entry : BLOCK_ENTITIES) { - Registry.register(Registry.BLOCK_ENTITY_TYPE, entry.identifier, entry.blockEntity); + Registry.register(Registries.BLOCK_ENTITY_TYPE, entry.identifier, entry.blockEntity); } registerCompostableBlocks(); registerFlammableBlocks(); registerFuels(); + + for (RegistryKey groupKey : GROUPED_ITEMS.keySet()) { + ItemGroupEvents.modifyEntriesEvent(groupKey) + .register((itemGroup) -> addAllItemsToGroup(itemGroup, groupKey)); + } + } + + private static void addAllItemsToGroup(FabricItemGroupEntries group, RegistryKey key) { + if (GROUPED_ITEMS.containsKey(key)) { + for (Item item : GROUPED_ITEMS.get(key)) { + group.add(item); + } + } } private static void registerCompostableBlocks() { @@ -218,7 +392,12 @@ private static void registerFuels() { registry.add(PYROIL, 800); } - private record ItemEntry(Identifier identifier, BlockItem item) { } - private record BlockEntry(Identifier identifier, Block block) { } - private record BlockEntityEntry(Identifier identifier, BlockEntityType blockEntity) { } + public record ItemEntry(Identifier identifier, BlockItem item) { + } + + private record BlockEntry(Identifier identifier, Block block) { + } + + private record BlockEntityEntry(Identifier identifier, BlockEntityType blockEntity) { + } } \ No newline at end of file diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsDamageSource.java b/src/main/java/com/kpabr/backrooms/init/BackroomsDamageSource.java deleted file mode 100644 index f6e8aa3..0000000 --- a/src/main/java/com/kpabr/backrooms/init/BackroomsDamageSource.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.kpabr.backrooms.init; - -import net.minecraft.entity.damage.DamageSource; - -public class BackroomsDamageSource extends DamageSource { - public static final BackroomsDamageSource WRETCHED_CYCLE_DEATH = new BackroomsDamageSource("wretched_cycle"); - - private BackroomsDamageSource(String name) { - super(name); - this.setBypassesArmor(); - this.setOutOfWorld(); - } -} diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsDamageTypes.java b/src/main/java/com/kpabr/backrooms/init/BackroomsDamageTypes.java new file mode 100644 index 0000000..146c80e --- /dev/null +++ b/src/main/java/com/kpabr/backrooms/init/BackroomsDamageTypes.java @@ -0,0 +1,18 @@ +package com.kpabr.backrooms.init; + +import com.kpabr.backrooms.BackroomsMod; + +import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.damage.DamageType; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.world.World; + +public class BackroomsDamageTypes { + public static final RegistryKey WRETCHED_CYCLE_DAMAGE_TYPE = RegistryKey.of(RegistryKeys.DAMAGE_TYPE, + BackroomsMod.id("wretched_cycle")); + + public static DamageSource of(World world, RegistryKey key) { + return new DamageSource(world.getRegistryManager().get(RegistryKeys.DAMAGE_TYPE).entryOf(key)); + } +} diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsEntities.java b/src/main/java/com/kpabr/backrooms/init/BackroomsEntities.java index 3a2344d..d25a6a2 100644 --- a/src/main/java/com/kpabr/backrooms/init/BackroomsEntities.java +++ b/src/main/java/com/kpabr/backrooms/init/BackroomsEntities.java @@ -10,31 +10,35 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.SpawnGroup; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; import java.util.ArrayList; public class BackroomsEntities { private static final ArrayList ENTITIES = new ArrayList<>(); public static final EntityType HOUND = add("hound", - FabricEntityTypeBuilder.create(SpawnGroup.CREATURE, HoundEntity::new).dimensions(EntityDimensions.fixed(0.76f, 1.0f)).build()); + FabricEntityTypeBuilder.create(SpawnGroup.CREATURE, HoundEntity::new) + .dimensions(EntityDimensions.fixed(0.76f, 1.0f)).build()); public static final EntityType WRETCH = add("wretch", - FabricEntityTypeBuilder.create(SpawnGroup.CREATURE, WretchEntity::new).dimensions(EntityDimensions.fixed(0.75f, 1.85f)).build()); + FabricEntityTypeBuilder.create(SpawnGroup.CREATURE, WretchEntity::new) + .dimensions(EntityDimensions.fixed(0.75f, 1.85f)).build()); - private static EntityType add(String name, EntityType entity) { + private static EntityType add(String name, EntityType entity) { ENTITIES.add(new EntityEntry(BackroomsMod.id(name), entity)); return entity; } public static void init() { for (EntityEntry entry : ENTITIES) { - Registry.register(Registry.ENTITY_TYPE, entry.identifier, entry.entity); + Registry.register(Registries.ENTITY_TYPE, entry.identifier, entry.entity); } FabricDefaultAttributeRegistry.register(WRETCH, WretchEntity.createWretchAttributes()); FabricDefaultAttributeRegistry.register(HOUND, HoundEntity.createHoundAttributes()); } - private record EntityEntry(Identifier identifier, EntityType entity) {} + private record EntityEntry(Identifier identifier, EntityType entity) { + } } diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsFluids.java b/src/main/java/com/kpabr/backrooms/init/BackroomsFluids.java index 50a266c..d9ad899 100644 --- a/src/main/java/com/kpabr/backrooms/init/BackroomsFluids.java +++ b/src/main/java/com/kpabr/backrooms/init/BackroomsFluids.java @@ -6,13 +6,15 @@ import com.kpabr.backrooms.fluid.AlmondWaterFluid; import net.minecraft.fluid.FlowableFluid; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; public class BackroomsFluids { private static final ArrayList FLUIDS = new ArrayList<>(); public static final FlowableFluid STILL_ALMOND_WATER = add("almond_water", new AlmondWaterFluid.Still()); - public static final FlowableFluid FLOWING_ALMOND_WATER = add("flowing_almond_water", new AlmondWaterFluid.Flowing()); + public static final FlowableFluid FLOWING_ALMOND_WATER = add("flowing_almond_water", + new AlmondWaterFluid.Flowing()); private static F add(String name, F fluid) { FLUIDS.add(new FluidEntry(BackroomsMod.id(name), fluid)); @@ -21,9 +23,10 @@ private static F add(String name, F fluid) { public static void init() { for (FluidEntry entry : FLUIDS) { - Registry.register(Registry.FLUID, entry.identifier, entry.fluid); + Registry.register(Registries.FLUID, entry.identifier, entry.fluid); } } - private record FluidEntry(Identifier identifier, FlowableFluid fluid) {} + private record FluidEntry(Identifier identifier, FlowableFluid fluid) { + } } diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsGamerules.java b/src/main/java/com/kpabr/backrooms/init/BackroomsGamerules.java index 406cc6a..a396863 100644 --- a/src/main/java/com/kpabr/backrooms/init/BackroomsGamerules.java +++ b/src/main/java/com/kpabr/backrooms/init/BackroomsGamerules.java @@ -6,12 +6,12 @@ import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.world.GameRules; import net.minecraft.world.World; -import java.util.Random; +import net.minecraft.util.math.random.Random; import net.fabricmc.fabric.api.entity.event.v1.EntitySleepEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerEntityEvents; @@ -20,29 +20,30 @@ import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry; import net.fabricmc.fabric.api.gamerule.v1.rule.EnumRule; - public class BackroomsGamerules { - // Register Enum game rule, appears on the world creation screen under the backrooms category and command /gamerule respawn - public static final GameRules.Key> RESPAWN = - GameRuleRegistry.register("respawn", new CustomGameRuleCategory(new Identifier("backrooms", "backrooms_category"), Text.of("Backrooms")), GameRuleFactory.createEnumRule(Respawn.natural, (server, rule) -> { + // Register Enum game rule, appears on the world creation screen under the + // backrooms category and command /gamerule respawn + public static final GameRules.Key> RESPAWN = GameRuleRegistry.register("respawn", + new CustomGameRuleCategory(new Identifier("backrooms", "backrooms_category"), Text.of("Backrooms")), + GameRuleFactory.createEnumRule(Respawn.natural, (server, rule) -> { onRespawnGameruleChanged(server, rule.get()); })); - public static void init() { - // ENTITY_LOAD is called whenever an entity is loaded (new chunk, natural spawn, player joins world, player respawns) - // When the entity is a player and RESPAWN is set to natural, reset the SpawnPoint overwrite + // ENTITY_LOAD is called whenever an entity is loaded (new chunk, natural spawn, + // player joins world, player respawns) + // When the entity is a player and RESPAWN is set to natural, reset the + // SpawnPoint overwrite ServerEntityEvents.ENTITY_LOAD.register((entity, world) -> { if (entity instanceof ServerPlayerEntity) { ServerPlayerEntity player = (ServerPlayerEntity) entity; if (world.getGameRules().get(RESPAWN).get() == Respawn.natural) { player.setSpawnPoint(null, null, 0f, false, false); - } - else { + } else { setPlayerSpawnpoint(player); - } - + } + } }); @@ -60,9 +61,10 @@ public static void init() { }); } - // when the rule is changed, iterate over every player and set the right spawn or reset the overwrite + // when the rule is changed, iterate over every player and set the right spawn + // or reset the overwrite private static void onRespawnGameruleChanged(MinecraftServer server, Respawn respawnType) { - + for (ServerPlayerEntity player : server.getPlayerManager().getPlayerList()) { if (player.getWorld().getGameRules().get(RESPAWN).get() != Respawn.natural) { @@ -73,31 +75,35 @@ private static void onRespawnGameruleChanged(MinecraftServer server, Respawn res } } - // sets the spawn according to RESPAWN, only when player is inside a backrooms level + // sets the spawn according to RESPAWN, only when player is inside a backrooms + // level private static void setPlayerSpawnpoint(ServerPlayerEntity player) { Respawn respawnPolicy = player.getWorld().getGameRules().get(RESPAWN).get(); - if (player.getWorld().getRegistryKey().getValue().toString().contains("backrooms") && respawnPolicy == Respawn.in_current_level) { + if (player.getWorld().getRegistryKey().getValue().toString().contains("backrooms") + && respawnPolicy == Respawn.in_current_level) { setSpawnpointToCurrentLevel(player); - } else if (player.getWorld().getRegistryKey().getValue().toString().contains("backrooms") && respawnPolicy == Respawn.in_level_zero) { + } else if (player.getWorld().getRegistryKey().getValue().toString().contains("backrooms") + && respawnPolicy == Respawn.in_level_zero) { setSpawnpointToLevel0(player); } } - private static void setSpawnpointToCurrentLevel(ServerPlayerEntity player) { Random rand = player.getWorld().getRandom(); // random position in the level int newX = (rand.nextInt(25) * 16) + rand.nextInt(16); int newZ = (rand.nextInt(25) * 16) + rand.nextInt(16); - // uses current y of the player so the respawn point is inside the level and not over or under it + // uses current y of the player so the respawn point is inside the level and not + // over or under it int newY = player.getBlockY(); BlockPos.Mutable mutBlockPos = new BlockPos(newX, newY, newZ).mutableCopy(); - + mutBlockPos = new BlockPos(newX, newY, newZ).mutableCopy(); boolean up = false; - // searches for a place inside the level where two blocks are air so the player can spawn + // searches for a place inside the level where two blocks are air so the player + // can spawn while (!(player.getWorld().isAir(mutBlockPos) && player.getWorld().isAir(mutBlockPos.up()))) { mutBlockPos.move(Direction.SOUTH).move(Direction.EAST); if (up) { @@ -107,7 +113,7 @@ private static void setSpawnpointToCurrentLevel(ServerPlayerEntity player) { } up = !up; } - + player.setSpawnPoint(player.getEntityWorld().getRegistryKey(), mutBlockPos.toImmutable(), 0f, true, false); } @@ -115,9 +121,9 @@ private static void setSpawnpointToLevel0(ServerPlayerEntity player) { Random rand = player.getWorld().getRandom(); World level_0 = player.getServer().getWorld( - RegistryKey.of( - Registry.WORLD_KEY, - new Identifier("backrooms:level_0"))); + RegistryKey.of( + RegistryKeys.WORLD, + new Identifier("backrooms:level_0"))); // random position in the level int newX = (rand.nextInt(25) * 16) + rand.nextInt(16); @@ -126,10 +132,11 @@ private static void setSpawnpointToLevel0(ServerPlayerEntity player) { int newY = 26; BlockPos.Mutable mutBlockPos = new BlockPos(newX, newY, newZ).mutableCopy(); - + mutBlockPos = new BlockPos(newX, newY, newZ).mutableCopy(); boolean up = false; - // searches for a place inside level 0 where two blocks are air so the player can spawn + // searches for a place inside level 0 where two blocks are air so the player + // can spawn while (!(level_0.isAir(mutBlockPos) && level_0.isAir(mutBlockPos.up()))) { mutBlockPos.move(Direction.SOUTH).move(Direction.EAST); if (up) { diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsGroups.java b/src/main/java/com/kpabr/backrooms/init/BackroomsGroups.java index 1f4f280..aa14993 100644 --- a/src/main/java/com/kpabr/backrooms/init/BackroomsGroups.java +++ b/src/main/java/com/kpabr/backrooms/init/BackroomsGroups.java @@ -1,16 +1,47 @@ package com.kpabr.backrooms.init; +import java.util.ArrayList; + import com.kpabr.backrooms.BackroomsMod; -import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder; -import net.minecraft.item.ItemStack; -import net.minecraft.util.registry.Registry; + +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemGroup; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.text.Text; +import net.minecraft.util.Identifier; public class BackroomsGroups { + public static final RegistryKey ITEMS_GROUP_KEY = RegistryKey.of(Registries.ITEM_GROUP.getKey(), + BackroomsMod.id("items")); + public static final ItemGroup ITEMS_GROUP = FabricItemGroup.builder() + .icon(() -> BackroomsBlocks.PATTERNED_WALLPAPER.asItem().getDefaultStack()) + .displayName(Text.translatable("itemGroup.backrooms.items")) + .build(); + public static void init() { - FabricItemGroupBuilder.create(BackroomsMod.id("items")) - .icon(() -> BackroomsBlocks.CORK_TILE.asItem().getDefaultStack()) - .appendItems((stacks) -> Registry.ITEM.stream().filter((item) -> - Registry.ITEM.getId(item).getNamespace().equals("backrooms")).forEach((item) -> stacks.add(new ItemStack(item)))).build(); + Registry.register(Registries.ITEM_GROUP, ITEMS_GROUP_KEY, ITEMS_GROUP); + + ArrayList itemIds = new ArrayList(); + // Collections.reverse(itemIds); + for (com.kpabr.backrooms.init.BackroomsBlocks.ItemEntry entry : BackroomsBlocks.ITEMS) { + itemIds.add(entry.identifier()); + } + for (BlockItem item : BackroomsItems.BLOCK_ITEMS) { + itemIds.add(Registries.BLOCK.getId(item.getBlock())); + } + for (com.kpabr.backrooms.init.BackroomsItems.ItemEntry entry : BackroomsItems.ITEMS) { + itemIds.add(entry.identifier()); + } + + ItemGroupEvents.modifyEntriesEvent(ITEMS_GROUP_KEY).register(itemGroup -> { + for (Identifier entry : itemIds) { + itemGroup.add(Registries.ITEM.get(entry)); + } + }); } } diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsItems.java b/src/main/java/com/kpabr/backrooms/init/BackroomsItems.java index cf05b92..c83fe78 100644 --- a/src/main/java/com/kpabr/backrooms/init/BackroomsItems.java +++ b/src/main/java/com/kpabr/backrooms/init/BackroomsItems.java @@ -1,71 +1,113 @@ package com.kpabr.backrooms.init; import java.util.ArrayList; +import java.util.HashMap; import com.kpabr.backrooms.BackroomsMod; import com.kpabr.backrooms.items.FireSalt; import com.kpabr.backrooms.items.AlmondWaterItem; import com.kpabr.backrooms.items.MaskItem; import com.kpabr.backrooms.util.Color; + +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.effect.StatusEffects; -import net.minecraft.item.Item; -import net.minecraft.item.ItemGroup; import net.minecraft.item.*; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; -import net.minecraft.item.FoodComponent; -import net.minecraft.item.SpawnEggItem; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; public class BackroomsItems { + private static HashMap, ArrayList> GROUPED_ITEMS = new HashMap, ArrayList>(); public static ArrayList ITEMS = new ArrayList<>(); public static ArrayList BLOCK_ITEMS = new ArrayList<>(); public static final Item ALMOND_WATER = add("almond_water_bottle", - new AlmondWaterItem(new Item.Settings().group(ItemGroup.FOOD).food( - new FoodComponent.Builder().alwaysEdible().snack().saturationModifier(20).hunger(0).build()).maxCount(16))); + new AlmondWaterItem(new Item.Settings().food( + new FoodComponent.Builder().alwaysEdible().snack().saturationModifier(20).hunger(0).build()) + .maxCount(16)), + ItemGroups.FOOD_AND_DRINK); public static final Item FIRESALT = add("firesalt", - new FireSalt(new Item.Settings().group(ItemGroup.MISC))); + new FireSalt(new Item.Settings()), ItemGroups.COMBAT); public static final Item TILEMOLD_LUMP = add("tilemold_lump", - new Item(new Item.Settings().group(ItemGroup.MISC))); + new Item(new Item.Settings()), ItemGroups.NATURAL); public static final Item BAKED_TILEMOLD_LUMP = add("baked_tilemold_lump", - new Item(new Item.Settings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().snack().saturationModifier(2).hunger(2).build()))); + new Item(new Item.Settings() + .food(new FoodComponent.Builder().snack().saturationModifier(2).hunger(2).build())), + ItemGroups.FOOD_AND_DRINK); public static final Item TAINTED_FLESH = add("tainted_flesh", - new Item(new Item.Settings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().saturationModifier(0).hunger(3).statusEffect(new StatusEffectInstance(StatusEffects.HUNGER, 600, 0), 0.8F).meat().build()))); + new Item(new Item.Settings().food(new FoodComponent.Builder().saturationModifier(0).hunger(3) + .statusEffect(new StatusEffectInstance(StatusEffects.HUNGER, 600, 0), 0.8F).meat().build())), + ItemGroups.FOOD_AND_DRINK); public static final Item COOKED_FLESH = add("cooked_flesh", - new Item(new Item.Settings().group(ItemGroup.FOOD).food(new FoodComponent.Builder().saturationModifier(3).hunger(5).meat().build()))); + new Item(new Item.Settings() + .food(new FoodComponent.Builder().saturationModifier(3).hunger(5).meat().build())), + ItemGroups.FOOD_AND_DRINK); public static final Item ALMOND_WATER_BUCKET = add("almond_water_bucket", - new BucketItem(BackroomsFluids.STILL_ALMOND_WATER, new Item.Settings().recipeRemainder(Items.BUCKET).maxCount(1).group(ItemGroup.MISC))); + new BucketItem(BackroomsFluids.STILL_ALMOND_WATER, + new Item.Settings().recipeRemainder(Items.BUCKET).maxCount(1)), + ItemGroups.FOOD_AND_DRINK); public static final Item HOUND_SPAWN_EGG = add("hound_spawn_egg", - new SpawnEggItem(BackroomsEntities.HOUND,16777215,8531483,new Item.Settings().group(ItemGroup.MISC))); + new SpawnEggItem(BackroomsEntities.HOUND, 16777215, 8531483, new Item.Settings()), ItemGroups.SPAWN_EGGS); public static final Item WRETCH_SPAWN_EGG = add("wretch_spawn_egg", - new SpawnEggItem(BackroomsEntities.WRETCH,Color.of(120, 5, 5), Color.of(89, 7, 7) , - new Item.Settings().group(ItemGroup.MISC))); + new SpawnEggItem(BackroomsEntities.WRETCH, Color.of(120, 5, 5), Color.of(89, 7, 7), + new Item.Settings()), + ItemGroups.SPAWN_EGGS); public static final Item COLOMBINA_MASK = add( - new MaskItem(BackroomsBlocks.COLOMBINA_MASK, new Item.Settings().group(ItemGroup.DECORATIONS).maxCount(1))); + new MaskItem(BackroomsBlocks.COLOMBINA_MASK, new Item.Settings().maxCount(1)), ItemGroups.COMBAT); public static final Item HARLEQUIN_MASK = add( - new MaskItem(BackroomsBlocks.HARLEQUIN_MASK, new Item.Settings().group(ItemGroup.DECORATIONS).maxCount(1))); + new MaskItem(BackroomsBlocks.HARLEQUIN_MASK, new Item.Settings().maxCount(1)), ItemGroups.COMBAT); public static final Item SOCK_BUSKIN_MASK = add( - new MaskItem(BackroomsBlocks.SOCK_BUSKIN_MASK, new Item.Settings().group(ItemGroup.DECORATIONS).maxCount(1))); + new MaskItem(BackroomsBlocks.SOCK_BUSKIN_MASK, new Item.Settings().maxCount(1)), ItemGroups.COMBAT); + + private static I add(String name, I item, RegistryKey tab) { + + if (!GROUPED_ITEMS.containsKey(tab)) { + GROUPED_ITEMS.put(tab, new ArrayList()); + } + + GROUPED_ITEMS.get(tab).add(item); - private static I add(String name, I item) { ITEMS.add(new ItemEntry(BackroomsMod.id(name), item)); return item; } - private static Item add(T item) { + + private static Item add(T item, RegistryKey tab) { + if (!GROUPED_ITEMS.containsKey(tab)) { + GROUPED_ITEMS.put(tab, new ArrayList()); + } + + GROUPED_ITEMS.get(tab).add(item); + BLOCK_ITEMS.add(item); return item; } public static void init() { for (ItemEntry entry : ITEMS) { - Registry.register(Registry.ITEM, entry.identifier, entry.item); + Registry.register(Registries.ITEM, entry.identifier, entry.item); } for (BlockItem item : BLOCK_ITEMS) { - Registry.register(Registry.ITEM, Registry.BLOCK.getId(item.getBlock()), item); + Registry.register(Registries.ITEM, Registries.BLOCK.getId(item.getBlock()), item); + } + + for (RegistryKey groupKey : GROUPED_ITEMS.keySet()) { + ItemGroupEvents.modifyEntriesEvent(groupKey) + .register((itemGroup) -> addAllItemsToGroup(itemGroup, groupKey)); } } - private record ItemEntry(Identifier identifier, Item item) {} + private static void addAllItemsToGroup(FabricItemGroupEntries group, RegistryKey key) { + if (GROUPED_ITEMS.containsKey(key)) { + for (Item item : GROUPED_ITEMS.get(key)) { + group.add(item); + } + } + } + + public record ItemEntry(Identifier identifier, Item item) { + } } diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsLevels.java b/src/main/java/com/kpabr/backrooms/init/BackroomsLevels.java index 7c3cb7a..cc428aa 100644 --- a/src/main/java/com/kpabr/backrooms/init/BackroomsLevels.java +++ b/src/main/java/com/kpabr/backrooms/init/BackroomsLevels.java @@ -1,15 +1,6 @@ package com.kpabr.backrooms.init; import com.kpabr.backrooms.BackroomsMod; -import com.kpabr.backrooms.world.biome.biomes.level0.CrimsonHallsBiome; -import com.kpabr.backrooms.world.biome.biomes.level0.DecrepitBiome; -import com.kpabr.backrooms.world.biome.biomes.level0.MegalophobiaBiome; -import com.kpabr.backrooms.world.biome.biomes.level0.YellowHallsBiome; -import com.kpabr.backrooms.world.biome.biomes.level1.CementHallsBiome; -import com.kpabr.backrooms.world.biome.biomes.level1.ParkingGarageBiome; -import com.kpabr.backrooms.world.biome.biomes.level1.WarehouseBiome; -import com.kpabr.backrooms.world.biome.biomes.level2.PipesBiome; -import com.kpabr.backrooms.world.biome.biomes.level3.ElectricalStationBiome; import com.kpabr.backrooms.world.biome.sources.LevelOneBiomeSource; import com.kpabr.backrooms.world.biome.sources.LevelThreeBiomeSource; import com.kpabr.backrooms.world.biome.sources.LevelTwoBiomeSource; @@ -22,21 +13,22 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.serialization.Codec; -import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; +import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; import net.fabricmc.fabric.api.dimension.v1.FabricDimensions; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.block.Blocks; import net.minecraft.command.CommandException; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; -import net.minecraft.text.LiteralText; +import net.minecraft.text.Text; import net.minecraft.util.Identifier; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.world.TeleportTarget; import net.minecraft.world.World; import net.minecraft.world.biome.Biome; @@ -44,139 +36,142 @@ import net.minecraft.world.dimension.DimensionOptions; import net.minecraft.world.gen.chunk.ChunkGenerator; -import static com.kpabr.backrooms.util.RegistryHelper.get; +import static com.kpabr.backrooms.util.RegistryHelper.getBiome; import static net.minecraft.server.command.CommandManager.literal; +import java.util.HashMap; + public class BackroomsLevels { + // Levels Biomes + // The biome options refer to the JSON-file in the worldgen/biome subfolder of + // the datapack, + // which will always share it's ID with the biome that is created from it + // Level 0 biomes - public static final RegistryKey DECREPIT_BIOME = get("decrepit", DecrepitBiome.create()); - public static final RegistryKey MEGALOPHOBIA_BIOME = get("megalophobia", MegalophobiaBiome.create()); - public static final RegistryKey YELLOW_WALLS_BIOME = get("yellow_walls", YellowHallsBiome.create()); - public static final RegistryKey CRIMSON_WALLS_BIOME = get("crimson_walls", CrimsonHallsBiome.create()); - + public static final RegistryKey DECREPIT_BIOME = getBiome("decrepit"); + public static final RegistryKey MEGALOPHOBIA_BIOME = getBiome("megalophobia"); + public static final RegistryKey YELLOW_WALLS_BIOME = getBiome("yellow_walls"); + public static final RegistryKey CRIMSON_WALLS_BIOME = getBiome("crimson_walls"); + // Level 1 biomes - public static final RegistryKey CEMENT_WALLS_BIOME = get("cement_walls", CementHallsBiome.create()); - public static final RegistryKey PARKING_GARAGE_BIOME = get("parking_garage", ParkingGarageBiome.create()); - public static final RegistryKey WAREHOUSE_BIOME = get("warehouse", WarehouseBiome.create()); - + public static final RegistryKey CEMENT_WALLS_BIOME = getBiome("cement_walls"); + public static final RegistryKey PARKING_GARAGE_BIOME = getBiome("parking_garage"); + public static final RegistryKey WAREHOUSE_BIOME = getBiome("warehouse"); + // Level 2 biomes - public static final RegistryKey PIPES_BIOME = get("pipes", PipesBiome.create()); - + public static final RegistryKey PIPES_BIOME = getBiome("pipes"); + // Level 4 biomes - public static final RegistryKey ELECTRICAL_STATION_BIOME = get("electrical_station", ElectricalStationBiome.create()); + public static final RegistryKey ELECTRICAL_STATION_BIOME = getBiome("electrical_station"); + public static final HashMap, RegistryEntry> BIOME_KEY_TO_ENTRY = new HashMap, RegistryEntry>(); // Levels/Dimensions - // The dimension options refer to the JSON-file in the dimension subfolder of the datapack, - // which will always share it's ID with the world that is created from it - public static final RegistryKey LEVEL_0_DIMENSION_KEY = RegistryKey.of( - Registry.DIMENSION_KEY, - new Identifier(BackroomsMod.ModId, "level_0") - ); + // The dimension options refer to the JSON-file in the dimension subfolder of + // the datapack, + // which will always share it's ID with the world that is created from it + public static final RegistryKey LEVEL_0_DIMENSION_KEY = RegistryKey.of( + RegistryKeys.DIMENSION, + new Identifier(BackroomsMod.ModId, "level_0")); public static RegistryKey LEVEL_0_WORLD_KEY = RegistryKey.of( - Registry.WORLD_KEY, - LEVEL_0_DIMENSION_KEY.getValue() - ); + RegistryKeys.WORLD, + LEVEL_0_DIMENSION_KEY.getValue()); public static final RegistryKey LEVEL_1_DIMENSION_KEY = RegistryKey.of( - Registry.DIMENSION_KEY, - new Identifier(BackroomsMod.ModId, "level_1") - ); + RegistryKeys.DIMENSION, + new Identifier(BackroomsMod.ModId, "level_1")); public static RegistryKey LEVEL_1_WORLD_KEY = RegistryKey.of( - Registry.WORLD_KEY, - LEVEL_1_DIMENSION_KEY.getValue() - ); + RegistryKeys.WORLD, + LEVEL_1_DIMENSION_KEY.getValue()); public static final RegistryKey LEVEL_2_DIMENSION_KEY = RegistryKey.of( - Registry.DIMENSION_KEY, - new Identifier(BackroomsMod.ModId, "level_2") - ); + RegistryKeys.DIMENSION, + new Identifier(BackroomsMod.ModId, "level_2")); public static RegistryKey LEVEL_2_WORLD_KEY = RegistryKey.of( - Registry.WORLD_KEY, - LEVEL_2_DIMENSION_KEY.getValue() - ); + RegistryKeys.WORLD, + LEVEL_2_DIMENSION_KEY.getValue()); public static final RegistryKey LEVEL_3_DIMENSION_KEY = RegistryKey.of( - Registry.DIMENSION_KEY, - new Identifier(BackroomsMod.ModId, "level_3") - ); + RegistryKeys.DIMENSION, + new Identifier(BackroomsMod.ModId, "level_3")); public static RegistryKey LEVEL_3_WORLD_KEY = RegistryKey.of( - Registry.WORLD_KEY, - LEVEL_3_DIMENSION_KEY.getValue() - ); + RegistryKeys.WORLD, + LEVEL_3_DIMENSION_KEY.getValue()); // don't forget to change this variable or portal block won't work public static final int LEVELS_AMOUNT = 4; // ServerWorlds for getting seed and NBT resources - public static ServerWorld LEVEL_0_WORLD; - public static ServerWorld LEVEL_1_WORLD; - public static ServerWorld LEVEL_2_WORLD; - public static ServerWorld LEVEL_3_WORLD; + public static ServerWorld LEVEL_0_WORLD; + public static ServerWorld LEVEL_1_WORLD; + public static ServerWorld LEVEL_2_WORLD; + public static ServerWorld LEVEL_3_WORLD; public static void init() { - addLevel(BackroomsMod.ModId, "level_0", "level_0_biome_source", LevelZeroChunkGenerator.CODEC, LevelZeroBiomeSource.CODEC); - addLevel(BackroomsMod.ModId, "level_1", "level_1_biome_source", LevelOneChunkGenerator.CODEC, LevelOneBiomeSource.CODEC); - addLevel(BackroomsMod.ModId, "level_2", "level_2_biome_source", LevelTwoChunkGenerator.CODEC, LevelTwoBiomeSource.CODEC); - addLevel(BackroomsMod.ModId, "level_3", "level_3_biome_source", LevelThreeChunkGenerator.CODEC, LevelThreeBiomeSource.CODEC); - + addLevel(BackroomsMod.ModId, "level_0", "level_0_biome_source", LevelZeroChunkGenerator.CODEC, + LevelZeroBiomeSource.CODEC); + addLevel(BackroomsMod.ModId, "level_1", "level_1_biome_source", LevelOneChunkGenerator.CODEC, + LevelOneBiomeSource.CODEC); + addLevel(BackroomsMod.ModId, "level_2", "level_2_biome_source", LevelTwoChunkGenerator.CODEC, + LevelTwoBiomeSource.CODEC); + addLevel(BackroomsMod.ModId, "level_3", "level_3_biome_source", LevelThreeChunkGenerator.CODEC, + LevelThreeBiomeSource.CODEC); ServerLifecycleEvents.SERVER_STARTED.register(server -> { - LEVEL_0_WORLD = server.getWorld(LEVEL_0_WORLD_KEY); - LEVEL_1_WORLD = server.getWorld(LEVEL_1_WORLD_KEY); - LEVEL_2_WORLD = server.getWorld(LEVEL_2_WORLD_KEY); - LEVEL_3_WORLD = server.getWorld(LEVEL_3_WORLD_KEY); + LEVEL_0_WORLD = server.getWorld(LEVEL_0_WORLD_KEY); + LEVEL_1_WORLD = server.getWorld(LEVEL_1_WORLD_KEY); + LEVEL_2_WORLD = server.getWorld(LEVEL_2_WORLD_KEY); + LEVEL_3_WORLD = server.getWorld(LEVEL_3_WORLD_KEY); }); // only for debug if (FabricLoader.getInstance().isDevelopmentEnvironment()) { - CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> - dispatcher.register(literal("tp0").executes(context -> { + CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher + .register(literal("tp0").executes(context -> { return debugTeleport(context, LEVEL_0_WORLD_KEY); }))); - CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> - dispatcher.register(literal("tp1").executes(context -> { + CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher + .register(literal("tp1").executes(context -> { return debugTeleport(context, LEVEL_1_WORLD_KEY); }))); - CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> - dispatcher.register(literal("tp2").executes(context -> { + CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher + .register(literal("tp2").executes(context -> { return debugTeleport(context, LEVEL_2_WORLD_KEY); }))); - CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> - dispatcher.register(literal("tp3").executes(context -> { + CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher + .register(literal("tp3").executes(context -> { return debugTeleport(context, LEVEL_3_WORLD_KEY); }))); - } + } } - public static RegistryKey addLevel(String namespace, String levelName, String biomeSourceName, Codec chunkGenerator, Codec biomeSource) { - Registry.register(Registry.BIOME_SOURCE, new Identifier(namespace, biomeSourceName), biomeSource); - Registry.register(Registry.CHUNK_GENERATOR, new Identifier(namespace, levelName), chunkGenerator); - return RegistryKey.of(Registry.WORLD_KEY, new Identifier(namespace, levelName)); + public static RegistryKey addLevel(String namespace, String levelName, String biomeSourceName, + Codec chunkGenerator, Codec biomeSource) { + Registry.register(Registries.BIOME_SOURCE, new Identifier(namespace, biomeSourceName), biomeSource); + Registry.register(Registries.CHUNK_GENERATOR, new Identifier(namespace, levelName), chunkGenerator); + return RegistryKey.of(RegistryKeys.WORLD, new Identifier(namespace, levelName)); } // only for debug - private static int debugTeleport(CommandContext context, RegistryKey level) throws CommandSyntaxException { + private static int debugTeleport(CommandContext context, RegistryKey level) + throws CommandSyntaxException { ServerPlayerEntity player = context.getSource().getPlayer(); - ServerWorld serverWorld = player.getWorld(); - ServerWorld targetWorld = context.getSource().getServer().getWorld(level); - - if (serverWorld != targetWorld) { - TeleportTarget target = new TeleportTarget(new Vec3d(0.5, 101, 0.5), Vec3d.ZERO, 0, 0); - FabricDimensions.teleport(player, targetWorld, target); - - if (player.world != targetWorld) { - throw new CommandException(new LiteralText("Teleportation failed!")); - } - - targetWorld.setBlockState(new BlockPos(0, 100, 0), Blocks.DIAMOND_BLOCK.getDefaultState()); - targetWorld.setBlockState(new BlockPos(0, 101, 0), Blocks.TORCH.getDefaultState()); - } else { - TeleportTarget target = new TeleportTarget(new Vec3d(0, 100, 0), Vec3d.ZERO, - (float) Math.random() * 360 - 180, (float) Math.random() * 360 - 180); - FabricDimensions.teleport(player, context.getSource().getServer().getWorld(World.OVERWORLD), target); - } - return 1; + ServerWorld serverWorld = player.getServerWorld(); + ServerWorld targetWorld = context.getSource().getServer().getWorld(level); + + if (serverWorld != targetWorld) { + TeleportTarget target = new TeleportTarget(new Vec3d(0.5, 101, 0.5), Vec3d.ZERO, 0, 0); + FabricDimensions.teleport(player, targetWorld, target); + + if (player.getWorld() != targetWorld) { + throw new CommandException(Text.literal("Teleportation failed!")); + } + } else { + TeleportTarget target = new TeleportTarget(new Vec3d(0, 100, 0), Vec3d.ZERO, + (float) Math.random() * 360 - 180, (float) Math.random() * 360 - 180); + FabricDimensions.teleport(player, context.getSource().getServer().getWorld(World.OVERWORLD), target); + } + return 1; } } diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsLootTables.java b/src/main/java/com/kpabr/backrooms/init/BackroomsLootTables.java index 3931420..1260cb9 100644 --- a/src/main/java/com/kpabr/backrooms/init/BackroomsLootTables.java +++ b/src/main/java/com/kpabr/backrooms/init/BackroomsLootTables.java @@ -1,5 +1,5 @@ package com.kpabr.backrooms.init; -import com.kpabr.backrooms.BackroomsMod; + import net.minecraft.util.Identifier; public class BackroomsLootTables { diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsParticles.java b/src/main/java/com/kpabr/backrooms/init/BackroomsParticles.java index bf25a11..6978363 100644 --- a/src/main/java/com/kpabr/backrooms/init/BackroomsParticles.java +++ b/src/main/java/com/kpabr/backrooms/init/BackroomsParticles.java @@ -3,12 +3,13 @@ import com.kpabr.backrooms.BackroomsMod; import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes; import net.minecraft.particle.DefaultParticleType; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; public class BackroomsParticles { public static final DefaultParticleType FIRESALT_PARTICLE = FabricParticleTypes.simple(); public static void init() { - Registry.register(Registry.PARTICLE_TYPE, BackroomsMod.id("firesalt"), FIRESALT_PARTICLE); + Registry.register(Registries.PARTICLE_TYPE, BackroomsMod.id("firesalt"), FIRESALT_PARTICLE); } } diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsProjectiles.java b/src/main/java/com/kpabr/backrooms/init/BackroomsProjectiles.java index ac3fdf2..0ab1dc7 100644 --- a/src/main/java/com/kpabr/backrooms/init/BackroomsProjectiles.java +++ b/src/main/java/com/kpabr/backrooms/init/BackroomsProjectiles.java @@ -6,7 +6,8 @@ import net.minecraft.entity.EntityDimensions; import net.minecraft.entity.EntityType; import net.minecraft.entity.SpawnGroup; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; public class BackroomsProjectiles { @@ -19,7 +20,7 @@ public class BackroomsProjectiles { public static void init() { Registry.register( - Registry.ENTITY_TYPE, + Registries.ENTITY_TYPE, BackroomsMod.id("fire_salt_projectile"), FIRE_SALT_PROJECTILE_ENTITY_TYPE); } diff --git a/src/main/java/com/kpabr/backrooms/init/BackroomsSounds.java b/src/main/java/com/kpabr/backrooms/init/BackroomsSounds.java index c916e25..281b23b 100644 --- a/src/main/java/com/kpabr/backrooms/init/BackroomsSounds.java +++ b/src/main/java/com/kpabr/backrooms/init/BackroomsSounds.java @@ -12,9 +12,11 @@ public class BackroomsSounds { public static SoundEvent HOUND_ATTACK; public static SoundEvent HOUND_HURT; public static SoundEvent HOUND_DEATH; + public static void init() { HUMBUZZ_LEVEL_0 = get("humbuzz"); FIRESALT_LAND_EVENT = get("firesalt_land"); + // TODO: make loop sound for level two, add in json; initHoundSounds(); } diff --git a/src/main/java/com/kpabr/backrooms/items/AlmondWaterItem.java b/src/main/java/com/kpabr/backrooms/items/AlmondWaterItem.java index 4a83ad1..9e8f8ba 100644 --- a/src/main/java/com/kpabr/backrooms/items/AlmondWaterItem.java +++ b/src/main/java/com/kpabr/backrooms/items/AlmondWaterItem.java @@ -45,21 +45,21 @@ public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) { player.getHungerManager().add(8, 8.0f); - if(wretched.getValue() < 24 && wretched.getValue() + almondMilkRestoring >= 24) { + if (wretched.getValue() < 24 && wretched.getValue() + almondMilkRestoring >= 24) { user.removeStatusEffect(BackroomStatusEffects.RAGGED); - } else if(wretched.getValue() < 50 && wretched.getValue() + almondMilkRestoring >= 50) { + } else if (wretched.getValue() < 50 && wretched.getValue() + almondMilkRestoring >= 50) { user.removeStatusEffect(BackroomStatusEffects.ROTTEN); - } else if(wretched.getValue() < 75 && wretched.getValue() + almondMilkRestoring >= 75) { + } else if (wretched.getValue() < 75 && wretched.getValue() + almondMilkRestoring >= 75) { user.removeStatusEffect(BackroomStatusEffects.WRETCHED); } - // add 1 to almondMilkRestoring because we're calling applyWretchedCycle and it's decrementing wretched parameter immediately + // add 1 to almondMilkRestoring because we're calling applyWretchedCycle and + // it's decrementing wretched parameter immediately wretched.remove(almondMilkRestoring + 1); BackroomsMod.applyWretchedCycle(player); } else if (stack.isEmpty()) { return new ItemStack(Items.GLASS_BOTTLE); - } - else if (user instanceof PlayerEntity player && !player.getAbilities().creativeMode) { + } else if (user instanceof PlayerEntity player && !player.getAbilities().creativeMode) { final ItemStack itemStack = new ItemStack(Items.GLASS_BOTTLE); if (!player.getInventory().insertStack(itemStack)) { player.dropItem(itemStack, false); diff --git a/src/main/java/com/kpabr/backrooms/items/FireSalt.java b/src/main/java/com/kpabr/backrooms/items/FireSalt.java index 8fe4e63..f4224d6 100644 --- a/src/main/java/com/kpabr/backrooms/items/FireSalt.java +++ b/src/main/java/com/kpabr/backrooms/items/FireSalt.java @@ -17,7 +17,7 @@ public FireSalt(Settings settings) { public TypedActionResult use(World world, PlayerEntity user, Hand hand) { ItemStack itemStack = user.getStackInHand(hand); - user.playSound(SoundEvents.BLOCK_AMETHYST_BLOCK_PLACE, 100, 1); //placeholder + user.playSound(SoundEvents.BLOCK_AMETHYST_BLOCK_PLACE, 100, 1); // placeholder if (!world.isClient) { FireSaltProjectileEntity FireSaltEnt = new FireSaltProjectileEntity(world, user); FireSaltEnt.setItem(itemStack); diff --git a/src/main/java/com/kpabr/backrooms/items/MaskItem.java b/src/main/java/com/kpabr/backrooms/items/MaskItem.java index 220170a..af7c9fa 100644 --- a/src/main/java/com/kpabr/backrooms/items/MaskItem.java +++ b/src/main/java/com/kpabr/backrooms/items/MaskItem.java @@ -21,11 +21,13 @@ import java.util.UUID; -public class MaskItem extends BlockItem implements Wearable { +public class MaskItem extends BlockItem implements Equipment { private static final UUID HEAD_UUID = UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"); - private static final Multimap attributeModifiers = ImmutableMultimap.builder() + private static final Multimap attributeModifiers = ImmutableMultimap + .builder() .put(EntityAttributes.GENERIC_ATTACK_DAMAGE, - new EntityAttributeModifier(HEAD_UUID, "Mask damage boost", 4, EntityAttributeModifier.Operation.ADDITION)) + new EntityAttributeModifier(HEAD_UUID, "Mask damage boost", 4, + EntityAttributeModifier.Operation.ADDITION)) .build(); public MaskItem(Block wallBlock, Settings settings) { @@ -66,7 +68,7 @@ protected BlockState getPlacementState(ItemPlacementContext context) { return blockState != null && world.canPlace(blockState, blockPos, ShapeContext.absent()) ? blockState : null; } - public static EquipmentSlot getSlotType() { + public EquipmentSlot getSlotType() { return EquipmentSlot.HEAD; } diff --git a/src/main/java/com/kpabr/backrooms/mixins/BackgroundRendererMixin.java b/src/main/java/com/kpabr/backrooms/mixins/BackgroundRendererMixin.java index 527f89b..f296135 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/BackgroundRendererMixin.java +++ b/src/main/java/com/kpabr/backrooms/mixins/BackgroundRendererMixin.java @@ -2,17 +2,11 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyVariable; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import com.mojang.blaze3d.systems.RenderSystem; import com.kpabr.backrooms.init.BackroomsLevels; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.BackgroundRenderer; -import net.minecraft.client.render.BackgroundRenderer.FogType; -import net.minecraft.client.render.Camera; @Mixin(BackgroundRenderer.class) public abstract class BackgroundRendererMixin { @@ -25,23 +19,4 @@ public abstract class BackgroundRendererMixin { } return in; } - - @Inject(method = "Lnet/minecraft/client/render/BackgroundRenderer;applyFog(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/BackgroundRenderer$FogType;FZ)V", at = @At("TAIL")) - private static void corners$applyFog(Camera camera, FogType fogType, float viewDistance, boolean thickFog, CallbackInfo ci) { - MinecraftClient client = MinecraftClient.getInstance(); - float fogStart = RenderSystem.getShaderFogStart(); - float fogEnd = RenderSystem.getShaderFogEnd(); - - /*if (client.world.getRegistryKey().equals(CornerWorld.HOARY_CROSSROADS.getWorldKey())) { - fogStart = fogStart / 2; - fogEnd = fogEnd / 2; - float cameraHeight = (float) (camera.getPos().getY() - client.world.getBottomY()); - float fogScalar = (float) MathHelper.clamp(Math.atan(((cameraHeight - 263.0F) * Math.tan(1)) / 263.0F) + 1, 0.0F, 1.0F); - RenderSystem.setShaderFogStart(fogStart * fogScalar); - RenderSystem.setShaderFogEnd(fogEnd * fogScalar); - } - - */ - } - } diff --git a/src/main/java/com/kpabr/backrooms/mixins/BlockRenderManagerMixin.java b/src/main/java/com/kpabr/backrooms/mixins/BlockRenderManagerMixin.java index 17453f1..b744613 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/BlockRenderManagerMixin.java +++ b/src/main/java/com/kpabr/backrooms/mixins/BlockRenderManagerMixin.java @@ -8,7 +8,6 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import com.kpabr.backrooms.access.BlockRenderManagerAccess; -import com.kpabr.backrooms.client.render.sky.RemoveSkyboxQuadsBakedModel; import net.minecraft.block.BlockState; import net.minecraft.client.render.block.BlockModels; import net.minecraft.client.render.block.BlockRenderManager; diff --git a/src/main/java/com/kpabr/backrooms/mixins/BrewingRecipeRegistryMixin.java b/src/main/java/com/kpabr/backrooms/mixins/BrewingRecipeRegistryMixin.java index 6ac975c..1650aaa 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/BrewingRecipeRegistryMixin.java +++ b/src/main/java/com/kpabr/backrooms/mixins/BrewingRecipeRegistryMixin.java @@ -14,7 +14,7 @@ public class BrewingRecipeRegistryMixin { @Inject(method = "registerPotionRecipe", at = @At("HEAD")) private static void replaceNetherWartByTilemoldLump(Potion input, Item item, Potion output, CallbackInfo ci) { - if(NetherWartAccessor.getNetherWart().equals(item)) { + if (NetherWartAccessor.getNetherWart().equals(item)) { BrewingRecipeRegistryInvoker.invokeRegisterPotionRecipe(input, BackroomsItems.TILEMOLD_LUMP, output); } } diff --git a/src/main/java/com/kpabr/backrooms/mixins/ChunkBuilderBuiltChunkRebuildTaskMixin.java b/src/main/java/com/kpabr/backrooms/mixins/ChunkBuilderBuiltChunkRebuildTaskMixin.java index e54c08a..9d1e33d 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/ChunkBuilderBuiltChunkRebuildTaskMixin.java +++ b/src/main/java/com/kpabr/backrooms/mixins/ChunkBuilderBuiltChunkRebuildTaskMixin.java @@ -2,7 +2,7 @@ import java.util.Iterator; import java.util.List; -import java.util.Random; +import net.minecraft.util.math.random.Random; import java.util.Set; import org.spongepowered.asm.mixin.Mixin; @@ -34,7 +34,12 @@ public class ChunkBuilderBuiltChunkRebuildTaskMixin { @Inject(method = "Lnet/minecraft/client/render/chunk/ChunkBuilder$BuiltChunk$RebuildTask;render(FFFLnet/minecraft/client/render/chunk/ChunkBuilder$ChunkData;Lnet/minecraft/client/render/chunk/BlockBufferBuilderStorage;)Ljava/util/Set;", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/chunk/ChunkRendererRegion;getBlockState(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;", ordinal = 1, shift = Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILHARD) - private void corners$render(float cameraX, float cameraY, float cameraZ, ChunkBuilder.ChunkData data, BlockBufferBuilderStorage buffers, CallbackInfoReturnable> ci, int i, BlockPos blockPos, BlockPos blockPos2, ChunkOcclusionDataBuilder chunkOcclusionDataBuilder, Set set, ChunkRendererRegion chunkRendererRegion, MatrixStack matrixStack, Random random, BlockRenderManager blockRenderManager, Iterator var15, BlockPos blockPos3, BlockState blockState) { + private void corners$render(float cameraX, float cameraY, float cameraZ, ChunkBuilder.ChunkData data, + BlockBufferBuilderStorage buffers, CallbackInfoReturnable> ci, int i, BlockPos blockPos, + BlockPos blockPos2, ChunkOcclusionDataBuilder chunkOcclusionDataBuilder, Set set, + ChunkRendererRegion chunkRendererRegion, MatrixStack matrixStack, Random random, + BlockRenderManager blockRenderManager, Iterator var15, BlockPos blockPos3, + BlockState blockState) { List quads = Lists.newArrayList(); BakedModel model = ((BlockRenderManagerAccess) blockRenderManager).getModelPure(blockState); SkyboxShaders.addAll(quads, model, blockState, random); diff --git a/src/main/java/com/kpabr/backrooms/mixins/EntityMixin.java b/src/main/java/com/kpabr/backrooms/mixins/EntityMixin.java index 4b99530..d5f0cce 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/EntityMixin.java +++ b/src/main/java/com/kpabr/backrooms/mixins/EntityMixin.java @@ -1,6 +1,5 @@ package com.kpabr.backrooms.mixins; - import com.kpabr.backrooms.config.BackroomsConfig; import com.kpabr.backrooms.init.BackroomsLevels; import net.minecraft.block.BlockState; @@ -11,7 +10,7 @@ import net.minecraft.util.function.BooleanBiFunction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; -import net.minecraft.util.registry.RegistryKey; +import net.minecraft.registry.RegistryKey; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; @@ -28,11 +27,11 @@ public abstract class EntityMixin { @Shadow public abstract @Nullable MinecraftServer getServer(); - @Inject(method="tick", at=@At(value = "HEAD")) + @Inject(method = "tick", at = @At(value = "HEAD")) private void backroomsTick(CallbackInfo ci) { - World world = ((Entity) (Object) this).world; + World world = ((Entity) (Object) this).getWorld(); Entity entity = ((Entity) (Object) this); - + if (entity instanceof ServerPlayerEntity) { if (!world.isClient) { if (isInsideHardBlocks(entity) @@ -41,10 +40,11 @@ private void backroomsTick(CallbackInfo ci) { World levelZero = getServer().getWorld(BackroomsLevels.LEVEL_0_WORLD_KEY); RegistryKey worldKey = world.getRegistryKey(); - if(worldKey == World.OVERWORLD) { + if (worldKey == World.OVERWORLD) { teleportToLevel((ServerPlayerEntity) entity, levelZero); } else if (worldKey == levelZero.getRegistryKey()) { - teleportToLevel((ServerPlayerEntity) entity, getServer().getWorld(BackroomsLevels.LEVEL_1_WORLD_KEY)); + teleportToLevel((ServerPlayerEntity) entity, + getServer().getWorld(BackroomsLevels.LEVEL_1_WORLD_KEY)); } } } @@ -55,19 +55,19 @@ public boolean isInsideHardBlocks(Entity entity) { if (entity.noClip) { return false; } - float f = ((EntityAccessor)entity).getDimension().width * 0.8f; + float f = ((EntityAccessor) entity).getDimension().width * 0.8f; Box box = Box.of(entity.getEyePos(), f, 1.0E-6, f); return BlockPos.stream(box).anyMatch(pos -> { - BlockState blockState = entity.world.getBlockState(pos); + BlockState blockState = entity.getWorld().getBlockState(pos); return !blockState.isAir() // default checks copied from isInsideWall() method - && blockState.shouldSuffocate(entity.world, pos) - && VoxelShapes.matchesAnywhere(blockState.getCollisionShape(entity.world, pos).offset(pos.getX(), pos.getY(), pos.getZ()), VoxelShapes.cuboid(box), BooleanBiFunction.AND) + && blockState.shouldSuffocate(entity.getWorld(), pos) + && VoxelShapes.matchesAnywhere(blockState.getCollisionShape(entity.getWorld(), pos) + .offset(pos.getX(), pos.getY(), pos.getZ()), VoxelShapes.cuboid(box), BooleanBiFunction.AND) // if block isn't falling(so it's not gravel or sand) && !(blockState.getBlock() instanceof FallingBlock); }); } - } diff --git a/src/main/java/com/kpabr/backrooms/mixins/GameRendererMixin.java b/src/main/java/com/kpabr/backrooms/mixins/GameRendererMixin.java index 870e02b..41664c2 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/GameRendererMixin.java +++ b/src/main/java/com/kpabr/backrooms/mixins/GameRendererMixin.java @@ -14,9 +14,8 @@ import com.mojang.datafixers.util.Pair; import com.kpabr.backrooms.client.render.sky.SkyboxShaders; -import net.minecraft.client.gl.Program; +import net.minecraft.client.gl.ShaderProgram; import net.minecraft.client.render.GameRenderer; -import net.minecraft.client.render.Shader; import net.minecraft.client.render.VertexFormats; import net.minecraft.resource.ResourceManager; @@ -24,9 +23,11 @@ public class GameRendererMixin { @Inject(method = "loadShaders", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", ordinal = 53, shift = Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD) - private void corners$loadShaders(ResourceManager manager, CallbackInfo ci, List list, List>> list2) { + private void corners$loadShaders(ResourceManager manager, CallbackInfo ci, List list, + List>> list2) { try { - list2.add(Pair.of(new Shader(manager, "rendertype_corners_skybox", VertexFormats.POSITION), (shader) -> SkyboxShaders.SKYBOX_SHADER = shader)); + list2.add(Pair.of(new ShaderProgram(manager, "rendertype_corners_skybox", VertexFormats.POSITION), + (shader) -> SkyboxShaders.SKYBOX_SHADER = shader)); } catch (IOException e) { list2.forEach((pair) -> { pair.getFirst().close(); diff --git a/src/main/java/com/kpabr/backrooms/mixins/InGameHudMixin.java b/src/main/java/com/kpabr/backrooms/mixins/InGameHudMixin.java index 8f9dd77..27cf1fc 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/InGameHudMixin.java +++ b/src/main/java/com/kpabr/backrooms/mixins/InGameHudMixin.java @@ -1,19 +1,15 @@ package com.kpabr.backrooms.mixins; - -import com.kpabr.backrooms.client.BackroomsClient; import com.kpabr.backrooms.init.BackroomStatusEffects; import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.client.render.*; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.Identifier; -import net.minecraft.util.math.MathHelper; -import net.minecraft.world.border.WorldBorder; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -24,23 +20,30 @@ @Mixin(InGameHud.class) public abstract class InGameHudMixin { - @Shadow @Final private MinecraftClient client; + @Shadow + @Final + private MinecraftClient client; - @Shadow private int scaledWidth; - @Shadow private int scaledHeight; - @Shadow public float vignetteDarkness; + @Shadow + private int scaledWidth; + @Shadow + private int scaledHeight; + @Shadow + public float vignetteDarkness; private static final Identifier VIGNETTE_TEXTURE = new Identifier("textures/misc/vignette.png"); @Environment(EnvType.CLIENT) @Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;enableBlend()V", shift = At.Shift.AFTER), slice = @Slice(from = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;enableBlend()V"), to = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getLastFrameDuration()F"))) - private void renderWretchedVignette(MatrixStack matrices, float tickDelta, CallbackInfo ci) { - boolean wretchedCycleEffects = client.player.hasStatusEffect(BackroomStatusEffects.ROTTEN) || client.player.hasStatusEffect(BackroomStatusEffects.WRETCHED); - if(wretchedCycleEffects) { + private void renderWretchedVignette(DrawContext context, float tickDelta, CallbackInfo ci) { + boolean wretchedCycleEffects = client.player.hasStatusEffect(BackroomStatusEffects.ROTTEN) + || client.player.hasStatusEffect(BackroomStatusEffects.WRETCHED); + if (wretchedCycleEffects) { RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); - RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.ZERO, GlStateManager.DstFactor.ONE_MINUS_SRC_COLOR, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO); + RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.ZERO, GlStateManager.DstFactor.ONE_MINUS_SRC_COLOR, + GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ZERO); RenderSystem.setShaderColor(0f, 1f, 1f, 1f); - RenderSystem.setShader(GameRenderer::getPositionTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexProgram); RenderSystem.setShaderTexture(0, VIGNETTE_TEXTURE); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferBuilder = tessellator.getBuffer(); diff --git a/src/main/java/com/kpabr/backrooms/mixins/ItemRendererMixin.java b/src/main/java/com/kpabr/backrooms/mixins/ItemRendererMixin.java index f7cc0e9..ea4bed2 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/ItemRendererMixin.java +++ b/src/main/java/com/kpabr/backrooms/mixins/ItemRendererMixin.java @@ -21,6 +21,7 @@ import com.kpabr.backrooms.client.render.sky.RemoveSkyboxQuadsBakedModel; import com.kpabr.backrooms.client.render.sky.SkyboxShaders; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.world.WorldCreator.Mode; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.BufferRenderer; import net.minecraft.client.render.Camera; @@ -31,14 +32,13 @@ import net.minecraft.client.render.item.ItemRenderer; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedQuad; -import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.Identifier; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Matrix4f; -import net.minecraft.util.math.Vec3f; +import org.joml.Matrix4f; +import org.joml.Quaternionf; import net.minecraft.world.World; @Mixin(ItemRenderer.class) @@ -48,7 +48,8 @@ public abstract class ItemRendererMixin implements ItemRendererAccess { private boolean isPure = false; @Override - public BakedModel getItemModelPure(ItemStack stack, @Nullable World world, @Nullable LivingEntity entity, int seed) { + public BakedModel getItemModelPure(ItemStack stack, @Nullable World world, @Nullable LivingEntity entity, + int seed) { isPure = true; BakedModel model = this.getModel(stack, world, entity, seed); isPure = false; @@ -56,15 +57,19 @@ public BakedModel getItemModelPure(ItemStack stack, @Nullable World world, @Null } @Inject(method = "getModel", at = @At("RETURN"), cancellable = true) - public void corners$getModel(ItemStack stack, @Nullable World world, @Nullable LivingEntity entity, int seed, CallbackInfoReturnable ci) { + public void corners$getModel(ItemStack stack, @Nullable World world, @Nullable LivingEntity entity, int seed, + CallbackInfoReturnable ci) { if (!isPure) { ci.setReturnValue(new RemoveSkyboxQuadsBakedModel(ci.getReturnValue())); } } @Inject(method = "Lnet/minecraft/client/render/item/ItemRenderer;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/ItemRenderer;renderBakedItemModel(Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/item/ItemStack;IILnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;)V", shift = Shift.AFTER)) - public void corners$renderItem(ItemStack stack, ModelTransformation.Mode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model, CallbackInfo ci) { - BakedModel bakedModel = ((ItemRendererAccess) (ItemRenderer) (Object) this).getItemModelPure(stack, null, null, 0); + public void corners$renderItem(ItemStack stack, Mode renderMode, boolean leftHanded, MatrixStack matrices, + VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model, CallbackInfo ci) + throws CloneNotSupportedException { + BakedModel bakedModel = ((ItemRendererAccess) (ItemRenderer) (Object) this).getItemModelPure(stack, null, null, + 0); List quads = Lists.newArrayList(); SkyboxShaders.addAll(quads, bakedModel, null); for (Direction dir : Direction.values()) { @@ -74,7 +79,8 @@ public BakedModel getItemModelPure(ItemStack stack, @Nullable World world, @Null RenderSystem.enableBlend(); RenderSystem.enableDepthTest(); - RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA); + RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, + GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA); RenderSystem.depthMask(true); RenderSystem.polygonOffset(3.0F, 3.0F); RenderSystem.enablePolygonOffset(); @@ -85,29 +91,33 @@ public BakedModel getItemModelPure(ItemStack stack, @Nullable World world, @Null MatrixStack modelViewStack = RenderSystem.getModelViewStack(); modelViewStack.push(); - Matrix4f matrix = matrices.peek().getPositionMatrix().copy(); + Matrix4f matrix = (Matrix4f) matrices.peek().getPositionMatrix().clone(); - matrix.loadIdentity(); - matrix.multiply(Vec3f.NEGATIVE_Y.getDegreesQuaternion(180)); - matrix.multiply(Vec3f.NEGATIVE_Y.getDegreesQuaternion(camera.getYaw())); - matrix.multiply(Vec3f.NEGATIVE_X.getDegreesQuaternion(camera.getPitch())); - matrix.multiply(matrices.peek().getPositionMatrix().copy()); + matrix.identity(); + matrix.rotateY((float) Math.toRadians(180)); + matrix.rotateY((float) Math.toRadians(camera.getYaw())); + matrix.rotateX((float) Math.toRadians(camera.getPitch())); + matrix.mul((Matrix4f) matrices.peek().getPositionMatrix().clone()); - modelViewStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); - modelViewStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw())); - modelViewStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180)); + Quaternionf rotation = new Quaternionf(); + rotation.rotateX((float) Math.toRadians(-camera.getPitch())); + rotation.rotateY((float) Math.toRadians(-camera.getYaw())); + rotation.rotateY((float) Math.toRadians(-180)); + modelViewStack.multiply(rotation); RenderSystem.applyModelViewMatrix(); while (quadIterator.hasNext()) { BakedQuad quad = quadIterator.next(); RenderSystem.setShader(() -> SkyboxShaders.SKYBOX_SHADER); for (int i = 0; i < 6; i++) { - RenderSystem.setShaderTexture(i, new Identifier(quad.getSprite().getId().getNamespace(), "textures/" + quad.getSprite().getId().getPath() + "_" + i + ".png")); + RenderSystem.setShaderTexture(i, new Identifier(quad.getSprite().getAtlasId().getNamespace(), + "textures/" + quad.getSprite().getAtlasId().getPath() + "_" + i + ".png")); } - SkyboxShaders.quad((vec3f) -> bufferBuilder.vertex(vec3f.getX(), vec3f.getY(), vec3f.getZ()).next(), matrix, quad); + SkyboxShaders.quad((vector3f) -> bufferBuilder.vertex(vector3f.x, vector3f.y, vector3f.z).next(), matrix, + quad); } - bufferBuilder.end(); - BufferRenderer.draw(bufferBuilder); + + BufferRenderer.draw(bufferBuilder.end()); RenderSystem.polygonOffset(0.0F, 0.0F); RenderSystem.disablePolygonOffset(); modelViewStack.pop(); @@ -117,6 +127,7 @@ public BakedModel getItemModelPure(ItemStack stack, @Nullable World world, @Null } @Shadow - public abstract BakedModel getModel(ItemStack stack, @Nullable World world, @Nullable LivingEntity entity, int seed); + public abstract BakedModel getModel(ItemStack stack, @Nullable World world, @Nullable LivingEntity entity, + int seed); } diff --git a/src/main/java/com/kpabr/backrooms/mixins/LivingEntityMixin.java b/src/main/java/com/kpabr/backrooms/mixins/LivingEntityMixin.java index 4030565..449494d 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/LivingEntityMixin.java +++ b/src/main/java/com/kpabr/backrooms/mixins/LivingEntityMixin.java @@ -13,7 +13,7 @@ public class LivingEntityMixin { @Inject(at = @At("HEAD"), method = "getPreferredEquipmentSlot(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/entity/EquipmentSlot;", cancellable = true) private static void getPreferredEquipmentSlot(ItemStack stack, CallbackInfoReturnable cir) { - if(stack.getItem() instanceof MaskItem) { + if (stack.getItem() instanceof MaskItem) { cir.setReturnValue(EquipmentSlot.HEAD); } } diff --git a/src/main/java/com/kpabr/backrooms/mixins/PlayerScreenHandlerMixin.java b/src/main/java/com/kpabr/backrooms/mixins/PlayerScreenHandlerMixin.java index 8d27a9c..e4217af 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/PlayerScreenHandlerMixin.java +++ b/src/main/java/com/kpabr/backrooms/mixins/PlayerScreenHandlerMixin.java @@ -19,8 +19,7 @@ @Mixin(PlayerScreenHandler.class) public abstract class PlayerScreenHandlerMixin { - @Inject(at = @At("TAIL"), - method = "(Lnet/minecraft/entity/player/PlayerInventory;ZLnet/minecraft/entity/player/PlayerEntity;)V") + @Inject(at = @At("TAIL"), method = "(Lnet/minecraft/entity/player/PlayerInventory;ZLnet/minecraft/entity/player/PlayerEntity;)V") private void reInitHeadSlot(PlayerInventory inventory, boolean onServer, PlayerEntity owner, CallbackInfo ci) { Slot slot = new Slot(inventory, 39, 8, 8 + 0 * 18) { public int getMaxItemCount() { @@ -34,7 +33,10 @@ public boolean canInsert(ItemStack stack) { public boolean canTakeItems(PlayerEntity playerEntity) { final ItemStack itemStack = this.getStack(); return !itemStack.isEmpty() && !playerEntity.isCreative() - && (EnchantmentHelper.hasBindingCurse(itemStack) || (itemStack.getItem() instanceof MaskItem && playerEntity.getHealth() <= 5.0F)) ? false : super.canTakeItems(playerEntity); + && (EnchantmentHelper.hasBindingCurse(itemStack) + || (itemStack.getItem() instanceof MaskItem && playerEntity.getHealth() <= 5.0F)) + ? false + : super.canTakeItems(playerEntity); } public Pair getBackgroundSprite() { diff --git a/src/main/java/com/kpabr/backrooms/mixins/RenderLayerAccessor.java b/src/main/java/com/kpabr/backrooms/mixins/RenderLayerAccessor.java index 4f63611..fd55ad9 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/RenderLayerAccessor.java +++ b/src/main/java/com/kpabr/backrooms/mixins/RenderLayerAccessor.java @@ -10,7 +10,9 @@ public interface RenderLayerAccessor { @Invoker - static RenderLayer.MultiPhase callOf(String name, VertexFormat vertexFormat, VertexFormat.DrawMode drawMode, int expectedBufferSize, boolean hasCrumbling, boolean translucent, RenderLayer.MultiPhaseParameters phases) { + static RenderLayer.MultiPhase callOf(String name, VertexFormat vertexFormat, VertexFormat.DrawMode drawMode, + int expectedBufferSize, boolean hasCrumbling, boolean translucent, + RenderLayer.MultiPhaseParameters phases) { throw new UnsupportedOperationException(); } diff --git a/src/main/java/com/kpabr/backrooms/mixins/ScreenHandlerAccessor.java b/src/main/java/com/kpabr/backrooms/mixins/ScreenHandlerAccessor.java index 8232aad..8a1d870 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/ScreenHandlerAccessor.java +++ b/src/main/java/com/kpabr/backrooms/mixins/ScreenHandlerAccessor.java @@ -6,9 +6,6 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -import net.minecraft.client.sound.SoundManager; -import net.minecraft.client.sound.SoundSystem; - @Mixin(ScreenHandler.class) public interface ScreenHandlerAccessor { diff --git a/src/main/java/com/kpabr/backrooms/mixins/ServerPlayerInteractionManagerMixin.java b/src/main/java/com/kpabr/backrooms/mixins/ServerPlayerInteractionManagerMixin.java index 525dc3f..90fe0f9 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/ServerPlayerInteractionManagerMixin.java +++ b/src/main/java/com/kpabr/backrooms/mixins/ServerPlayerInteractionManagerMixin.java @@ -13,12 +13,13 @@ @Mixin(ServerPlayerInteractionManager.class) public abstract class ServerPlayerInteractionManagerMixin { - @Shadow @Final + @Shadow + @Final protected ServerPlayerEntity player; @Inject(method = "setGameMode(Lnet/minecraft/world/GameMode;Lnet/minecraft/world/GameMode;)V", at = @At("HEAD")) private void removeWretchedCycleEffects(GameMode gameMode, GameMode previousGameMode, CallbackInfo ci) { - if(previousGameMode.isSurvivalLike() && (gameMode == GameMode.CREATIVE || gameMode == GameMode.SPECTATOR)) { + if (previousGameMode.isSurvivalLike() && (gameMode == GameMode.CREATIVE || gameMode == GameMode.SPECTATOR)) { player.removeStatusEffect(BackroomStatusEffects.RAGGED); player.removeStatusEffect(BackroomStatusEffects.ROTTEN); player.removeStatusEffect(BackroomStatusEffects.WRETCHED); diff --git a/src/main/java/com/kpabr/backrooms/mixins/WorldRendererMixin.java b/src/main/java/com/kpabr/backrooms/mixins/WorldRendererMixin.java index 18df6d6..70eefb8 100644 --- a/src/main/java/com/kpabr/backrooms/mixins/WorldRendererMixin.java +++ b/src/main/java/com/kpabr/backrooms/mixins/WorldRendererMixin.java @@ -2,7 +2,7 @@ import java.util.Iterator; import java.util.List; -import java.util.Random; +import net.minecraft.util.math.random.Random; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -45,8 +45,9 @@ import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Matrix4f; -import net.minecraft.util.math.Vec3f; + +import org.joml.Matrix4f; +import org.joml.Quaternionf; @Environment(EnvType.CLIENT) @Mixin(value = WorldRenderer.class, priority = 1001) @@ -64,14 +65,18 @@ public class WorldRendererMixin { private ObjectArrayList chunkInfos; @Inject(method = "Lnet/minecraft/client/render/WorldRenderer;render(Lnet/minecraft/client/util/math/MatrixStack;FJZLnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/GameRenderer;Lnet/minecraft/client/render/LightmapTextureManager;Lnet/minecraft/util/math/Matrix4f;)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;clear(IZ)V", shift = At.Shift.AFTER, remap = false)) - private void corners$render$clear(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, CallbackInfo ci) { + private void corners$render$clear(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, + Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, + Matrix4f positionMatrix, CallbackInfo ci) { if (!FabricLoader.getInstance().isModLoaded("iris")) { this.corners$render$skyboxQuads(matrices, camera); } } @Inject(method = "Lnet/minecraft/client/render/WorldRenderer;render(Lnet/minecraft/client/util/math/MatrixStack;FJZLnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/GameRenderer;Lnet/minecraft/client/render/LightmapTextureManager;Lnet/minecraft/util/math/Matrix4f;)V", at = @At(value = "RETURN", shift = Shift.BEFORE)) - private void corners$render$return(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, CallbackInfo ci) { + private void corners$render$return(MatrixStack matrices, float tickDelta, long limitTime, + boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, + LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, CallbackInfo ci) { if (FabricLoader.getInstance().isModLoaded("iris")) { this.corners$render$skyboxQuads(matrices, camera); } @@ -81,7 +86,8 @@ public class WorldRendererMixin { private void corners$render$skyboxQuads(MatrixStack matrices, Camera camera) { RenderSystem.enableBlend(); RenderSystem.enableDepthTest(); - RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA); + RenderSystem.blendFuncSeparate(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA, + GlStateManager.SrcFactor.ONE, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA); RenderSystem.depthMask(true); RenderSystem.polygonOffset(3.0F, 3.0F); RenderSystem.enablePolygonOffset(); @@ -90,24 +96,26 @@ public class WorldRendererMixin { MatrixStack modelViewStack = RenderSystem.getModelViewStack(); modelViewStack.push(); - modelViewStack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch())); - modelViewStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw())); - modelViewStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180)); + modelViewStack.multiply(new Quaternionf().rotateX((float) Math.toRadians(camera.getPitch()))); + modelViewStack.multiply(new Quaternionf().rotateY((float) Math.toRadians(camera.getYaw()))); + modelViewStack.multiply(new Quaternionf().rotateY((float) Math.toRadians(180))); RenderSystem.applyModelViewMatrix(); this.getSkyboxPairs().forEach((pair) -> { BlockPos pos = pair.getFirst(); BlockState state = pair.getSecond(); matrices.push(); - matrices.translate(pos.getX() - camera.getPos().getX(), pos.getY() - camera.getPos().getY(), pos.getZ() - camera.getPos().getZ()); + matrices.translate(pos.getX() - camera.getPos().getX(), pos.getY() - camera.getPos().getY(), + pos.getZ() - camera.getPos().getZ()); List quads = Lists.newArrayList(); - BakedModel model = ((BlockRenderManagerAccess) MinecraftClient.getInstance().getBlockRenderManager()).getModelPure(state); - SkyboxShaders.addAll(quads, model, state, new Random(state.getRenderingSeed(pos))); + BakedModel model = ((BlockRenderManagerAccess) MinecraftClient.getInstance().getBlockRenderManager()) + .getModelPure(state); + SkyboxShaders.addAll(quads, model, state, Random.create(state.getRenderingSeed(pos))); for (Direction dir : Direction.values()) { if (Block.shouldDrawSide(state, world, pos, dir, pos.offset(dir))) { - SkyboxShaders.addAll(quads, model, state, dir, new Random(state.getRenderingSeed(pos))); + SkyboxShaders.addAll(quads, model, state, dir, Random.create(state.getRenderingSeed(pos))); } } @@ -117,23 +125,31 @@ public class WorldRendererMixin { BakedQuad quad = quadIterator.next(); RenderSystem.setShader(() -> SkyboxShaders.SKYBOX_SHADER); for (int i = 0; i < 6; i++) { - RenderSystem.setShaderTexture(i, new Identifier(quad.getSprite().getId().getNamespace(), "textures/" + quad.getSprite().getId().getPath() + "_" + i + ".png")); + RenderSystem.setShaderTexture(i, new Identifier(quad.getSprite().getAtlasId().getNamespace(), + "textures/" + quad.getSprite().getAtlasId().getPath() + "_" + i + ".png")); } - Matrix4f matrix = matrices.peek().getPositionMatrix().copy(); - matrix.loadIdentity(); - matrix.multiply(Vec3f.NEGATIVE_Y.getDegreesQuaternion(180)); - matrix.multiply(Vec3f.NEGATIVE_Y.getDegreesQuaternion(camera.getYaw())); - matrix.multiply(Vec3f.NEGATIVE_X.getDegreesQuaternion(camera.getPitch())); - matrix.multiply(matrices.peek().getPositionMatrix().copy()); + Matrix4f matrix = (Matrix4f) matrices.peek().getPositionMatrix(); + matrix.identity(); + + Matrix4f rotationMatrix = new Matrix4f(); + new Quaternionf().rotateY((float) Math.toRadians(180)).get(rotationMatrix); + matrix.mul(rotationMatrix); + + new Quaternionf().rotateY((float) Math.toRadians(camera.getYaw())).get(rotationMatrix); + matrix.mul(rotationMatrix); + + new Quaternionf().rotateX((float) Math.toRadians(camera.getPitch())).get(rotationMatrix); + matrix.mul(rotationMatrix); + + matrix.mul((Matrix4f) matrices.peek().getPositionMatrix()); - SkyboxShaders.quad((vec3f) -> bufferBuilder.vertex(vec3f.getX(), vec3f.getY(), vec3f.getZ()).next(), matrix, quad); + SkyboxShaders.quad((vec3f) -> bufferBuilder.vertex(vec3f.x, vec3f.y, vec3f.z).next(), matrix, quad); } matrices.pop(); }); - bufferBuilder.end(); - BufferRenderer.draw(bufferBuilder); + BufferRenderer.draw(bufferBuilder.end()); RenderSystem.polygonOffset(0.0F, 0.0F); RenderSystem.disablePolygonOffset(); modelViewStack.pop(); @@ -145,7 +161,9 @@ public class WorldRendererMixin { @Unique private List> getSkyboxPairs() { List> list = Lists.newArrayList(); - this.chunkInfos.forEach((info) -> ((ContainsSkyboxBlocksAccess) ((WorldRendererChunkInfoAccessor) info).getChunk().data.get()).getSkyboxBlocks().forEach((pos, state) -> list.add(Pair.of(pos, state)))); + this.chunkInfos.forEach( + (info) -> ((ContainsSkyboxBlocksAccess) ((WorldRendererChunkInfoAccessor) info).getChunk().data.get()) + .getSkyboxBlocks().forEach((pos, state) -> list.add(Pair.of(pos, state)))); return list; } diff --git a/src/main/java/com/kpabr/backrooms/particle/FireSaltParticle.java b/src/main/java/com/kpabr/backrooms/particle/FireSaltParticle.java index 1fb1045..ac412e1 100644 --- a/src/main/java/com/kpabr/backrooms/particle/FireSaltParticle.java +++ b/src/main/java/com/kpabr/backrooms/particle/FireSaltParticle.java @@ -10,9 +10,7 @@ import net.minecraft.client.particle.SpriteBillboardParticle; import net.minecraft.client.world.ClientWorld; import net.minecraft.item.ItemStack; -import net.minecraft.item.Items; import net.minecraft.particle.DefaultParticleType; -import net.minecraft.particle.ItemStackParticleEffect; @Environment(EnvType.CLIENT) public class FireSaltParticle extends SpriteBillboardParticle { diff --git a/src/main/java/com/kpabr/backrooms/util/BiomeListBuilder.java b/src/main/java/com/kpabr/backrooms/util/BiomeListBuilder.java index 4218633..cd889aa 100644 --- a/src/main/java/com/kpabr/backrooms/util/BiomeListBuilder.java +++ b/src/main/java/com/kpabr/backrooms/util/BiomeListBuilder.java @@ -1,6 +1,6 @@ package com.kpabr.backrooms.util; -import net.minecraft.util.registry.RegistryKey; +import net.minecraft.registry.RegistryKey; import net.minecraft.world.biome.Biome; import java.util.*; diff --git a/src/main/java/com/kpabr/backrooms/util/BiomeRegistryList.java b/src/main/java/com/kpabr/backrooms/util/BiomeRegistryList.java index 09fed7b..3b7fe6a 100644 --- a/src/main/java/com/kpabr/backrooms/util/BiomeRegistryList.java +++ b/src/main/java/com/kpabr/backrooms/util/BiomeRegistryList.java @@ -1,7 +1,7 @@ package com.kpabr.backrooms.util; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryEntry; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.world.biome.Biome; import java.util.HashMap; @@ -16,7 +16,7 @@ public Stream> getBiomeEntries() { } public RegistryEntry findNearest(LevelParameters params) { - + LevelParameters mostSimilarKey = null; double smallestDistance = Float.MAX_VALUE; @@ -43,12 +43,10 @@ private double calculateDistance(LevelParameters key, LevelParameters params) { return (double) Math.sqrt(sum); } - public static BiomeRegistryList from(Registry biomeRegistry, BiomeListBuilder biomeList) { + public static BiomeRegistryList from(BiomeListBuilder biomeList, RegistryEntryLookup biomeRegistry) { final BiomeRegistryList list = new BiomeRegistryList(); - biomeList.getBiomeList().forEach((key, value) -> - list.biomeList.put(key, biomeRegistry.getOrCreateEntry(value)) - ); + biomeList.getBiomeList().forEach((key, value) -> list.biomeList.put(key, biomeRegistry.getOrThrow(value))); return list; } } \ No newline at end of file diff --git a/src/main/java/com/kpabr/backrooms/util/Color.java b/src/main/java/com/kpabr/backrooms/util/Color.java index 332641e..e8d30ad 100644 --- a/src/main/java/com/kpabr/backrooms/util/Color.java +++ b/src/main/java/com/kpabr/backrooms/util/Color.java @@ -97,21 +97,28 @@ public double[] toHSB() { int cmin = NumberUtils.min(r, g, b); brightness = (double) cmax / 255.0d; - if (cmax != 0) saturation = (double) (cmax - cmin) / (double) cmax; - else saturation = 0; + if (cmax != 0) + saturation = (double) (cmax - cmin) / (double) cmax; + else + saturation = 0; - if (saturation == 0) hue = 0; + if (saturation == 0) + hue = 0; else { double redc = (double) (cmax - r) / (double) (cmax - cmin); double greenc = (double) (cmax - g) / (double) (cmax - cmin); double bluec = (double) (cmax - b) / (double) (cmax - cmin); - if (r == cmax) hue = bluec - greenc; - else if (g == cmax) hue = 2.0f + redc - bluec; - else hue = 4.0f + greenc - redc; + if (r == cmax) + hue = bluec - greenc; + else if (g == cmax) + hue = 2.0f + redc - bluec; + else + hue = 4.0f + greenc - redc; hue /= 6.0f; - if (hue < 0) hue += 1.0f; + if (hue < 0) + hue += 1.0f; } hsbvals[0] = hue; hsbvals[1] = saturation; @@ -144,7 +151,8 @@ public Color sepia() { } public Color boost(int r, int g, int b) { - return new Color(Math.max(0, Math.min(255, this.getRed() + r)), Math.max(0, Math.min(255, this.getGreen() + g)), Math.max(0, Math.min(255, this.getBlue() + b))); + return new Color(Math.max(0, Math.min(255, this.getRed() + r)), Math.max(0, Math.min(255, this.getGreen() + g)), + Math.max(0, Math.min(255, this.getBlue() + b))); } public int getRed() { diff --git a/src/main/java/com/kpabr/backrooms/util/ElectricalStationRoom.java b/src/main/java/com/kpabr/backrooms/util/ElectricalStationRoom.java index de4796d..283b6c6 100644 --- a/src/main/java/com/kpabr/backrooms/util/ElectricalStationRoom.java +++ b/src/main/java/com/kpabr/backrooms/util/ElectricalStationRoom.java @@ -1,16 +1,18 @@ package com.kpabr.backrooms.util; -import net.minecraft.util.math.MathHelper; import java.util.Random; + +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; public class ElectricalStationRoom { public int eastWallX, westWallX, southWallZ, northWallZ; public boolean eastHallway, southHallway; + public ElectricalStationRoom(int floor, int startX, int startZ, long seed) { - Random random = new Random(seed + MathHelper.hashCode(startX, startZ, floor)); - int temporaryX = random.nextInt(10)+3; - int temporaryZ = random.nextInt(10)+3; + Random random = new Random(seed + BlockPos.asLong(startX, startX, floor)); + int temporaryX = random.nextInt(10) + 3; + int temporaryZ = random.nextInt(10) + 3; this.eastWallX = Math.max(temporaryX + 2, temporaryX + random.nextInt(14 - temporaryX)); this.westWallX = Math.min(temporaryX - 2, temporaryX - random.nextInt(temporaryX - 1)); this.southWallZ = Math.max(temporaryZ + 2, temporaryZ + random.nextInt(14 - temporaryZ)); @@ -19,7 +21,8 @@ public ElectricalStationRoom(int floor, int startX, int startZ, long seed) { this.southHallway = random.nextInt(3) < 2; } - public ElectricalStationRoom() {} + public ElectricalStationRoom() { + } public void setValues(int eastX, int westX, int southZ, int northZ) { this.eastWallX = eastX; @@ -27,10 +30,12 @@ public void setValues(int eastX, int westX, int southZ, int northZ) { this.southWallZ = southZ; this.northWallZ = northZ; } + public void setValues(boolean east, boolean south) { this.eastHallway = east; this.southHallway = south; } + public void setValues(int eastX, int westX, int southZ, int northZ, boolean east, boolean south) { this.eastWallX = eastX; this.westWallX = westX; @@ -40,42 +45,41 @@ public void setValues(int eastX, int westX, int southZ, int northZ, boolean east this.southHallway = south; } - public static ElectricalStationRoom hallwayBetween(ElectricalStationRoom room1, ElectricalStationRoom room2, Direction direction){ + public static ElectricalStationRoom hallwayBetween(ElectricalStationRoom room1, ElectricalStationRoom room2, + Direction direction) { ElectricalStationRoom result = new ElectricalStationRoom(); - if(direction==Direction.EAST||direction==Direction.WEST){ - if(room1.northWallZ + 1 < room2.southWallZ && room2.northWallZ + 1 < room1.southWallZ){ + if (direction == Direction.EAST || direction == Direction.WEST) { + if (room1.northWallZ + 1 < room2.southWallZ && room2.northWallZ + 1 < room1.southWallZ) { final int middleResult = middle(room1.southWallZ, room1.northWallZ, room2.southWallZ, room2.northWallZ); - if(direction==Direction.WEST){ - result.setValues(room1.westWallX - 1,0,middleResult + 1,middleResult - 1); - } - else{ - result.setValues(15,room1.eastWallX + 1,middleResult + 1,middleResult - 1); + if (direction == Direction.WEST) { + result.setValues(room1.westWallX - 1, 0, middleResult + 1, middleResult - 1); + } else { + result.setValues(15, room1.eastWallX + 1, middleResult + 1, middleResult - 1); } - } - else { + } else { result.setValues(0, 15, 0, 15); } - } - else{ - if(room1.westWallX + 1 < room2.eastWallX && room2.westWallX + 1 < room1.eastWallX){ + } else { + if (room1.westWallX + 1 < room2.eastWallX && room2.westWallX + 1 < room1.eastWallX) { final int middleResult = middle(room1.eastWallX, room1.westWallX, room2.eastWallX, room2.westWallX); - if(direction==Direction.NORTH){ - result.setValues(middleResult + 1,middleResult - 1,room1.northWallZ - 1,0); - } - else{ - result.setValues(middleResult + 1,middleResult - 1,15,room1.southWallZ + 1); + if (direction == Direction.NORTH) { + result.setValues(middleResult + 1, middleResult - 1, room1.northWallZ - 1, 0); + } else { + result.setValues(middleResult + 1, middleResult - 1, 15, room1.southWallZ + 1); } - } - else { + } else { result.setValues(0, 15, 0, 15); } } - if((direction==Direction.EAST && !room1.eastHallway) || (direction==Direction.WEST && !room2.eastHallway) || (direction==Direction.SOUTH && !room1.southHallway) || (direction==Direction.NORTH && !room2.southHallway)){ + if ((direction == Direction.EAST && !room1.eastHallway) || (direction == Direction.WEST && !room2.eastHallway) + || (direction == Direction.SOUTH && !room1.southHallway) + || (direction == Direction.NORTH && !room2.southHallway)) { result.setValues(0, 15, 0, 15); } return result; } - private static int middle(int room1wall1, int room1wall2, int room2wall1, int room2wall2){ + + private static int middle(int room1wall1, int room1wall2, int room2wall1, int room2wall2) { return Math.round((Math.min(room1wall1, room2wall1) + Math.max(room1wall2, room2wall2)) / 2); } } \ No newline at end of file diff --git a/src/main/java/com/kpabr/backrooms/util/EntityHelper.java b/src/main/java/com/kpabr/backrooms/util/EntityHelper.java index 534f62f..4171b8d 100644 --- a/src/main/java/com/kpabr/backrooms/util/EntityHelper.java +++ b/src/main/java/com/kpabr/backrooms/util/EntityHelper.java @@ -6,7 +6,7 @@ import net.minecraft.util.math.Direction; import net.minecraft.world.World; -import java.util.Random; +import net.minecraft.util.math.random.Random; public class EntityHelper { public static void teleportToLevel(ServerPlayerEntity entity, World world) { @@ -24,6 +24,7 @@ public static void teleportToLevel(ServerPlayerEntity entity, World world) { } } - entity.teleport((ServerWorld) world, mutBlockPos.getX() + 0.5, mutBlockPos.getY(), mutBlockPos.getZ() + 0.5, entity.getYaw(), entity.getPitch()); + entity.teleport((ServerWorld) world, mutBlockPos.getX() + 0.5, mutBlockPos.getY(), mutBlockPos.getZ() + 0.5, + entity.getYaw(), entity.getPitch()); } } diff --git a/src/main/java/com/kpabr/backrooms/util/LevelParameters.java b/src/main/java/com/kpabr/backrooms/util/LevelParameters.java index 25020e0..1b49039 100644 --- a/src/main/java/com/kpabr/backrooms/util/LevelParameters.java +++ b/src/main/java/com/kpabr/backrooms/util/LevelParameters.java @@ -1,30 +1,43 @@ package com.kpabr.backrooms.util; public class LevelParameters { - /** * All parameters from 0 to 1, both inclusive - * @param temperature 0: very cold; 0.5: normal; 1: very hot. biomes with similar temperatures will generate near each other - * @param moistness 0: very dry, like dessert; 0.5: normal, like living room; 1: very wet, like water. biomes with similar moistness will generate near each other - * @param integrity 0: completely destructed; 0.5: used, but still ok; 1: completely new. biomes with similar integrity will generate near each other - * @param purity 0: extremely dirty; 0.5: normal; 1: as pure as a disinfectant. biomes with similar purity will generate near each other - * @param toxicity 0 absolutely not toxic or contaminated; 0.5: toxic; 1: extremely toxic or contaminated, cannot survive here for long. biomes with similar toxicity will generate near each other * - * Rareness can be from 0 to technically infinity - * @param rareness 0: too common, every part of the level will be this biome; 0.5: common, use for standard biome; 1: normal, like decrepit biome in level 0; 10: very rare, will most likely not generate + * @param temperature 0: very cold; 0.5: normal; 1: very hot. biomes with + * similar temperatures will generate near each other + * @param moistness 0: very dry, like dessert; 0.5: normal, like living room; + * 1: very wet, like water. biomes with similar moistness + * will generate near each other + * @param integrity 0: completely destructed; 0.5: used, but still ok; 1: + * completely new. biomes with similar integrity will + * generate near each other + * @param purity 0: extremely dirty; 0.5: normal; 1: as pure as a + * disinfectant. biomes with similar purity will generate + * near each other + * @param toxicity 0: absolutely not toxic or contaminated; 0.5: toxic; 1: + * extremely toxic or contaminated, cannot survive here for + * long. biomes with similar toxicity will generate near each + * other + * + * Rareness can be from 0 to technically infinity + * @param rareness 0: too common, every part of the level will be this biome; + * 0.5: common, use for standard biome; 1: normal, like + * decrepit biome in level 0; 10: very rare, will most likely + * not generate */ public final double temperature; public final double moistness; public final double integrity; public final double purity; - public final double toxicity; + public final double toxicity; public final double rareness; - - public LevelParameters(double temperature, double moistness, double integrity, double purity, double toxicity, double rareness) { + public LevelParameters(double temperature, double moistness, double integrity, double purity, double toxicity, + double rareness) { this.temperature = temperature; this.moistness = moistness; this.rareness = rareness; diff --git a/src/main/java/com/kpabr/backrooms/util/MathUtil.java b/src/main/java/com/kpabr/backrooms/util/MathUtil.java index 3cb33fc..cd9c7c8 100644 --- a/src/main/java/com/kpabr/backrooms/util/MathUtil.java +++ b/src/main/java/com/kpabr/backrooms/util/MathUtil.java @@ -8,7 +8,7 @@ public static float getYawBetweenEntities(LivingEntity ownerEntity, LivingEntity double d = targetEntity.getX() - ownerEntity.getX(); double e = targetEntity.getZ() - ownerEntity.getZ(); - float yawAngleBetween = (float)(MathHelper.atan2(e, d) * 57.2957763671875) - 90.0F; + float yawAngleBetween = (float) (MathHelper.atan2(e, d) * 57.2957763671875) - 90.0F; return yawAngleBetween; } } diff --git a/src/main/java/com/kpabr/backrooms/util/NbtPlacerUtil.java b/src/main/java/com/kpabr/backrooms/util/NbtPlacerUtil.java index 54394bb..e94afe5 100644 --- a/src/main/java/com/kpabr/backrooms/util/NbtPlacerUtil.java +++ b/src/main/java/com/kpabr/backrooms/util/NbtPlacerUtil.java @@ -10,6 +10,7 @@ import com.mojang.datafixers.util.Pair; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.nbt.NbtCompound; @@ -19,6 +20,7 @@ import net.minecraft.nbt.NbtInt; import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtList; +import net.minecraft.registry.RegistryEntryLookup; import net.minecraft.resource.Resource; import net.minecraft.resource.ResourceManager; import net.minecraft.util.BlockRotation; @@ -30,7 +32,7 @@ import net.minecraft.world.chunk.Chunk; public class NbtPlacerUtil { - public final NbtCompound storedNbt; + public final NbtCompound storedNbt; public final HashMap> positions; public final NbtList entities; public final BlockPos lowestPos; @@ -38,7 +40,8 @@ public class NbtPlacerUtil { public final int sizeY; public final int sizeZ; - public NbtPlacerUtil(NbtCompound storedNbt, HashMap> positions, NbtList entities, BlockPos lowestPos, int sizeX, int sizeY, int sizeZ) { + public NbtPlacerUtil(NbtCompound storedNbt, HashMap> positions, + NbtList entities, BlockPos lowestPos, int sizeX, int sizeY, int sizeZ) { this.storedNbt = storedNbt; this.positions = positions; this.entities = entities; @@ -48,31 +51,47 @@ public NbtPlacerUtil(NbtCompound storedNbt, HashMap> positions, NbtList entities, BlockPos lowestPos, BlockPos sizePos) { + public NbtPlacerUtil(NbtCompound storedNbt, HashMap> positions, + NbtList entities, BlockPos lowestPos, BlockPos sizePos) { this(storedNbt, positions, entities, lowestPos, sizePos.getX(), sizePos.getY(), sizePos.getZ()); } - public NbtPlacerUtil rotate(BlockRotation rotation) { + public NbtPlacerUtil rotate(BlockRotation rotation, RegistryEntryLookup blockLookup) { NbtList paletteList = storedNbt.getList("palette", 10); HashMap palette = new HashMap(paletteList.size()); - List paletteCompoundList = paletteList.stream().filter(nbtElement -> nbtElement instanceof NbtCompound).map(element -> (NbtCompound) element).toList(); + List paletteCompoundList = paletteList.stream() + .filter(nbtElement -> nbtElement instanceof NbtCompound).map(element -> (NbtCompound) element).toList(); for (int i = 0; i < paletteCompoundList.size(); i++) { - palette.put(i, NbtHelper.toBlockState(paletteCompoundList.get(i)).rotate(rotation)); + palette.put(i, NbtHelper.toBlockState(blockLookup, paletteCompoundList.get(i)).rotate(rotation)); } NbtList sizeList = storedNbt.getList("size", 3); - BlockPos sizeVectorRotated = new BlockPos(sizeList.getInt(0), sizeList.getInt(1), sizeList.getInt(2)).rotate(rotation); - BlockPos sizeVector = new BlockPos(Math.abs(sizeVectorRotated.getX()), Math.abs(sizeVectorRotated.getY()), Math.abs(sizeVectorRotated.getZ())); + BlockPos sizeVectorRotated = new BlockPos(sizeList.getInt(0), sizeList.getInt(1), sizeList.getInt(2)) + .rotate(rotation); + BlockPos sizeVector = new BlockPos(Math.abs(sizeVectorRotated.getX()), Math.abs(sizeVectorRotated.getY()), + Math.abs(sizeVectorRotated.getZ())); NbtList positionsList = storedNbt.getList("blocks", 10); - HashMap> positions = new HashMap>(positionsList.size()); - List>> positionsPairList = positionsList.stream().filter(nbtElement -> nbtElement instanceof NbtCompound).map(element -> (NbtCompound) element).map((nbtCompound) -> Pair.of(new BlockPos(nbtCompound.getList("pos", 3).getInt(0), nbtCompound.getList("pos", 3).getInt(1), nbtCompound.getList("pos", 3).getInt(2)).rotate(rotation), Pair.of(palette.get(nbtCompound.getInt("state")), nbtCompound.getCompound("nbt")))).sorted(Comparator.comparing((pair) -> pair.getFirst().getX())).sorted(Comparator.comparing((pair) -> pair.getFirst().getY())).sorted(Comparator.comparing((pair) -> pair.getFirst().getZ())).toList(); - positionsPairList.forEach((pair) -> positions.put(pair.getFirst().subtract(positionsPairList.get(0).getFirst()), pair.getSecond())); - - return new NbtPlacerUtil(storedNbt, positions, storedNbt.getList("entities", 10), positionsPairList.get(0).getFirst(), sizeVector); + HashMap> positions = new HashMap>( + positionsList.size()); + List>> positionsPairList = positionsList.stream() + .filter(nbtElement -> nbtElement instanceof NbtCompound).map(element -> (NbtCompound) element) + .map((nbtCompound) -> Pair.of( + new BlockPos(nbtCompound.getList("pos", 3).getInt(0), nbtCompound.getList("pos", 3).getInt(1), + nbtCompound.getList("pos", 3).getInt(2)).rotate(rotation), + Pair.of(palette.get(nbtCompound.getInt("state")), nbtCompound.getCompound("nbt")))) + .sorted(Comparator.comparing((pair) -> pair.getFirst().getX())) + .sorted(Comparator.comparing((pair) -> pair.getFirst().getY())) + .sorted(Comparator.comparing((pair) -> pair.getFirst().getZ())).toList(); + positionsPairList.forEach((pair) -> positions.put(pair.getFirst().subtract(positionsPairList.get(0).getFirst()), + pair.getSecond())); + + return new NbtPlacerUtil(storedNbt, positions, storedNbt.getList("entities", 10), + positionsPairList.get(0).getFirst(), sizeVector); } - public static Optional load(ResourceManager manager, Identifier id) { + public static Optional load(ResourceManager manager, Identifier id, + RegistryEntryLookup blockLookup) { try { Optional nbtOptional = loadNbtFromFile(manager, id); if (nbtOptional.isPresent()) { @@ -80,21 +99,34 @@ public static Optional load(ResourceManager manager, Identifier i NbtList paletteList = nbt.getList("palette", 10); HashMap palette = new HashMap(paletteList.size()); - List paletteCompoundList = paletteList.stream().filter(nbtElement -> nbtElement instanceof NbtCompound).map(element -> (NbtCompound) element).toList(); + List paletteCompoundList = paletteList.stream() + .filter(nbtElement -> nbtElement instanceof NbtCompound).map(element -> (NbtCompound) element) + .toList(); for (int i = 0; i < paletteCompoundList.size(); i++) { - palette.put(i, NbtHelper.toBlockState(paletteCompoundList.get(i))); + palette.put(i, NbtHelper.toBlockState(blockLookup, paletteCompoundList.get(i))); } NbtList sizeList = nbt.getList("size", 3); BlockPos sizeVectorRotated = new BlockPos(sizeList.getInt(0), sizeList.getInt(1), sizeList.getInt(2)); - BlockPos sizeVector = new BlockPos(Math.abs(sizeVectorRotated.getX()), Math.abs(sizeVectorRotated.getY()), Math.abs(sizeVectorRotated.getZ())); + BlockPos sizeVector = new BlockPos(Math.abs(sizeVectorRotated.getX()), + Math.abs(sizeVectorRotated.getY()), Math.abs(sizeVectorRotated.getZ())); NbtList positionsList = nbt.getList("blocks", 10); - HashMap> positions = new HashMap>(positionsList.size()); - List>> positionsPairList = positionsList.stream().filter(nbtElement -> nbtElement instanceof NbtCompound).map(element -> (NbtCompound) element).map((nbtCompound) -> Pair.of(new BlockPos(nbtCompound.getList("pos", 3).getInt(0), nbtCompound.getList("pos", 3).getInt(1), nbtCompound.getList("pos", 3).getInt(2)), Pair.of(palette.get(nbtCompound.getInt("state")), nbtCompound.getCompound("nbt")))).sorted(Comparator.comparing((pair) -> pair.getFirst().getX())).sorted(Comparator.comparing((pair) -> pair.getFirst().getY())).sorted(Comparator.comparing((pair) -> pair.getFirst().getZ())).toList(); - positionsPairList.forEach((pair) -> positions.put(pair.getFirst().subtract(positionsPairList.get(0).getFirst()), pair.getSecond())); - - return Optional.of(new NbtPlacerUtil(nbt, positions, nbt.getList("entities", 10), positionsPairList.get(0).getFirst(), sizeVector)); + HashMap> positions = new HashMap>( + positionsList.size()); + List>> positionsPairList = positionsList.stream() + .filter(nbtElement -> nbtElement instanceof NbtCompound).map(element -> (NbtCompound) element) + .map((nbtCompound) -> Pair.of(new BlockPos(nbtCompound.getList("pos", 3).getInt(0), + nbtCompound.getList("pos", 3).getInt(1), nbtCompound.getList("pos", 3).getInt(2)), + Pair.of(palette.get(nbtCompound.getInt("state")), nbtCompound.getCompound("nbt")))) + .sorted(Comparator.comparing((pair) -> pair.getFirst().getX())) + .sorted(Comparator.comparing((pair) -> pair.getFirst().getY())) + .sorted(Comparator.comparing((pair) -> pair.getFirst().getZ())).toList(); + positionsPairList.forEach((pair) -> positions + .put(pair.getFirst().subtract(positionsPairList.get(0).getFirst()), pair.getSecond())); + + return Optional.of(new NbtPlacerUtil(nbt, positions, nbt.getList("entities", 10), + positionsPairList.get(0).getFirst(), sizeVector)); } throw new NullPointerException(); @@ -106,7 +138,7 @@ public static Optional load(ResourceManager manager, Identifier i public static Optional loadNbtFromFile(ResourceManager manager, Identifier id) { try { - return Optional.ofNullable(readStructure(manager.getResource(id))); + return Optional.ofNullable(readStructure(manager.getResource(id).get())); } catch (Exception e) { e.printStackTrace(); return Optional.empty(); @@ -115,11 +147,11 @@ public static Optional loadNbtFromFile(ResourceManager manager, Ide public static NbtCompound readStructure(Resource resource) throws IOException { NbtCompound nbt = NbtIo.readCompressed(resource.getInputStream()); - resource.close(); return nbt; } - public NbtPlacerUtil generateNbt(Chunk region, BlockPos at, TriConsumer consumer) { + public NbtPlacerUtil generateNbt(Chunk region, BlockPos at, + TriConsumer consumer) { for (int xi = 0; xi < this.sizeX; xi++) { for (int yi = 0; yi < this.sizeY; yi++) { for (int zi = 0; zi < this.sizeZ; zi++) { @@ -137,7 +169,8 @@ public NbtPlacerUtil spawnEntities(Chunk region, BlockPos pos, BlockRotation rot this.entities.forEach((nbtElement) -> { NbtCompound entityCompound = (NbtCompound) nbtElement; NbtList nbtPos = entityCompound.getList("blockPos", 3); - Vec3d realPosition = rotate(new Vec3d(nbtPos.getInt(0), nbtPos.getInt(1), nbtPos.getInt(2)), rotation).subtract(Vec3d.of(lowestPos)).add(pos.getX(), pos.getY(), pos.getZ()); + Vec3d realPosition = rotate(new Vec3d(nbtPos.getInt(0), nbtPos.getInt(1), nbtPos.getInt(2)), rotation) + .subtract(Vec3d.of(lowestPos)).add(pos.getX(), pos.getY(), pos.getZ()); NbtCompound nbt = entityCompound.getCompound("nbt").copy(); nbt.remove("Pos"); @@ -166,46 +199,45 @@ public NbtPlacerUtil spawnEntities(Chunk region, BlockPos pos, BlockRotation rot return this; } - public static Vec3d rotate(Vec3d in, BlockRotation rotation) { switch (rotation) { - case NONE: - default: - return in; - case CLOCKWISE_90: - return new Vec3d(-in.getZ(), in.getY(), in.getX()); - case CLOCKWISE_180: - return new Vec3d(-in.getX(), in.getY(), -in.getZ()); - case COUNTERCLOCKWISE_90: - return new Vec3d(in.getZ(), in.getY(), -in.getX()); + case NONE: + default: + return in; + case CLOCKWISE_90: + return new Vec3d(-in.getZ(), in.getY(), in.getX()); + case CLOCKWISE_180: + return new Vec3d(-in.getX(), in.getY(), -in.getZ()); + case COUNTERCLOCKWISE_90: + return new Vec3d(in.getZ(), in.getY(), -in.getX()); } } public static BlockPos rotate(BlockPos in, BlockRotation rotation) { switch (rotation) { - case NONE: - default: - return in; - case CLOCKWISE_90: - return new BlockPos(-in.getZ(), in.getY(), in.getX()); - case CLOCKWISE_180: - return new BlockPos(-in.getX(), in.getY(), -in.getZ()); - case COUNTERCLOCKWISE_90: - return new BlockPos(in.getZ(), in.getY(), -in.getX()); + case NONE: + default: + return in; + case CLOCKWISE_90: + return new BlockPos(-in.getZ(), in.getY(), in.getX()); + case CLOCKWISE_180: + return new BlockPos(-in.getX(), in.getY(), -in.getZ()); + case COUNTERCLOCKWISE_90: + return new BlockPos(in.getZ(), in.getY(), -in.getX()); } } public float applyRotation(float in, BlockRotation rotation) { float f = MathHelper.wrapDegrees(in); switch (rotation) { - case CLOCKWISE_180: - return f + 180.0F; - case COUNTERCLOCKWISE_90: - return f + 270.0F; - case CLOCKWISE_90: - return f + 90.0F; - default: - return f; + case CLOCKWISE_180: + return f + 180.0F; + case COUNTERCLOCKWISE_90: + return f + 270.0F; + case CLOCKWISE_90: + return f + 90.0F; + default: + return f; } } diff --git a/src/main/java/com/kpabr/backrooms/util/RegistryHelper.java b/src/main/java/com/kpabr/backrooms/util/RegistryHelper.java index 4dad8a9..31377f2 100644 --- a/src/main/java/com/kpabr/backrooms/util/RegistryHelper.java +++ b/src/main/java/com/kpabr/backrooms/util/RegistryHelper.java @@ -6,66 +6,68 @@ import net.fabricmc.fabric.api.item.v1.FabricItemSettings; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import com.kpabr.backrooms.BackroomsMod; + import net.minecraft.block.Block; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.datafixer.TypeReferences; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; -import net.minecraft.entity.decoration.painting.PaintingMotive; +import net.minecraft.entity.decoration.painting.PaintingVariant; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.sound.SoundEvent; import net.minecraft.util.Identifier; import net.minecraft.util.Util; -import net.minecraft.util.registry.BuiltinRegistries; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.chunk.ChunkGenerator; public class RegistryHelper { public static > T get(String id, T chunkGenerator) { - return Registry.register(Registry.CHUNK_GENERATOR, BackroomsMod.id(id), chunkGenerator); + return Registry.register(Registries.CHUNK_GENERATOR, BackroomsMod.id(id), chunkGenerator); } - public static RegistryKey get(String id, Biome biome) { - Registry.register(BuiltinRegistries.BIOME, BackroomsMod.id(id), biome); - return RegistryKey.of(Registry.BIOME_KEY, BackroomsMod.id(id)); + public static RegistryKey getBiome(String id) { + RegistryKey key = RegistryKey.of(RegistryKeys.BIOME, BackroomsMod.id(id)); + return key; } public static BlockEntityType get(String id, FabricBlockEntityTypeBuilder builder) { Type type = Util.getChoiceType(TypeReferences.BLOCK_ENTITY, id); - return Registry.register(Registry.BLOCK_ENTITY_TYPE, BackroomsMod.id(id), builder.build(type)); + return Registry.register(Registries.BLOCK_ENTITY_TYPE, BackroomsMod.id(id), builder.build(type)); } - public static T get(String id, T painting) { - return Registry.register(Registry.PAINTING_MOTIVE, BackroomsMod.id(id), painting); + public static T get(String id, T painting) { + return Registry.register(Registries.PAINTING_VARIANT, BackroomsMod.id(id), painting); } public static SoundEvent get(String id) { - return get(id, new SoundEvent(BackroomsMod.id(id))); + return get(id, SoundEvent.of(BackroomsMod.id(id))); } public static T get(String id, T sound) { - return Registry.register(Registry.SOUND_EVENT, BackroomsMod.id(id), sound); + return Registry.register(Registries.SOUND_EVENT, BackroomsMod.id(id), sound); } @Deprecated public static T get(Identifier id, T block) { - return Registry.register(Registry.BLOCK, id, block); + return Registry.register(Registries.BLOCK, id, block); } @Deprecated public static T get(String id, T block) { - return Registry.register(Registry.BLOCK, BackroomsMod.id(id), block); + return Registry.register(Registries.BLOCK, BackroomsMod.id(id), block); } @Deprecated public static T get(String id, T block, ItemGroup group) { - get(id, new BlockItem(block, new FabricItemSettings().group(group))); + get(id, new BlockItem(block, new FabricItemSettings())); return get(id, block); } @@ -77,11 +79,11 @@ public static T get(String id, T block, FabricItemSettings set @Deprecated public static T get(String id, T item) { - return Registry.register(Registry.ITEM, BackroomsMod.id(id), item); + return Registry.register(Registries.ITEM, BackroomsMod.id(id), item); } @Deprecated public static > T get(String id, T entity) { - return Registry.register(Registry.ENTITY_TYPE, BackroomsMod.id(id), entity); + return Registry.register(Registries.ENTITY_TYPE, BackroomsMod.id(id), entity); } } \ No newline at end of file diff --git a/src/main/java/com/kpabr/backrooms/util/SACallbackManager.java b/src/main/java/com/kpabr/backrooms/util/SACallbackManager.java index 6bd8d0f..b8b7af4 100644 --- a/src/main/java/com/kpabr/backrooms/util/SACallbackManager.java +++ b/src/main/java/com/kpabr/backrooms/util/SACallbackManager.java @@ -1,6 +1,5 @@ package com.kpabr.backrooms.util; - import java.util.Timer; import java.util.TimerTask; diff --git a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/CrimsonHallsBiome.java b/src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/CrimsonHallsBiome.java deleted file mode 100644 index 200a626..0000000 --- a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/CrimsonHallsBiome.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.kpabr.backrooms.world.biome.biomes.level0; - -import com.kpabr.backrooms.init.BackroomsEntities; -import com.kpabr.backrooms.init.BackroomsSounds; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BiomeEffects; -import net.minecraft.world.biome.GenerationSettings; -import net.minecraft.world.biome.SpawnSettings; - -public class CrimsonHallsBiome { - public static Biome create() { - SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder(); - spawnSettings.spawn(SpawnGroup.CREATURE, new SpawnSettings.SpawnEntry(BackroomsEntities.HOUND, 100, 1, 1)); - - GenerationSettings.Builder generationSettings = new GenerationSettings.Builder(); - - BiomeEffects.Builder biomeEffects = new BiomeEffects.Builder(); - biomeEffects.skyColor(13776695); - biomeEffects.waterColor(13548960); - biomeEffects.waterFogColor(16735821); - biomeEffects.fogColor(11548232); - biomeEffects.loopSound(BackroomsSounds.HUMBUZZ_LEVEL_0); - BiomeEffects effects = biomeEffects.build(); - - // Configure crimson halls biome - Biome.Builder biome = new Biome.Builder() - .spawnSettings(spawnSettings.build()) - .generationSettings(generationSettings.build()) - .effects(effects) - - .precipitation(Biome.Precipitation.NONE) - .category(Biome.Category.NONE) - - .temperature(0.8F) - .downfall(1.0F); - - return biome.build(); - } -} diff --git a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/DecrepitBiome.java b/src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/DecrepitBiome.java deleted file mode 100644 index e9671cf..0000000 --- a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/DecrepitBiome.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.kpabr.backrooms.world.biome.biomes.level0; - -import com.kpabr.backrooms.init.BackroomsEntities; -import com.kpabr.backrooms.init.BackroomsSounds; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BiomeEffects; -import net.minecraft.world.biome.GenerationSettings; -import net.minecraft.world.biome.SpawnSettings; - -public class DecrepitBiome { - public static Biome create() { - SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder(); - spawnSettings.spawn(SpawnGroup.CREATURE, new SpawnSettings.SpawnEntry(BackroomsEntities.HOUND, 100, 1, 1)); - - GenerationSettings.Builder generationSettings = new GenerationSettings.Builder(); - - BiomeEffects.Builder biomeEffects = new BiomeEffects.Builder() - .skyColor(13548960) - .waterColor(13548960) - .waterFogColor(13548960) - .fogColor(13548960) - .grassColor(13818488) - .loopSound(BackroomsSounds.HUMBUZZ_LEVEL_0); - - Biome.Builder biome = new Biome.Builder() - .spawnSettings(spawnSettings.build()) - .generationSettings(generationSettings.build()) - .effects(biomeEffects.build()) - - .precipitation(Biome.Precipitation.NONE) - .category(Biome.Category.NONE) - - .temperature(0.8F) - .downfall(1.0F); - - return biome.build(); - } -} diff --git a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/MegalophobiaBiome.java b/src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/MegalophobiaBiome.java deleted file mode 100644 index 056ddd7..0000000 --- a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/MegalophobiaBiome.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.kpabr.backrooms.world.biome.biomes.level0; -import com.kpabr.backrooms.init.BackroomsSounds; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BiomeEffects; -import net.minecraft.world.biome.GenerationSettings; -import net.minecraft.world.biome.SpawnSettings; - -public class MegalophobiaBiome { - public static Biome create() { - SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder(); - GenerationSettings.Builder generationSettings = new GenerationSettings.Builder(); - BiomeEffects.Builder biomeEffects = new BiomeEffects.Builder() - .skyColor(13548960) - .waterColor(13548960) - .waterFogColor(13548960) - .fogColor(13548960) - .grassColor(13818488) - .loopSound(BackroomsSounds.HUMBUZZ_LEVEL_0); - - // Configure level 0 default biome - Biome.Builder biome = new Biome.Builder() - .spawnSettings(spawnSettings.build()) - .generationSettings(generationSettings.build()) - .effects(biomeEffects.build()) - - .precipitation(Biome.Precipitation.NONE) - .category(Biome.Category.NONE) - - .temperature(0.8F) - .downfall(0.0F); - - return biome.build(); - } - -} diff --git a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/YellowHallsBiome.java b/src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/YellowHallsBiome.java deleted file mode 100644 index cc81cc9..0000000 --- a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level0/YellowHallsBiome.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.kpabr.backrooms.world.biome.biomes.level0; -import com.kpabr.backrooms.init.BackroomsSounds; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BiomeEffects; -import net.minecraft.world.biome.GenerationSettings; -import net.minecraft.world.biome.SpawnSettings; - -public class YellowHallsBiome { - public static Biome create() { - SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder(); - GenerationSettings.Builder generationSettings = new GenerationSettings.Builder(); - BiomeEffects.Builder biomeEffects = new BiomeEffects.Builder() - .skyColor(13548960) - .waterColor(13548960) - .waterFogColor(13548960) - .fogColor(13548960) - .grassColor(13818488) - .loopSound(BackroomsSounds.HUMBUZZ_LEVEL_0); - - // Configure level 0 default biome - Biome.Builder biome = new Biome.Builder() - .spawnSettings(spawnSettings.build()) - .generationSettings(generationSettings.build()) - .effects(biomeEffects.build()) - - .precipitation(Biome.Precipitation.NONE) - .category(Biome.Category.NONE) - - .temperature(0.8F) - .downfall(0.0F); - - return biome.build(); - } - -} diff --git a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level1/CementHallsBiome.java b/src/main/java/com/kpabr/backrooms/world/biome/biomes/level1/CementHallsBiome.java deleted file mode 100644 index e214886..0000000 --- a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level1/CementHallsBiome.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.kpabr.backrooms.world.biome.biomes.level1; - -import com.kpabr.backrooms.init.BackroomsEntities; -import com.kpabr.backrooms.init.BackroomsSounds; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BiomeEffects; -import net.minecraft.world.biome.GenerationSettings; -import net.minecraft.world.biome.SpawnSettings; - -public class CementHallsBiome { - public static Biome create() { - SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder() - .spawn(SpawnGroup.CREATURE, new SpawnSettings.SpawnEntry(BackroomsEntities.HOUND, 100, 1, 1)); - - GenerationSettings.Builder generationSettings = new GenerationSettings.Builder(); - - BiomeEffects.Builder biomeEffects = new BiomeEffects.Builder() - .skyColor(10921378) - .waterColor(10921378) - .waterFogColor(10921378) - .fogColor(10921378) - .grassColor(13818488); - - Biome.Builder biome = new Biome.Builder() - .spawnSettings(spawnSettings.build()) - .generationSettings(generationSettings.build()) - .effects(biomeEffects.build()) - - .precipitation(Biome.Precipitation.NONE) - .category(Biome.Category.NONE) - - .temperature(0.8F) - .downfall(1.0F); - - return biome.build(); - } -} diff --git a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level1/ParkingGarageBiome.java b/src/main/java/com/kpabr/backrooms/world/biome/biomes/level1/ParkingGarageBiome.java deleted file mode 100644 index fa39831..0000000 --- a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level1/ParkingGarageBiome.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.kpabr.backrooms.world.biome.biomes.level1; - -import com.kpabr.backrooms.init.BackroomsEntities; -import com.kpabr.backrooms.init.BackroomsSounds; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BiomeEffects; -import net.minecraft.world.biome.GenerationSettings; -import net.minecraft.world.biome.SpawnSettings; - -public class ParkingGarageBiome { - public static Biome create() { - SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder() - .spawn(SpawnGroup.CREATURE, new SpawnSettings.SpawnEntry(BackroomsEntities.HOUND, 100, 1, 1)); - GenerationSettings.Builder generationSettings = new GenerationSettings.Builder(); - - BiomeEffects.Builder biomeEffects = new BiomeEffects.Builder() - .skyColor(10921378) - .waterColor(10921378) - .waterFogColor(10921378) - .fogColor(10921378) - .grassColor(13818488); - - // Configure parking garage biome - Biome.Builder biome = new Biome.Builder() - .spawnSettings(spawnSettings.build()) - .generationSettings(generationSettings.build()) - .effects(biomeEffects.build()) - - .precipitation(Biome.Precipitation.NONE) - .category(Biome.Category.NONE) - - .temperature(0.8F) - .downfall(1.0F); - - return biome.build(); - } -} diff --git a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level1/WarehouseBiome.java b/src/main/java/com/kpabr/backrooms/world/biome/biomes/level1/WarehouseBiome.java deleted file mode 100644 index af20630..0000000 --- a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level1/WarehouseBiome.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.kpabr.backrooms.world.biome.biomes.level1; - -import com.kpabr.backrooms.init.BackroomsEntities; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BiomeEffects; -import net.minecraft.world.biome.GenerationSettings; -import net.minecraft.world.biome.SpawnSettings; - -public class WarehouseBiome { - public static Biome create() { - SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder() - .spawn(SpawnGroup.CREATURE, new SpawnSettings.SpawnEntry(BackroomsEntities.HOUND, 100, 1, 1)); - GenerationSettings.Builder generationSettings = new GenerationSettings.Builder(); - - BiomeEffects.Builder biomeEffects = new BiomeEffects.Builder() - .skyColor(10921378) - .waterColor(10921378) - .waterFogColor(10921378) - .fogColor(10921378) - .grassColor(13818488); - - // Configure warehouse biome - Biome.Builder biome = new Biome.Builder() - .spawnSettings(spawnSettings.build()) - .generationSettings(generationSettings.build()) - .effects(biomeEffects.build()) - - .precipitation(Biome.Precipitation.NONE) - .category(Biome.Category.NONE) - - .temperature(0.8F) - .downfall(1.0F); - - return biome.build(); - } -} diff --git a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level2/PipesBiome.java b/src/main/java/com/kpabr/backrooms/world/biome/biomes/level2/PipesBiome.java deleted file mode 100644 index dde2b7e..0000000 --- a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level2/PipesBiome.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.kpabr.backrooms.world.biome.biomes.level2; - -import com.kpabr.backrooms.util.Color; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BiomeEffects; -import net.minecraft.world.biome.GenerationSettings; -import net.minecraft.world.biome.SpawnSettings; - -public class PipesBiome { - public static Biome create() { - SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder(); - GenerationSettings.Builder generationSettings = new GenerationSettings.Builder(); - BiomeEffects.Builder biomeEffects = new BiomeEffects.Builder() - .skyColor(Color.of(36, 36, 36)) - .waterColor(13548960) - .waterFogColor(13548960) - .fogColor(Color.of(36, 36, 36)) - .grassColor(13818488); - //TODO: make loop sound for level two; - - // Configure level 2 default biome - Biome.Builder biome = new Biome.Builder() - .spawnSettings(spawnSettings.build()) - .generationSettings(generationSettings.build()) - .effects(biomeEffects.build()) - - .precipitation(Biome.Precipitation.NONE) - .category(Biome.Category.NONE) - - .temperature(15.0F) - .downfall(0.0F); - - return biome.build(); - } - -} diff --git a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level3/ElectricalStationBiome.java b/src/main/java/com/kpabr/backrooms/world/biome/biomes/level3/ElectricalStationBiome.java deleted file mode 100644 index d604994..0000000 --- a/src/main/java/com/kpabr/backrooms/world/biome/biomes/level3/ElectricalStationBiome.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.kpabr.backrooms.world.biome.biomes.level3; - -import com.kpabr.backrooms.init.BackroomsEntities; -import com.kpabr.backrooms.init.BackroomsSounds; -import net.minecraft.entity.SpawnGroup; -import com.kpabr.backrooms.util.Color; -import net.minecraft.world.biome.Biome; -import net.minecraft.world.biome.BiomeEffects; -import net.minecraft.world.biome.GenerationSettings; -import net.minecraft.world.biome.SpawnSettings; - -public class ElectricalStationBiome { - public static Biome create() { - SpawnSettings.Builder spawnSettings = new SpawnSettings.Builder() - .spawn(SpawnGroup.CREATURE, new SpawnSettings.SpawnEntry(BackroomsEntities.HOUND, 100, 1, 1)); - GenerationSettings.Builder generationSettings = new GenerationSettings.Builder(); - BiomeEffects.Builder biomeEffects = new BiomeEffects.Builder() - .skyColor(Color.of(36, 36, 36)) - .waterColor(13548960) - .waterFogColor(13548960) - .fogColor(Color.of(36, 36, 36)) - .grassColor(13818488); - //TODO: make loop sound for level two; - - // Configure level 2 default biome - Biome.Builder biome = new Biome.Builder() - .spawnSettings(spawnSettings.build()) - .generationSettings(generationSettings.build()) - .effects(biomeEffects.build()) - - .precipitation(Biome.Precipitation.NONE) - .category(Biome.Category.NONE) - - .temperature(15.0F) - .downfall(0.0F); - - return biome.build(); - } - -} diff --git a/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelOneBiomeSource.java b/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelOneBiomeSource.java index a0ce8a9..fc67938 100644 --- a/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelOneBiomeSource.java +++ b/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelOneBiomeSource.java @@ -1,5 +1,7 @@ package com.kpabr.backrooms.world.biome.sources; +import java.util.stream.Stream; + import com.kpabr.backrooms.init.BackroomsLevels; import com.kpabr.backrooms.util.BiomeListBuilder; import com.kpabr.backrooms.util.BiomeRegistryList; @@ -7,50 +9,43 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.dynamic.RegistryOps; import net.minecraft.util.math.noise.SimplexNoiseSampler; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryEntry; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryOps; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.biome.source.util.MultiNoiseUtil.MultiNoiseSampler; -import net.minecraft.world.gen.random.AtomicSimpleRandom; -import net.minecraft.world.gen.random.ChunkRandom; - -import java.util.Random; +import net.minecraft.util.math.random.ChunkRandom; -public class LevelOneBiomeSource extends BiomeSource{ +import net.minecraft.util.math.random.Random; - public static final Codec CODEC = RecordCodecBuilder.create((instance) -> - instance.group( - RegistryOps.createRegistryCodec(Registry.BIOME_KEY) - .forGetter((biomeSource) -> biomeSource.BIOME_REGISTRY) - ).apply(instance, instance.stable(LevelOneBiomeSource::new))); +public class LevelOneBiomeSource extends BiomeSource { + public static final Codec CODEC = RecordCodecBuilder + .create((instance) -> instance.group(RegistryOps.getEntryLookupCodec(RegistryKeys.BIOME)) + .apply(instance, instance.stable(LevelOneBiomeSource::new))); private final BiomeRegistryList biomeList; - + private SimplexNoiseSampler temperatureNoiseSampler; private SimplexNoiseSampler moistnessNoiseSampler; private SimplexNoiseSampler integrityNoiseSampler; private SimplexNoiseSampler purityNoiseSampler; private SimplexNoiseSampler toxicityNoiseSampler; private boolean isNoiseInitialized = false; - - private Registry BIOME_REGISTRY; - public LevelOneBiomeSource(Registry biomeRegistry) { - this(biomeRegistry, BiomeRegistryList.from(biomeRegistry, new BiomeListBuilder() - .addBiome(BackroomsLevels.WAREHOUSE_BIOME, new LevelParameters(0.45, 0.3, 0.8, 0.4, 0.05, 1)) - .addBiome(BackroomsLevels.PARKING_GARAGE_BIOME, new LevelParameters(0.4, 0.4, 0.65, 0.35, 0.05, 0.9)) - .addBiome(BackroomsLevels.CEMENT_WALLS_BIOME, new LevelParameters(0.35, 0.45, 0.75, 0.4, 0.05, 0.8)))); + private RegistryEntryLookup BIOME_REGISTRY; - this.BIOME_REGISTRY = biomeRegistry; - } - - private LevelOneBiomeSource(Registry biomeRegistry, BiomeRegistryList biomeList) { - super(biomeList.getBiomeEntries()); - this.biomeList = biomeList; + public LevelOneBiomeSource(RegistryEntryLookup biomeRegistry) { + super(); + this.biomeList = BiomeRegistryList.from(new BiomeListBuilder() + .addBiome(BackroomsLevels.WAREHOUSE_BIOME, new LevelParameters(0.45, 0.3, 0.8, 0.4, 0.05, 1)) + .addBiome(BackroomsLevels.PARKING_GARAGE_BIOME, new LevelParameters(0.4, 0.4, 0.65, 0.35, 0.05, 0.9)) + .addBiome(BackroomsLevels.CEMENT_WALLS_BIOME, new LevelParameters(0.35, 0.45, 0.75, 0.4, 0.05, 0.8)), + biomeRegistry); + BIOME_REGISTRY = biomeRegistry; } @Override @@ -58,42 +53,44 @@ public RegistryEntry getBiome(int x, int y, int z, MultiNoiseSampler nois if (!this.isNoiseInitialized) { long seed = BackroomsLevels.LEVEL_0_WORLD.getSeed(); - Random randomGenerator = new Random(seed); - + Random randomGenerator = Random.create(seed); + // Generate five different random seeds based on the world seed long[] randomSeeds = new long[5]; for (int i = 0; i < 5; i++) { randomSeeds[i] = randomGenerator.nextLong(); } - this.temperatureNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(randomSeeds[0]))); - - this.moistnessNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(randomSeeds[1]))); - - this.integrityNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(randomSeeds[2]))); - - this.purityNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(randomSeeds[3]))); - - this.toxicityNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(randomSeeds[4]))); + this.temperatureNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(Random.create(randomSeeds[0]))); + + this.moistnessNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(Random.create(randomSeeds[1]))); + + this.integrityNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(Random.create(randomSeeds[2]))); + + this.purityNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(Random.create(randomSeeds[3]))); + + this.toxicityNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(Random.create(randomSeeds[4]))); this.isNoiseInitialized = true; } - + double temperatureNoiseAt = getNoiseAt(this.temperatureNoiseSampler, x, y, z); double moistnessNoiseAt = getNoiseAt(this.moistnessNoiseSampler, x, y, z); double integrityNoiseAt = getNoiseAt(this.integrityNoiseSampler, x, y, z); double purityNoiseAt = getNoiseAt(this.purityNoiseSampler, x, y, z); double toxicityNoiseAt = getNoiseAt(this.toxicityNoiseSampler, x, y, z); - - return biomeList.findNearest(new LevelParameters(temperatureNoiseAt, moistnessNoiseAt, integrityNoiseAt, purityNoiseAt, toxicityNoiseAt, 0d)); + + return biomeList.findNearest(new LevelParameters(temperatureNoiseAt, moistnessNoiseAt, integrityNoiseAt, + purityNoiseAt, toxicityNoiseAt, 0d)); } public static double getNoiseAt(SimplexNoiseSampler perlinNoiseSampler, int x, int y, int z) { - double n = perlinNoiseSampler.sample(x*0.01, y*0.01, z*0.01); + double n = perlinNoiseSampler.sample(x * 0.01, y * 0.01, z * 0.01); - //Transform the range to [0.0, 1.0], supposing that the range of Noise2D is [-1.0, 1.0] + // Transform the range to [0.0, 1.0], supposing that the range of Noise2D is + // [-1.0, 1.0] n += 1.0; n /= 2.0; - + return n; } @@ -103,8 +100,9 @@ protected Codec getCodec() { } @Override - public BiomeSource withSeed(long seed) { - return this; + protected Stream> biomeStream() { + return Stream.of(this.BIOME_REGISTRY.getOrThrow(BackroomsLevels.PARKING_GARAGE_BIOME), + this.BIOME_REGISTRY.getOrThrow(BackroomsLevels.CEMENT_WALLS_BIOME), + this.BIOME_REGISTRY.getOrThrow(BackroomsLevels.WAREHOUSE_BIOME)); } - } diff --git a/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelThreeBiomeSource.java b/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelThreeBiomeSource.java index 604bb86..2f3956d 100644 --- a/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelThreeBiomeSource.java +++ b/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelThreeBiomeSource.java @@ -4,31 +4,26 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.dynamic.RegistryOps; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryEntry; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryOps; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.biome.source.util.MultiNoiseUtil.MultiNoiseSampler; import java.util.stream.Stream; -public class LevelThreeBiomeSource extends BiomeSource{ +public class LevelThreeBiomeSource extends BiomeSource { - public static final Codec CODEC = RecordCodecBuilder.create((instance) -> - instance.group( - RegistryOps.createRegistryCodec(Registry.BIOME_KEY) - .forGetter((biomeSource) -> biomeSource.BIOME_REGISTRY) - ).apply(instance, instance.stable(LevelThreeBiomeSource::new))); - - private Registry BIOME_REGISTRY; + public static final Codec CODEC = RecordCodecBuilder + .create((instance) -> instance.group(RegistryOps.getEntryLookupCodec(RegistryKeys.BIOME)) + .apply(instance, instance.stable(LevelThreeBiomeSource::new))); private final RegistryEntry ELECTRICAL_STATION_BIOME; - public LevelThreeBiomeSource(Registry biomeRegistry) { - super(Stream.of( - biomeRegistry.getOrCreateEntry(BackroomsLevels.PIPES_BIOME))); - ELECTRICAL_STATION_BIOME = biomeRegistry.getOrCreateEntry(BackroomsLevels.PIPES_BIOME); - this.BIOME_REGISTRY = biomeRegistry; + public LevelThreeBiomeSource(RegistryEntryLookup biomeRegistry) { + super(); + ELECTRICAL_STATION_BIOME = biomeRegistry.getOrThrow(BackroomsLevels.ELECTRICAL_STATION_BIOME); } @Override @@ -42,8 +37,7 @@ protected Codec getCodec() { } @Override - public BiomeSource withSeed(long seed) { - return this; + protected Stream> biomeStream() { + return Stream.of(ELECTRICAL_STATION_BIOME); } - } diff --git a/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelTwoBiomeSource.java b/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelTwoBiomeSource.java index bf93156..79e15ea 100644 --- a/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelTwoBiomeSource.java +++ b/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelTwoBiomeSource.java @@ -4,31 +4,26 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.dynamic.RegistryOps; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryEntry; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryOps; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.biome.source.util.MultiNoiseUtil.MultiNoiseSampler; import java.util.stream.Stream; -public class LevelTwoBiomeSource extends BiomeSource{ +public class LevelTwoBiomeSource extends BiomeSource { - public static final Codec CODEC = RecordCodecBuilder.create((instance) -> - instance.group( - RegistryOps.createRegistryCodec(Registry.BIOME_KEY) - .forGetter((biomeSource) -> biomeSource.BIOME_REGISTRY) - ).apply(instance, instance.stable(LevelTwoBiomeSource::new))); - - private Registry BIOME_REGISTRY; + public static final Codec CODEC = RecordCodecBuilder + .create((instance) -> instance.group(RegistryOps.getEntryLookupCodec(RegistryKeys.BIOME)) + .apply(instance, instance.stable(LevelTwoBiomeSource::new))); private final RegistryEntry PIPES_BIOME; - public LevelTwoBiomeSource(Registry biomeRegistry) { - super(Stream.of( - biomeRegistry.getOrCreateEntry(BackroomsLevels.PIPES_BIOME))); - PIPES_BIOME = biomeRegistry.getOrCreateEntry(BackroomsLevels.PIPES_BIOME); - this.BIOME_REGISTRY = biomeRegistry; + public LevelTwoBiomeSource(RegistryEntryLookup biomeRegistry) { + super(); + PIPES_BIOME = biomeRegistry.getOrThrow(BackroomsLevels.PIPES_BIOME); } @Override @@ -37,13 +32,12 @@ public RegistryEntry getBiome(int x, int y, int z, MultiNoiseSampler nois } @Override - protected Codec getCodec() { + protected Codec getCodec() { return CODEC; } @Override - public BiomeSource withSeed(long seed) { - return this; + protected Stream> biomeStream() { + return Stream.of(PIPES_BIOME); } - } diff --git a/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelZeroBiomeSource.java b/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelZeroBiomeSource.java index 36a709a..a00f2a1 100644 --- a/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelZeroBiomeSource.java +++ b/src/main/java/com/kpabr/backrooms/world/biome/sources/LevelZeroBiomeSource.java @@ -1,5 +1,7 @@ package com.kpabr.backrooms.world.biome.sources; +import java.util.stream.Stream; + import com.kpabr.backrooms.init.BackroomsLevels; import com.kpabr.backrooms.util.BiomeListBuilder; import com.kpabr.backrooms.util.BiomeRegistryList; @@ -7,93 +9,94 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.util.dynamic.RegistryOps; import net.minecraft.util.math.noise.SimplexNoiseSampler; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryEntry; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryOps; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeSource; import net.minecraft.world.biome.source.util.MultiNoiseUtil.MultiNoiseSampler; -import net.minecraft.world.gen.random.AtomicSimpleRandom; -import net.minecraft.world.gen.random.ChunkRandom; +import net.minecraft.util.math.random.ChunkRandom; -import java.util.Random; +import net.minecraft.util.math.random.Random; public class LevelZeroBiomeSource extends BiomeSource { - public static final Codec CODEC = RecordCodecBuilder.create((instance) -> - instance.group( - RegistryOps.createRegistryCodec(Registry.BIOME_KEY) - .forGetter((biomeSource) -> biomeSource.BIOME_REGISTRY) - ).apply(instance, instance.stable(LevelZeroBiomeSource::new))); - + public static final Codec CODEC = RecordCodecBuilder + .create((instance) -> instance.group(RegistryOps.getEntryLookupCodec(RegistryKeys.BIOME)) + .apply(instance, instance.stable(LevelZeroBiomeSource::new))); private final BiomeRegistryList biomeList; - + private SimplexNoiseSampler temperatureNoiseSampler; private SimplexNoiseSampler moistnessNoiseSampler; private SimplexNoiseSampler integrityNoiseSampler; private SimplexNoiseSampler purityNoiseSampler; private SimplexNoiseSampler toxicityNoiseSampler; private boolean isNoiseInitialized = false; - - private Registry BIOME_REGISTRY; - - public LevelZeroBiomeSource(Registry biomeRegistry) { - this(biomeRegistry, BiomeRegistryList.from(biomeRegistry, new BiomeListBuilder() - .addBiome(BackroomsLevels.CRIMSON_WALLS_BIOME, new LevelParameters(0.6, 0.65, 0.75, 0.45, 0.15, 1)) - .addBiome(BackroomsLevels.DECREPIT_BIOME, new LevelParameters(0.55, 0.7, 0.5, 0.3, 0.25, 1.2)) - .addBiome(BackroomsLevels.MEGALOPHOBIA_BIOME, new LevelParameters(0.45, 0.55, 0.65, 0.4, 0.05, 1)) - .addBiome(BackroomsLevels.YELLOW_WALLS_BIOME, new LevelParameters(0.5, 0.4, 0.75, 0.45, 0.05, 0.9)))); - this.BIOME_REGISTRY = biomeRegistry; + + private RegistryEntryLookup BIOME_REGISTRY; + + public LevelZeroBiomeSource(RegistryEntryLookup biomeRegistry) { + this(BiomeRegistryList.from(new BiomeListBuilder() + .addBiome(BackroomsLevels.CRIMSON_WALLS_BIOME, new LevelParameters(0.6, 0.65, 0.75, 0.45, 0.15, 1)) + .addBiome(BackroomsLevels.DECREPIT_BIOME, new LevelParameters(0.55, 0.7, 0.5, 0.3, 0.25, 1.2)) + .addBiome(BackroomsLevels.MEGALOPHOBIA_BIOME, new LevelParameters(0.45, 0.55, 0.65, 0.4, 0.05, 1)) + .addBiome(BackroomsLevels.YELLOW_WALLS_BIOME, new LevelParameters(0.5, 0.4, 0.75, 0.45, 0.05, 0.9)), + biomeRegistry)); + BIOME_REGISTRY = biomeRegistry; } - private LevelZeroBiomeSource(Registry biomeRegistry, BiomeRegistryList biomeList) { - super(biomeList.getBiomeEntries()); + private LevelZeroBiomeSource(BiomeRegistryList biomeList) { + super(); this.biomeList = biomeList; } @Override public RegistryEntry getBiome(int x, int y, int z, MultiNoiseSampler noise) { + // return biomeList.findNearest(new LevelParameters(0, 0, 0, 0, 0, 0d)); if (!this.isNoiseInitialized) { long seed = BackroomsLevels.LEVEL_0_WORLD.getSeed(); - Random randomGenerator = new Random(seed); - + Random randomGenerator = Random.create(seed); + // Generate five different random seeds based on the world seed long[] randomSeeds = new long[5]; for (int i = 0; i < 5; i++) { randomSeeds[i] = randomGenerator.nextLong(); } - this.temperatureNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(randomSeeds[0]))); - - this.moistnessNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(randomSeeds[1]))); - - this.integrityNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(randomSeeds[2]))); - - this.purityNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(randomSeeds[3]))); - - this.toxicityNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(new AtomicSimpleRandom(randomSeeds[4]))); + this.temperatureNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(Random.create(randomSeeds[0]))); + + this.moistnessNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(Random.create(randomSeeds[1]))); + + this.integrityNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(Random.create(randomSeeds[2]))); + + this.purityNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(Random.create(randomSeeds[3]))); + + this.toxicityNoiseSampler = new SimplexNoiseSampler(new ChunkRandom(Random.create(randomSeeds[4]))); this.isNoiseInitialized = true; } - + double temperatureNoiseAt = getNoiseAt(this.temperatureNoiseSampler, x, y, z); double moistnessNoiseAt = getNoiseAt(this.moistnessNoiseSampler, x, y, z); double integrityNoiseAt = getNoiseAt(this.integrityNoiseSampler, x, y, z); double purityNoiseAt = getNoiseAt(this.purityNoiseSampler, x, y, z); double toxicityNoiseAt = getNoiseAt(this.toxicityNoiseSampler, x, y, z); - - return biomeList.findNearest(new LevelParameters(temperatureNoiseAt, moistnessNoiseAt, integrityNoiseAt, purityNoiseAt, toxicityNoiseAt, 0d)); + + return biomeList.findNearest(new LevelParameters(temperatureNoiseAt, moistnessNoiseAt, integrityNoiseAt, + purityNoiseAt, toxicityNoiseAt, 0d)); } public static double getNoiseAt(SimplexNoiseSampler perlinNoiseSampler, int x, int y, int z) { - double n = perlinNoiseSampler.sample(x*0.01, y*0.01, z*0.01); + double n = perlinNoiseSampler.sample(x * 0.01, y * 0.01, z * 0.01); - //Transform the range to [0.0, 1.0], supposing that the range of Noise2D is [-1.0, 1.0] + // Transform the range to [0.0, 1.0], supposing that the range of Noise2D is + // [-1.0, 1.0] n += 1.0; n /= 2.0; - + return n; } @@ -103,8 +106,10 @@ protected Codec getCodec() { } @Override - public BiomeSource withSeed(long seed) { - return this; + protected Stream> biomeStream() { + return Stream.of(this.BIOME_REGISTRY.getOrThrow(BackroomsLevels.YELLOW_WALLS_BIOME), + this.BIOME_REGISTRY.getOrThrow(BackroomsLevels.CRIMSON_WALLS_BIOME), + this.BIOME_REGISTRY.getOrThrow(BackroomsLevels.DECREPIT_BIOME), + this.BIOME_REGISTRY.getOrThrow(BackroomsLevels.MEGALOPHOBIA_BIOME)); } - } diff --git a/src/main/java/com/kpabr/backrooms/world/chunk/LevelOneChunkGenerator.java b/src/main/java/com/kpabr/backrooms/world/chunk/LevelOneChunkGenerator.java index ce2fd43..b0d90d7 100644 --- a/src/main/java/com/kpabr/backrooms/world/chunk/LevelOneChunkGenerator.java +++ b/src/main/java/com/kpabr/backrooms/world/chunk/LevelOneChunkGenerator.java @@ -1,7 +1,6 @@ package com.kpabr.backrooms.world.chunk; import java.util.List; -import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -17,34 +16,31 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.server.world.ServerWorld; -import net.minecraft.structure.StructureSet; -import net.minecraft.util.dynamic.RegistryOps; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryOps; import net.minecraft.world.ChunkRegion; import net.minecraft.world.HeightLimitView; -import net.minecraft.world.Heightmap; +import net.minecraft.world.Heightmap.Type; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeAccess; -import net.minecraft.world.biome.source.util.MultiNoiseUtil; import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.gen.GenerationStep; +import net.minecraft.world.gen.GenerationStep.Carver; import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.chunk.Blender; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.VerticalBlockSample; +import net.minecraft.world.gen.noise.NoiseConfig; public class LevelOneChunkGenerator extends ChunkGenerator { - public static final Codec CODEC = RecordCodecBuilder.create((instance) -> - method_41042(instance).and( - RegistryOps.createRegistryCodec(Registry.BIOME_KEY).forGetter((generator) -> generator.biomeRegistry) - ) - .apply(instance, instance.stable(LevelOneChunkGenerator::new)) - ); - - + + public static final Codec CODEC = RecordCodecBuilder.create((instance) -> instance + .group(RegistryOps.getEntryLookupCodec(RegistryKeys.BIOME), + RegistryOps.getEntryLookupCodec(RegistryKeys.BLOCK)) + .apply(instance, instance.stable(LevelOneChunkGenerator::new))); private CementHallsChunkGenerator cementHallsChunkGenerator; private ParkingGarageChunkGenerator parkingGarageChunkGenerator; private WarehouseChunkGenerator warehouseChunkGenerator; @@ -56,35 +52,25 @@ public class LevelOneChunkGenerator extends ChunkGenerator { private static final BlockState ROOF_BLOCK = BackroomsBlocks.BEDROCK_BRICKS.getDefaultState(); private static final int ROOF_BEGIN_Y = 8 * (getFloorCount() + 1) + 1; - - private final Registry biomeRegistry; - - public LevelOneChunkGenerator(Registry registry, Registry biomeRegistry) { - super(registry, Optional.empty(), new LevelOneBiomeSource(biomeRegistry)); - this.biomeRegistry = biomeRegistry; - } - - @Override - protected Codec getCodec() { - return CODEC; - } - - @Override - public ChunkGenerator withSeed(long seed) { - return this; - } - - @Override - public MultiNoiseUtil.MultiNoiseSampler getMultiNoiseSampler() { - return null; - } - - @Override - public void carve(ChunkRegion chunkRegion, long l, BiomeAccess biomeAccess, StructureAccessor structureAccessor, Chunk chunk, GenerationStep.Carver carver) { - } - - @Override - public void buildSurface(ChunkRegion region, StructureAccessor structureAccessor, Chunk chunk) { + private RegistryEntryLookup blockLookup; + + public LevelOneChunkGenerator(RegistryEntryLookup biomeRegistry, RegistryEntryLookup blockLookup) { + super(new LevelOneBiomeSource(biomeRegistry)); + this.blockLookup = blockLookup; + } + + @Override + protected Codec getCodec() { + return CODEC; + } + + @Override + public void carve(ChunkRegion chunkRegion, long seed, NoiseConfig noiseConfig, BiomeAccess world, + StructureAccessor structureAccessor, Chunk chunk, Carver carverStep) { + } + + @Override + public void buildSurface(ChunkRegion region, StructureAccessor structures, NoiseConfig noiseConfig, Chunk chunk) { final ChunkPos chunkPos = chunk.getPos(); // controls every block up to the roof @@ -104,53 +90,59 @@ public void buildSurface(ChunkRegion region, StructureAccessor structureAccessor } } } - } + } - @Override - public void populateEntities(ChunkRegion region) { - } + @Override + public void populateEntities(ChunkRegion region) { + } - @Override - public int getWorldHeight() { - return 128; - } + @Override + public int getWorldHeight() { + return 128; + } - @Override - public CompletableFuture populateNoise(Executor executor, Blender blender, StructureAccessor structureAccessor, Chunk chunk) { + @Override + public CompletableFuture populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig, + StructureAccessor structureAccessor, Chunk chunk) { if (this.cementHallsChunkGenerator == null) { - this.cementHallsChunkGenerator = new CementHallsChunkGenerator(biomeSource, BackroomsLevels.LEVEL_1_WORLD.getSeed()); - this.parkingGarageChunkGenerator= new ParkingGarageChunkGenerator(biomeSource, BackroomsLevels.LEVEL_1_WORLD.getSeed()); - this.warehouseChunkGenerator = new WarehouseChunkGenerator(biomeSource, BackroomsLevels.LEVEL_1_WORLD.getSeed()); + this.cementHallsChunkGenerator = new CementHallsChunkGenerator(biomeSource, + BackroomsLevels.LEVEL_1_WORLD.getSeed(), this.blockLookup); + this.parkingGarageChunkGenerator = new ParkingGarageChunkGenerator(biomeSource, + BackroomsLevels.LEVEL_1_WORLD.getSeed(), this.blockLookup); + this.warehouseChunkGenerator = new WarehouseChunkGenerator(biomeSource, + BackroomsLevels.LEVEL_1_WORLD.getSeed(), this.blockLookup); } // IMPORTANT NOTE: - // For biomes generation we're using various "placeholder" blocks to replace them later with blocks we actually need in biomes. - // If you're adding new type of structure then don't use blocks other than described below from our mod! + // For biomes generation we're using various "placeholder" blocks to replace + // them later with blocks we actually need in biomes. + // If you're adding new type of structure then don't use blocks other than + // described below from our mod! // Instead, use those blocks: // BackroomsBlocks.PATTERNED_WALLPAPER -> any wallpaper // BackroomsBlocks.WOOLEN_CARPET -> any carpet // BackroomsBlocks.CORK_TILE -> any cork tile // BackroomsBlocks.FLUORESCENT_LIGHT -> any light source - // BackroomsBlocks.MOLDY_WOOLEN_CARPET -> random blocks(you can just replace them with carpet) + // BackroomsBlocks.MOLDY_WOOLEN_CARPET -> random blocks(you can just replace + // them with carpet) final ChunkPos chunkPos = chunk.getPos(); - //Define a position for checking biomes + // Define a position for checking biomes final BlockPos biomePos = chunkPos.getBlockPos(0, 4, 4); - //Save the first and last x and z position of the chunk. Note: positive x means east, positive z means south. + // Save the first and last x and z position of the chunk. Note: positive x means + // east, positive z means south. final int startX = chunkPos.getStartX(); final int endX = startX + 16; final int startZ = chunkPos.getStartZ(); - final int endZ = startZ + 16; - - if(isBiomeEquals(BackroomsLevels.CEMENT_WALLS_BIOME, chunk, biomePos)) { - this.cementHallsChunkGenerator.populateNoise(executor, blender, structureAccessor, chunk); - } - else if(isBiomeEquals(BackroomsLevels.PARKING_GARAGE_BIOME, chunk, biomePos)) { - this.parkingGarageChunkGenerator.populateNoise(executor, blender, structureAccessor, chunk); - } - else if(isBiomeEquals(BackroomsLevels.WAREHOUSE_BIOME, chunk, biomePos)) { - this.warehouseChunkGenerator.populateNoise(executor, blender, structureAccessor, chunk); + final int endZ = startZ + 16; + + if (isBiomeEquals(BackroomsLevels.CEMENT_WALLS_BIOME, chunk, biomePos)) { + this.cementHallsChunkGenerator.populateNoise(executor, blender, noiseConfig, structureAccessor, chunk); + } else if (isBiomeEquals(BackroomsLevels.PARKING_GARAGE_BIOME, chunk, biomePos)) { + this.parkingGarageChunkGenerator.populateNoise(executor, blender, noiseConfig, structureAccessor, chunk); + } else if (isBiomeEquals(BackroomsLevels.WAREHOUSE_BIOME, chunk, biomePos)) { + this.warehouseChunkGenerator.populateNoise(executor, blender, noiseConfig, structureAccessor, chunk); } // Place bedrock bricks at the bottom. @@ -173,37 +165,35 @@ else if(isBiomeEquals(BackroomsLevels.WAREHOUSE_BIOME, chunk, biomePos)) { return CompletableFuture.completedFuture(chunk); } - - @Override - public int getSeaLevel() { - return 0; - } + @Override + public int getSeaLevel() { + return 0; + } - @Override - public int getMinimumY() { - return 0; - } + @Override + public int getMinimumY() { + return 0; + } - @Override - public int getHeight(int x, int z, Heightmap.Type heightmapType, HeightLimitView heightLimitView) { - return 128; - } + @Override + public int getHeight(int x, int z, Type heightmap, HeightLimitView world, NoiseConfig noiseConfig) { + return 128; + } - @Override - public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView heightLimitView) { - return new VerticalBlockSample(0, new BlockState[0]); - } + @Override + public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world, NoiseConfig noiseConfig) { + return new VerticalBlockSample(0, new BlockState[0]); + } - @Override - public void getDebugHudText(List list, BlockPos blockPos) { - } + @Override + public void getDebugHudText(List text, NoiseConfig noiseConfig, BlockPos pos) { + } public static int getFloorCount() { return 5; } - public void storeStructures(ServerWorld world) { this.parkingGarageChunkGenerator.storeStructures(world); this.cementHallsChunkGenerator.storeStructures(world); diff --git a/src/main/java/com/kpabr/backrooms/world/chunk/LevelThreeChunkGenerator.java b/src/main/java/com/kpabr/backrooms/world/chunk/LevelThreeChunkGenerator.java index 0c9fc3d..beb5f04 100644 --- a/src/main/java/com/kpabr/backrooms/world/chunk/LevelThreeChunkGenerator.java +++ b/src/main/java/com/kpabr/backrooms/world/chunk/LevelThreeChunkGenerator.java @@ -3,7 +3,6 @@ import com.kpabr.backrooms.util.ElectricalStationRoom; import com.kpabr.backrooms.world.biome.sources.LevelThreeBiomeSource; import java.util.List; -import java.util.Optional; import java.util.Random; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -16,75 +15,71 @@ import net.minecraft.block.Blocks; import com.kpabr.backrooms.init.BackroomsBlocks; import net.minecraft.server.world.ServerWorld; -import net.minecraft.structure.StructureSet; -import net.minecraft.util.dynamic.RegistryOps; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryOps; import net.minecraft.world.ChunkRegion; import net.minecraft.world.HeightLimitView; -import net.minecraft.world.Heightmap; +import net.minecraft.world.Heightmap.Type; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeAccess; -import net.minecraft.world.biome.source.util.MultiNoiseUtil.MultiNoiseSampler; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.gen.GenerationStep.Carver; import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.chunk.Blender; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.VerticalBlockSample; +import net.minecraft.world.gen.noise.NoiseConfig; public class LevelThreeChunkGenerator extends ChunkGenerator { - public static final Codec CODEC = RecordCodecBuilder.create((instance) -> - method_41042(instance).and( - RegistryOps.createRegistryCodec(Registry.BIOME_KEY).forGetter((generator) -> generator.biomeRegistry) - ) - .apply(instance, instance.stable(LevelThreeChunkGenerator::new)) - ); - - private final Registry biomeRegistry; + + public static final Codec CODEC = RecordCodecBuilder + .create((instance) -> instance.group(RegistryOps.getEntryLookupCodec(RegistryKeys.BIOME)) + .apply(instance, instance.stable(LevelThreeChunkGenerator::new))); private static final int ROOF_BEGIN_Y = 6 * (getFloorCount() + 1) + 1; private static final BlockState ROOF_BLOCK = BackroomsBlocks.BEDROCK_BRICKS.getDefaultState(); - public LevelThreeChunkGenerator(Registry registry, Registry biomeRegistry) { - super(registry, Optional.empty(), new LevelThreeBiomeSource(biomeRegistry)); - this.biomeRegistry = biomeRegistry; + public LevelThreeChunkGenerator(RegistryEntryLookup biomeRegistry) { + super(new LevelThreeBiomeSource(biomeRegistry)); } @Override protected Codec getCodec() { return CODEC; } - @Override - public ChunkGenerator withSeed(long seed) { - return this; - } @Override - public CompletableFuture populateNoise(Executor executor, Blender blender, StructureAccessor structureAccessor, Chunk chunk) { + public CompletableFuture populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig, + StructureAccessor structureAccessor, Chunk chunk) { // IMPORTANT NOTE: - // For biomes generation we're using various "placeholder" blocks to replace them later with blocks we actually need in biomes. - // If you're adding new type of structure then don't use blocks other than described below from our mod! + // For biomes generation we're using various "placeholder" blocks to replace + // them later with blocks we actually need in biomes. + // If you're adding new type of structure then don't use blocks other than + // described below from our mod! // Instead, use those blocks: // BackroomsBlocks.PATTERNED_WALLPAPER -> any wallpaper // BackroomsBlocks.WOOLEN_CARPET -> any carpet // BackroomsBlocks.CORK_TILE -> any cork tile // BackroomsBlocks.FLUORESCENT_LIGHT -> any light source - // BackroomsBlocks.MOLDY_WOOLEN_CARPET -> random blocks(you can just replace them with carpet) + // BackroomsBlocks.MOLDY_WOOLEN_CARPET -> random blocks(you can just replace + // them with carpet) final ChunkPos chunkPos = chunk.getPos(); - //Save the starting x and z position of the chunk. Note: positive x means east, positive z means south. + // Save the starting x and z position of the chunk. Note: positive x means east, + // positive z means south. final int startX = chunkPos.getStartX(); final int startZ = chunkPos.getStartZ(); final long seed = BackroomsLevels.LEVEL_3_WORLD.getSeed(); final int roomHeight = getRoomHeight(); - //Create 5 floors, top to bottom. + // Create 5 floors, top to bottom. for (int y = getFloorCount(); y >= 0; y--) { - final Random random = new Random(BackroomsLevels.LEVEL_3_WORLD.getSeed() + MathHelper.hashCode(startX, startZ, y)); + final Random random = new Random( + BackroomsLevels.LEVEL_3_WORLD.getSeed() + BlockPos.asLong(startX, startZ, y)); ElectricalStationRoom thisRoom = new ElectricalStationRoom(y, startX, startZ, seed); ElectricalStationRoom eastRoom = new ElectricalStationRoom(y, startX + 16, startZ, seed); ElectricalStationRoom westRoom = new ElectricalStationRoom(y, startX - 16, startZ, seed); @@ -93,36 +88,41 @@ public CompletableFuture populateNoise(Executor executor, Blender blender for (int i = 0; i < roomHeight; i++) { for (int j = 0; j < 16; j++) { for (int k = 0; k < 16; k++) { - if(i==0) { - if(((j & 1) + (k & 1)) == 1) { - chunk.setBlockState(new BlockPos(startX + j, 1 + roomHeight * y + i, startZ + k), Blocks.SMOOTH_STONE.getDefaultState(), false); - } - else{ - chunk.setBlockState(new BlockPos(startX + j, 1 + roomHeight * y + i, startZ + k), Blocks.POLISHED_ANDESITE.getDefaultState(), false); - } - } - else if(i==1){ - chunk.setBlockState(new BlockPos(startX + j, 1 + roomHeight * y + i, startZ + k), Blocks.BROWN_TERRACOTTA.getDefaultState(), false); - } - else if(i==roomHeight-1){ - chunk.setBlockState(new BlockPos(startX + j, 1 + roomHeight * y + i, startZ + k), Blocks.DIORITE.getDefaultState(), false); - } - else{ - if(random.nextInt(5) < 3){ - chunk.setBlockState(new BlockPos(startX + j, 1 + roomHeight * y + i, startZ + k), Blocks.BRICKS.getDefaultState(), false); + if (i == 0) { + if (((j & 1) + (k & 1)) == 1) { + chunk.setBlockState(new BlockPos(startX + j, 1 + roomHeight * y + i, startZ + k), + Blocks.SMOOTH_STONE.getDefaultState(), false); + } else { + chunk.setBlockState(new BlockPos(startX + j, 1 + roomHeight * y + i, startZ + k), + Blocks.POLISHED_ANDESITE.getDefaultState(), false); } - else{ - chunk.setBlockState(new BlockPos(startX + j, 1 + roomHeight * y + i, startZ + k), Blocks.TERRACOTTA.getDefaultState(), false); + } else if (i == 1) { + chunk.setBlockState(new BlockPos(startX + j, 1 + roomHeight * y + i, startZ + k), + Blocks.BROWN_TERRACOTTA.getDefaultState(), false); + } else if (i == roomHeight - 1) { + chunk.setBlockState(new BlockPos(startX + j, 1 + roomHeight * y + i, startZ + k), + Blocks.DIORITE.getDefaultState(), false); + } else { + if (random.nextInt(5) < 3) { + chunk.setBlockState(new BlockPos(startX + j, 1 + roomHeight * y + i, startZ + k), + Blocks.BRICKS.getDefaultState(), false); + } else { + chunk.setBlockState(new BlockPos(startX + j, 1 + roomHeight * y + i, startZ + k), + Blocks.TERRACOTTA.getDefaultState(), false); } } } } } fillRoom(chunk, 4, y, startX, startZ, thisRoom); - fillRoom(chunk, 3, y, startX, startZ, ElectricalStationRoom.hallwayBetween(thisRoom, eastRoom, Direction.EAST)); - fillRoom(chunk, 3, y, startX, startZ, ElectricalStationRoom.hallwayBetween(thisRoom, westRoom, Direction.WEST)); - fillRoom(chunk, 3, y, startX, startZ, ElectricalStationRoom.hallwayBetween(thisRoom, southRoom, Direction.SOUTH)); - fillRoom(chunk, 3, y, startX, startZ, ElectricalStationRoom.hallwayBetween(thisRoom, northRoom, Direction.NORTH)); + fillRoom(chunk, 3, y, startX, startZ, + ElectricalStationRoom.hallwayBetween(thisRoom, eastRoom, Direction.EAST)); + fillRoom(chunk, 3, y, startX, startZ, + ElectricalStationRoom.hallwayBetween(thisRoom, westRoom, Direction.WEST)); + fillRoom(chunk, 3, y, startX, startZ, + ElectricalStationRoom.hallwayBetween(thisRoom, southRoom, Direction.SOUTH)); + fillRoom(chunk, 3, y, startX, startZ, + ElectricalStationRoom.hallwayBetween(thisRoom, northRoom, Direction.NORTH)); } // Place bedrock bricks at the bottom. for (int x = startX; x < startX + 16; x++) { @@ -142,13 +142,16 @@ else if(i==roomHeight-1){ public static int getFloorCount() { return 5; } + public static int getRoomHeight() { return 6; } public void storeStructures(ServerWorld world) { - //store("backrooms_large", world, 0, 14); //Makes it so the large regular rooms can be used while generating. - //store("backrooms_large_nofill", world, 1, 4); //Makes it so the large nofill rooms can be used while generating. + // store("backrooms_large", world, 0, 14); //Makes it so the large regular rooms + // can be used while generating. + // store("backrooms_large_nofill", world, 1, 4); //Makes it so the large nofill + // rooms can be used while generating. } @Override @@ -157,53 +160,52 @@ public int getWorldHeight() { } @Override - public int getHeight(int x, int y, Heightmap.Type type, HeightLimitView world) { + public int getHeight(int x, int z, Type heightmap, HeightLimitView world, NoiseConfig noiseConfig) { return world.getTopY(); } - private void fillRoom(Chunk region, int height, int floor, int startX, int startZ, ElectricalStationRoom room){ + private void fillRoom(Chunk region, int height, int floor, int startX, int startZ, ElectricalStationRoom room) { int roomHeight = getRoomHeight(); for (int i = 0; i < height; i++) { for (int j = room.westWallX; j <= room.eastWallX; j++) { for (int k = room.northWallZ; k <= room.southWallZ; k++) { - region.setBlockState(new BlockPos(startX + j, 2 + roomHeight * floor + i, startZ + k), Blocks.AIR.getDefaultState(), false); + region.setBlockState(new BlockPos(startX + j, 2 + roomHeight * floor + i, startZ + k), + Blocks.AIR.getDefaultState(), false); } } } } @Override - public void buildSurface(ChunkRegion region, StructureAccessor structures, Chunk chunk) {} + public void buildSurface(ChunkRegion region, StructureAccessor structures, NoiseConfig noiseConfig, Chunk chunk) { + } @Override - public void carve(ChunkRegion chunkRegion, long seed, BiomeAccess biomeAccess, StructureAccessor structureAccessor, - Chunk chunk, Carver generationStep) {} + public void carve(ChunkRegion chunkRegion, long seed, NoiseConfig noiseConfig, BiomeAccess world, + StructureAccessor structureAccessor, Chunk chunk, Carver carverStep) { + } @Override - public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world) { + public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world, NoiseConfig noiseConfig) { return new VerticalBlockSample(0, new BlockState[0]); } @Override - public void getDebugHudText(List text, BlockPos pos) {} + public void getDebugHudText(List text, NoiseConfig noiseConfig, BlockPos pos) { + } @Override public int getMinimumY() { return 0; } - @Override - public MultiNoiseSampler getMultiNoiseSampler() { - return null; - } - @Override public int getSeaLevel() { return 0; } @Override - public void populateEntities(ChunkRegion region) {} + public void populateEntities(ChunkRegion region) { + } - } diff --git a/src/main/java/com/kpabr/backrooms/world/chunk/LevelTwoChunkGenerator.java b/src/main/java/com/kpabr/backrooms/world/chunk/LevelTwoChunkGenerator.java index ea6eed2..93da079 100644 --- a/src/main/java/com/kpabr/backrooms/world/chunk/LevelTwoChunkGenerator.java +++ b/src/main/java/com/kpabr/backrooms/world/chunk/LevelTwoChunkGenerator.java @@ -14,48 +14,41 @@ import net.minecraft.block.*; import net.minecraft.nbt.NbtCompound; import net.minecraft.server.world.ServerWorld; -import net.minecraft.structure.StructureSet; import net.minecraft.util.BlockRotation; import net.minecraft.util.Identifier; -import net.minecraft.util.dynamic.RegistryOps; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.noise.SimplexNoiseSampler; -import net.minecraft.util.registry.Registry; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryOps; import net.minecraft.world.ChunkRegion; import net.minecraft.world.HeightLimitView; -import net.minecraft.world.Heightmap; +import net.minecraft.world.Heightmap.Type; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeAccess; -import net.minecraft.world.biome.source.util.MultiNoiseUtil.MultiNoiseSampler; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.gen.GenerationStep.Carver; import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.chunk.Blender; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.VerticalBlockSample; -import net.minecraft.world.gen.random.AtomicSimpleRandom; -import net.minecraft.world.gen.random.ChunkRandom; +import net.minecraft.world.gen.noise.NoiseConfig; +import net.minecraft.util.math.random.ChunkRandom; +import net.minecraft.util.math.random.Random; import java.util.HashMap; import java.util.List; -import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; public class LevelTwoChunkGenerator extends ChunkGenerator { - - - public static final Codec CODEC = RecordCodecBuilder.create((instance) -> - method_41042(instance).and( - RegistryOps.createRegistryCodec(Registry.BIOME_KEY).forGetter((generator) -> generator.biomeRegistry) - ) - .apply(instance, instance.stable(LevelTwoChunkGenerator::new)) - ); - - - private final Registry biomeRegistry; + + public static final Codec CODEC = RecordCodecBuilder.create((instance) -> instance + .group(RegistryOps.getEntryLookupCodec(RegistryKeys.BIOME), + RegistryOps.getEntryLookupCodec(RegistryKeys.BLOCK)) + .apply(instance, instance.stable(LevelTwoChunkGenerator::new))); private final HashMap loadedStructures = new HashMap(30); private Identifier nbtId = BackroomsMod.id("level_2"); @@ -63,9 +56,11 @@ public class LevelTwoChunkGenerator extends ChunkGenerator { private final static int FLOOR_Y = 1; private SimplexNoiseSampler xPlaneNoise; private SimplexNoiseSampler zPlaneNoise; - private AtomicSimpleRandom random; - private final static BlockState fluorescentLightOn = BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState().with(FluorescentLightBlock.LIT, true); - private final static BlockState fluorescentLightOff = BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState().with(FluorescentLightBlock.LIT, false); + private Random random; + private final static BlockState fluorescentLightOn = BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState() + .with(FluorescentLightBlock.LIT, true); + private final static BlockState fluorescentLightOff = BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState() + .with(FluorescentLightBlock.LIT, false); private final static BlockState firesaltWestWallState = BackroomsBlocks.FIRESALT_CRYSTAL.getDefaultState() .with(FiresaltCrystalBlock.FACING, Direction.EAST); private final static BlockState firesaltNorthWallState = BackroomsBlocks.FIRESALT_CRYSTAL.getDefaultState() @@ -85,18 +80,21 @@ public class LevelTwoChunkGenerator extends ChunkGenerator { .with(PipeBlock.NORTH, false) .with(PipeBlock.SOUTH, false); - public LevelTwoChunkGenerator(Registry registry, Registry biomeRegistry) { - super(registry, Optional.empty(), new LevelTwoBiomeSource(biomeRegistry)); - this.biomeRegistry = biomeRegistry; + private RegistryEntryLookup blockLookup; + + public LevelTwoChunkGenerator(RegistryEntryLookup biomeRegistry, RegistryEntryLookup blockLookup) { + super(new LevelTwoBiomeSource(biomeRegistry)); + this.blockLookup = blockLookup; } @Override - public CompletableFuture populateNoise(Executor executor, Blender blender, StructureAccessor structureAccessor, Chunk chunk) { + public CompletableFuture populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig, + StructureAccessor structureAccessor, Chunk chunk) { if (this.random == null) { - this.random = new AtomicSimpleRandom(BackroomsLevels.LEVEL_2_WORLD.getSeed()); - final ChunkRandom planeRandom = new ChunkRandom(new AtomicSimpleRandom(BackroomsLevels.LEVEL_2_WORLD.getSeed())); - this.xPlaneNoise = new SimplexNoiseSampler(planeRandom); - this.zPlaneNoise = new SimplexNoiseSampler(planeRandom); + this.random = Random.create(BackroomsLevels.LEVEL_2_WORLD.getSeed()); + final ChunkRandom planeRandom = new ChunkRandom(Random.create(BackroomsLevels.LEVEL_2_WORLD.getSeed())); + this.xPlaneNoise = new SimplexNoiseSampler(planeRandom); + this.zPlaneNoise = new SimplexNoiseSampler(planeRandom); } if (this.loadedStructures.isEmpty()) { @@ -106,34 +104,45 @@ public CompletableFuture populateNoise(Executor executor, Blender blender final ChunkPos pos = chunk.getPos(); final var biome = getBiome(pos); - if(isPipesBiome(biome)) { + if (isPipesBiome(biome)) { final boolean isCold = biome == ChunkType.COLD_PIPES; final boolean isHot = biome == ChunkType.HOT_PIPES; Block wallBlock = Blocks.LIGHT_GRAY_TERRACOTTA; - if(isCold) wallBlock = Blocks.CYAN_TERRACOTTA; - else if(isHot) wallBlock = Blocks.RED_TERRACOTTA; + if (isCold) + wallBlock = Blocks.CYAN_TERRACOTTA; + else if (isHot) + wallBlock = Blocks.RED_TERRACOTTA; final boolean isClosestToSpawnEastWestChunkCorridor; final boolean isClosestToSpawnNorthSouthChunkCorridor; final ChunkType eastWestChunkBiome; - if(pos.x > 0) eastWestChunkBiome = getBiome(new ChunkPos(pos.x - 1, pos.z)); - else eastWestChunkBiome = getBiome(new ChunkPos(pos.x + 1, pos.z)); + if (pos.x > 0) + eastWestChunkBiome = getBiome(new ChunkPos(pos.x - 1, pos.z)); + else + eastWestChunkBiome = getBiome(new ChunkPos(pos.x + 1, pos.z)); isClosestToSpawnEastWestChunkCorridor = isPipesBiome(eastWestChunkBiome); final ChunkType northSouthChunkBiome; - if(pos.z > 0) northSouthChunkBiome = getBiome(new ChunkPos(pos.x, pos.z - 1)); - else northSouthChunkBiome = getBiome(new ChunkPos(pos.x, pos.z + 1)); + if (pos.z > 0) + northSouthChunkBiome = getBiome(new ChunkPos(pos.x, pos.z - 1)); + else + northSouthChunkBiome = getBiome(new ChunkPos(pos.x, pos.z + 1)); isClosestToSpawnNorthSouthChunkCorridor = isPipesBiome(northSouthChunkBiome); if (isClosestToSpawnEastWestChunkCorridor && isClosestToSpawnNorthSouthChunkCorridor) { // Generate intersection between two corridors - if((eastWestChunkBiome == ChunkType.HOT_PIPES || northSouthChunkBiome == ChunkType.HOT_PIPES) && random.nextBetween(0, 5) == 1) { - generateNbt(chunk, new BlockPos(pos.getStartX(), FLOOR_Y + 1, pos.getStartZ()), "hot_corridors_intersection"); - } else if((eastWestChunkBiome == ChunkType.COLD_PIPES || northSouthChunkBiome == ChunkType.COLD_PIPES) && random.nextBetween(0, 5) == 1) { - generateNbt(chunk, new BlockPos(pos.getStartX(), FLOOR_Y + 1, pos.getStartZ()), "cold_corridors_intersection"); + if ((eastWestChunkBiome == ChunkType.HOT_PIPES || northSouthChunkBiome == ChunkType.HOT_PIPES) + && random.nextBetween(0, 5) == 1) { + generateNbt(chunk, new BlockPos(pos.getStartX(), FLOOR_Y + 1, pos.getStartZ()), + "hot_corridors_intersection"); + } else if ((eastWestChunkBiome == ChunkType.COLD_PIPES || northSouthChunkBiome == ChunkType.COLD_PIPES) + && random.nextBetween(0, 5) == 1) { + generateNbt(chunk, new BlockPos(pos.getStartX(), FLOOR_Y + 1, pos.getStartZ()), + "cold_corridors_intersection"); } else { - generateNbt(chunk, new BlockPos(pos.getStartX(), FLOOR_Y + 1, pos.getStartZ()), "corridors_intersection"); + generateNbt(chunk, new BlockPos(pos.getStartX(), FLOOR_Y + 1, pos.getStartZ()), + "corridors_intersection"); } // Generate 4 random lights @@ -164,9 +173,9 @@ public CompletableFuture populateNoise(Executor executor, Blender blender fillRectZX(chunk, chunk, pos, 2, 3, 11, 13, FLOOR_Y + i, Blocks.LIGHT_GRAY_TERRACOTTA); } - } - else if (isClosestToSpawnEastWestChunkCorridor) { - generateNbt(chunk, new BlockPos(pos.getStartX(), FLOOR_Y + 1, pos.getStartZ()), "corridor", BlockRotation.CLOCKWISE_90); + } else if (isClosestToSpawnEastWestChunkCorridor) { + generateNbt(chunk, new BlockPos(pos.getStartX(), FLOOR_Y + 1, pos.getStartZ()), "corridor", + BlockRotation.CLOCKWISE_90); // Generate walls for (int i = 1; i <= 2; i++) { @@ -182,15 +191,15 @@ else if (isClosestToSpawnEastWestChunkCorridor) { random.nextBoolean() ? fluorescentLightOn : fluorescentLightOff); // Generate hot and cold pipes biomes features(magma and ice) - if(isCold) { + if (isCold) { // Generate on floor for (int z = 7; z <= 9; z++) { for (int x = 0; x < 16; x++) { - if(random.nextBetween(0, 5) == 1) { + if (random.nextBetween(0, 5) == 1) { setBlock(chunk, chunk, x, z, FLOOR_Y + 1, Blocks.PACKED_ICE); - if(random.nextBetween(0, 8) == 1) { + if (random.nextBetween(0, 8) == 1) { setBlock(chunk, chunk, x, z, FLOOR_Y + 2, Blocks.PACKED_ICE); - if(random.nextBetween(0, 8) == 1) { + if (random.nextBetween(0, 8) == 1) { setBlock(chunk, chunk, x, z, FLOOR_Y + 3, Blocks.PACKED_ICE); } } @@ -199,32 +208,32 @@ else if (isClosestToSpawnEastWestChunkCorridor) { } // Generate on wall for (int x = 0; x < 16; x++) { - if(random.nextBetween(0, 5) == 1) { + if (random.nextBetween(0, 5) == 1) { setBlock(chunk, chunk, x, 5, FLOOR_Y + 5, Blocks.PACKED_ICE); } } // Generate on roof for (int z = 7; z <= 9; z++) { for (int x = 0; x < 16; x++) { - if(random.nextBetween(0, 8) == 1) { + if (random.nextBetween(0, 8) == 1) { setBlock(chunk, chunk, x, z, FLOOR_Y + 7, Blocks.PACKED_ICE); } } } - } else if(isHot) { + } else if (isHot) { // Generate on floor for (int z = 7; z <= 9; z++) { for (int x = 0; x < 16; x++) { - if(random.nextBetween(0, 8) == 1) { + if (random.nextBetween(0, 8) == 1) { setBlock(chunk, chunk, x, z, FLOOR_Y + 1, Blocks.MAGMA_BLOCK); } } } // Generate on wall for (int x = 0; x < 16; x++) { - if(random.nextBetween(0, 10) == 1) { + if (random.nextBetween(0, 10) == 1) { setBlock(chunk, chunk, x, 5, FLOOR_Y + 5, Blocks.MAGMA_BLOCK); - if(random.nextBetween(0, 4) == 1) { + if (random.nextBetween(0, 4) == 1) { setBlock(chunk, chunk, x, 6, FLOOR_Y + 5, firesaltNorthWallState); } } @@ -232,7 +241,7 @@ else if (isClosestToSpawnEastWestChunkCorridor) { // Generate on roof for (int z = 7; z <= 9; z++) { for (int x = 0; x < 16; x++) { - if(random.nextBetween(0, 8) == 1) { + if (random.nextBetween(0, 8) == 1) { setBlock(chunk, chunk, x, z, FLOOR_Y + 7, Blocks.MAGMA_BLOCK); } } @@ -241,7 +250,7 @@ else if (isClosestToSpawnEastWestChunkCorridor) { // Generate pipes upon corridor for (int x = 0; x <= 1; x++) { - if(random.nextBetween(0, 6) == 1) { + if (random.nextBetween(0, 6) == 1) { setBlock(chunk, chunk, x, 6, FLOOR_Y + 6, pipeWestEastState.with(PipeBlock.SOUTH, true)); setBlock(chunk, chunk, x, 7, FLOOR_Y + 6, pipeNorthSouthState); setBlock(chunk, chunk, x, 8, FLOOR_Y + 6, pipeNorthSouthState); @@ -249,7 +258,7 @@ else if (isClosestToSpawnEastWestChunkCorridor) { } } for (int x = 5; x <= 10; x++) { - if(random.nextBetween(0, 6) == 1) { + if (random.nextBetween(0, 6) == 1) { setBlock(chunk, chunk, x, 6, FLOOR_Y + 6, pipeWestEastState.with(PipeBlock.SOUTH, true)); setBlock(chunk, chunk, x, 7, FLOOR_Y + 6, pipeNorthSouthState); setBlock(chunk, chunk, x, 8, FLOOR_Y + 6, pipeNorthSouthState); @@ -257,7 +266,7 @@ else if (isClosestToSpawnEastWestChunkCorridor) { } } for (int x = 14; x <= 15; x++) { - if(random.nextBetween(0, 6) == 1) { + if (random.nextBetween(0, 6) == 1) { setBlock(chunk, chunk, x, 6, FLOOR_Y + 6, pipeWestEastState.with(PipeBlock.SOUTH, true)); setBlock(chunk, chunk, x, 7, FLOOR_Y + 6, pipeNorthSouthState); setBlock(chunk, chunk, x, 8, FLOOR_Y + 6, pipeNorthSouthState); @@ -270,8 +279,7 @@ else if (isClosestToSpawnEastWestChunkCorridor) { fillRectZX(chunk, chunk, pos, 16, 5, 0, 0, FLOOR_Y + i, Blocks.LIGHT_GRAY_TERRACOTTA); fillRectZX(chunk, chunk, pos, 16, 5, 0, 11, FLOOR_Y + i, Blocks.LIGHT_GRAY_TERRACOTTA); } - } - else if (isClosestToSpawnNorthSouthChunkCorridor) { + } else if (isClosestToSpawnNorthSouthChunkCorridor) { generateNbt(chunk, new BlockPos(pos.getStartX(), FLOOR_Y + 1, pos.getStartZ()), "corridor"); // Generate walls for (int i = 1; i <= 2; i++) { @@ -287,15 +295,15 @@ else if (isClosestToSpawnNorthSouthChunkCorridor) { random.nextBoolean() ? fluorescentLightOn : fluorescentLightOff); // Generate hot and cold pipes biomes features(magma and ice) - if(isCold) { + if (isCold) { // Generate on floor for (int x = 7; x <= 9; x++) { for (int z = 0; z < 16; z++) { - if(random.nextBetween(0, 5) == 1) { + if (random.nextBetween(0, 5) == 1) { setBlock(chunk, chunk, x, z, FLOOR_Y + 1, Blocks.PACKED_ICE); - if(random.nextBetween(0, 8) == 1) { + if (random.nextBetween(0, 8) == 1) { setBlock(chunk, chunk, x, z, FLOOR_Y + 2, Blocks.PACKED_ICE); - if(random.nextBetween(0, 8) == 1) { + if (random.nextBetween(0, 8) == 1) { setBlock(chunk, chunk, x, z, FLOOR_Y + 3, Blocks.PACKED_ICE); } } @@ -304,32 +312,32 @@ else if (isClosestToSpawnNorthSouthChunkCorridor) { } // Generate on wall for (int z = 0; z < 16; z++) { - if(random.nextBetween(0, 5) == 1) { + if (random.nextBetween(0, 5) == 1) { setBlock(chunk, chunk, 5, z, FLOOR_Y + 5, Blocks.PACKED_ICE); } } // Generate on roof for (int x = 7; x <= 9; x++) { for (int z = 0; z < 16; z++) { - if(random.nextBetween(0, 8) == 1) { + if (random.nextBetween(0, 8) == 1) { setBlock(chunk, chunk, x, z, FLOOR_Y + 7, Blocks.PACKED_ICE); } } } - } else if(isHot) { + } else if (isHot) { // Generate on floor for (int x = 7; x <= 9; x++) { for (int z = 0; z < 16; z++) { - if(random.nextBetween(0, 8) == 1) { + if (random.nextBetween(0, 8) == 1) { setBlock(chunk, chunk, x, z, FLOOR_Y + 1, Blocks.MAGMA_BLOCK); } } } // Generate on wall for (int z = 0; z < 16; z++) { - if(random.nextBetween(0, 10) == 1) { + if (random.nextBetween(0, 10) == 1) { setBlock(chunk, chunk, 5, z, FLOOR_Y + 5, Blocks.MAGMA_BLOCK); - if(random.nextBetween(0, 4) == 1) { + if (random.nextBetween(0, 4) == 1) { setBlock(chunk, chunk, 6, z, FLOOR_Y + 5, firesaltWestWallState); } } @@ -337,7 +345,7 @@ else if (isClosestToSpawnNorthSouthChunkCorridor) { // Generate on roof for (int x = 7; x <= 9; x++) { for (int z = 0; z < 16; z++) { - if(random.nextBetween(0, 8) == 1) { + if (random.nextBetween(0, 8) == 1) { setBlock(chunk, chunk, x, z, FLOOR_Y + 7, Blocks.MAGMA_BLOCK); } } @@ -346,7 +354,7 @@ else if (isClosestToSpawnNorthSouthChunkCorridor) { // Generate pipes upon corridor for (int z = 0; z <= 1; z++) { - if(random.nextBetween(0, 6) == 1) { + if (random.nextBetween(0, 6) == 1) { setBlock(chunk, chunk, 6, z, FLOOR_Y + 6, pipeNorthSouthState.with(PipeBlock.EAST, true)); setBlock(chunk, chunk, 7, z, FLOOR_Y + 6, pipeWestEastState); setBlock(chunk, chunk, 8, z, FLOOR_Y + 6, pipeWestEastState); @@ -354,7 +362,7 @@ else if (isClosestToSpawnNorthSouthChunkCorridor) { } } for (int z = 5; z <= 10; z++) { - if(random.nextBetween(0, 6) == 1) { + if (random.nextBetween(0, 6) == 1) { setBlock(chunk, chunk, 6, z, FLOOR_Y + 6, pipeNorthSouthState.with(PipeBlock.EAST, true)); setBlock(chunk, chunk, 7, z, FLOOR_Y + 6, pipeWestEastState); setBlock(chunk, chunk, 8, z, FLOOR_Y + 6, pipeWestEastState); @@ -362,7 +370,7 @@ else if (isClosestToSpawnNorthSouthChunkCorridor) { } } for (int z = 14; z <= 15; z++) { - if(random.nextBetween(0, 6) == 1) { + if (random.nextBetween(0, 6) == 1) { setBlock(chunk, chunk, 6, z, FLOOR_Y + 6, pipeNorthSouthState.with(PipeBlock.EAST, true)); setBlock(chunk, chunk, 7, z, FLOOR_Y + 6, pipeWestEastState); setBlock(chunk, chunk, 8, z, FLOOR_Y + 6, pipeWestEastState); @@ -376,9 +384,8 @@ else if (isClosestToSpawnNorthSouthChunkCorridor) { fillRectZX(chunk, chunk, pos, 5, 16, 11, 0, FLOOR_Y + i, Blocks.LIGHT_GRAY_TERRACOTTA); } } - } - else { - for(int i = 1; i <= 7; i++) { + } else { + for (int i = 1; i <= 7; i++) { fillRectZX(chunk, chunk, pos, 16, 16, 0, 0, FLOOR_Y + i, Blocks.LIGHT_GRAY_TERRACOTTA); } } @@ -392,16 +399,21 @@ public void storeStructures(ServerWorld world) { store("cold_corridors_intersection", world); store("corridor", world); } + private void store(String id, ServerWorld world) { - loadedStructures.put(id, NbtPlacerUtil.load(world.getServer().getResourceManager(), new Identifier(this.nbtId.getNamespace(), "nbt/" + this.nbtId.getPath() + "/" + id + ".nbt")).get()); - } + loadedStructures.put(id, + NbtPlacerUtil.load(world.getServer().getResourceManager(), + new Identifier(this.nbtId.getNamespace(), "nbt/" + this.nbtId.getPath() + "/" + id + ".nbt"), + this.blockLookup).get()); + } @Override - public int getHeight(int var1, int var2, Heightmap.Type var3, HeightLimitView var4) { + public int getHeight(int x, int z, Type heightmap, HeightLimitView world, NoiseConfig noiseConfig) { return ROOF_Y + 5; } private final static int chunksToCheckBeforeCurrentChunk = 3; + public ChunkType getChunkType(ChunkPos chunk) { int z = chunk.z, x = chunk.x; if (z == 0 || x == 0) { @@ -411,7 +423,7 @@ public ChunkType getChunkType(ChunkPos chunk) { if (xNoise < -0.45) { boolean isSuccessful = true; - if(Math.abs(x) < 4) { + if (Math.abs(x) < 4) { isSuccessful = false; } @@ -433,13 +445,14 @@ public ChunkType getChunkType(ChunkPos chunk) { } } - if(isSuccessful) { - if (xNoise < -0.85) return ChunkType.COLD_PIPES; + if (isSuccessful) { + if (xNoise < -0.85) + return ChunkType.COLD_PIPES; return ChunkType.PIPES; } } if (zNoise > 0.45) { - if(Math.abs(z) < 4) { + if (Math.abs(z) < 4) { return ChunkType.EMPTY; } // If 4 <= z <= 6, only chunks in [4; z) bounds will be checked @@ -458,7 +471,8 @@ public ChunkType getChunkType(ChunkPos chunk) { } } - if (zNoise > 0.85) return ChunkType.HOT_PIPES; + if (zNoise > 0.85) + return ChunkType.HOT_PIPES; return ChunkType.PIPES; } @@ -468,23 +482,29 @@ public ChunkType getChunkType(ChunkPos chunk) { private void setBlock(Chunk region, Chunk chunk, int alignX, int alignZ, int y, final Block block) { setBlock(region, chunk, alignX, alignZ, y, block.getDefaultState()); } + private void setBlock(Chunk region, Chunk chunk, int alignX, int alignZ, int y, BlockState state) { setBlockState(region, chunk, state, new BlockPos(chunk.getPos().getStartX() + alignX, y, chunk.getPos().getStartZ() + alignZ)); } - private void fillRectZX(Chunk region, Chunk chunk, ChunkPos pos, int sizeX, int sizeZ, int alignX, int alignZ, int y, final Block block) { + + private void fillRectZX(Chunk region, Chunk chunk, ChunkPos pos, int sizeX, int sizeZ, int alignX, int alignZ, + int y, final Block block) { fillRectZX(region, chunk, pos, sizeX, sizeZ, alignX, alignZ, y, block.getDefaultState()); } + private boolean isPipesBiome(ChunkType biome) { return biome == ChunkType.PIPES || biome == ChunkType.COLD_PIPES || biome == ChunkType.HOT_PIPES; } + private ChunkType getBiome(ChunkPos chunk) { return getChunkType(chunk); } - private void fillRectZX(Chunk region, Chunk chunk, ChunkPos pos, int sizeX, int sizeZ, int alignX, int alignZ, int y, BlockState state) { - for(int i = 0; i < sizeX; i++) { - for(int j = 0; j < sizeZ; j++) { + private void fillRectZX(Chunk region, Chunk chunk, ChunkPos pos, int sizeX, int sizeZ, int alignX, int alignZ, + int y, BlockState state) { + for (int i = 0; i < sizeX; i++) { + for (int j = 0; j < sizeZ; j++) { setBlockState(region, chunk, state, new BlockPos(pos.getStartX() + alignX + i, y, pos.getStartZ() + alignZ + j)); } @@ -497,7 +517,7 @@ private void fillRectZX(Chunk region, Chunk chunk, ChunkPos pos, int sizeX, int */ private void setBlockState(Chunk region, Chunk chunk, BlockState state, BlockPos pos) { final BlockState blockState = chunk.setBlockState(pos, state, false); - if(blockState != null) { + if (blockState != null) { BackroomsLevels.LEVEL_2_WORLD.onBlockChanged(pos, blockState, state); } } @@ -507,53 +527,46 @@ protected Codec getCodec() { return CODEC; } - @Override - public ChunkGenerator withSeed(long seed) { - return this; - } - @Override public int getMinimumY() { return FLOOR_Y - 1; } @Override - public void buildSurface(ChunkRegion region, StructureAccessor structureAccessor, Chunk chunk) { + public void buildSurface(ChunkRegion region, StructureAccessor structures, NoiseConfig noiseConfig, Chunk chunk) { } private void generateNbt(Chunk region, BlockPos at, String id, BlockRotation rotation) { - loadedStructures.get(id).rotate(rotation).generateNbt(region, at, (pos, state, nbt) -> this.modifyStructure(region, pos, state, nbt)); - } + loadedStructures.get(id).rotate(rotation, this.blockLookup).generateNbt(region, at, + (pos, state, nbt) -> this.modifyStructure(region, pos, state, nbt)); + } private void generateNbt(Chunk region, BlockPos at, String id) { - generateNbt(region, at, id, BlockRotation.NONE); - } + generateNbt(region, at, id, BlockRotation.NONE); + } private void modifyStructure(Chunk region, BlockPos pos, BlockState state, NbtCompound nbt) { - if (!state.isAir()) { - if (state.isOf(Blocks.BARRIER)) { - region.setBlockState(pos, Blocks.AIR.getDefaultState(), true); - } else { - region.setBlockState(pos, state, true); - } - } - } + if (!state.isAir()) { + if (state.isOf(Blocks.BARRIER)) { + region.setBlockState(pos, Blocks.AIR.getDefaultState(), true); + } else { + region.setBlockState(pos, state, true); + } + } + } @Override - public void carve(ChunkRegion chunkRegion, long seed, BiomeAccess biomeAccess, StructureAccessor structureAccessor, - Chunk chunk, Carver generationStep) {} + public void carve(ChunkRegion chunkRegion, long seed, NoiseConfig noiseConfig, BiomeAccess world, + StructureAccessor structureAccessor, Chunk chunk, Carver carverStep) { + } @Override - public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world) { + public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world, NoiseConfig noiseConfig) { return new VerticalBlockSample(0, new BlockState[0]); } @Override - public void getDebugHudText(List text, BlockPos pos) {} - - @Override - public MultiNoiseSampler getMultiNoiseSampler() { - return null; + public void getDebugHudText(List text, NoiseConfig noiseConfig, BlockPos pos) { } @Override @@ -567,5 +580,6 @@ public int getWorldHeight() { } @Override - public void populateEntities(ChunkRegion region) {} + public void populateEntities(ChunkRegion region) { + } } diff --git a/src/main/java/com/kpabr/backrooms/world/chunk/LevelZeroChunkGenerator.java b/src/main/java/com/kpabr/backrooms/world/chunk/LevelZeroChunkGenerator.java index 24225ac..73b63a8 100644 --- a/src/main/java/com/kpabr/backrooms/world/chunk/LevelZeroChunkGenerator.java +++ b/src/main/java/com/kpabr/backrooms/world/chunk/LevelZeroChunkGenerator.java @@ -1,7 +1,6 @@ package com.kpabr.backrooms.world.chunk; import java.util.List; -import java.util.Optional; import java.util.Random; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -24,38 +23,34 @@ import net.minecraft.block.entity.BarrelBlockEntity; import net.minecraft.nbt.NbtCompound; import net.minecraft.server.world.ServerWorld; -import net.minecraft.structure.StructureSet; import net.minecraft.util.BlockRotation; import net.minecraft.util.Identifier; -import net.minecraft.util.dynamic.RegistryOps; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.RegistryKey; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryOps; import net.minecraft.world.ChunkRegion; import net.minecraft.world.HeightLimitView; -import net.minecraft.world.Heightmap; +import net.minecraft.world.Heightmap.Type; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.BiomeAccess; -import net.minecraft.world.biome.source.util.MultiNoiseUtil; import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.gen.GenerationStep; +import net.minecraft.world.gen.GenerationStep.Carver; import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.chunk.Blender; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.VerticalBlockSample; +import net.minecraft.world.gen.noise.NoiseConfig; public class LevelZeroChunkGenerator extends ChunkGenerator { - public static final Codec CODEC = RecordCodecBuilder.create((instance) -> - method_41042(instance).and( - RegistryOps.createRegistryCodec(Registry.BIOME_KEY).forGetter((generator) -> generator.biomeRegistry) - ) - .apply(instance, instance.stable(LevelZeroChunkGenerator::new)) - ); - - private final Registry biomeRegistry; + + public static final Codec CODEC = RecordCodecBuilder.create((instance) -> instance + .group(RegistryOps.getEntryLookupCodec(RegistryKeys.BIOME), + RegistryOps.getEntryLookupCodec(RegistryKeys.BLOCK)) + .apply(instance, instance.stable(LevelZeroChunkGenerator::new))); private static final int ROOF_BEGIN_Y = 6 * (getFloorCount() + 1) + 1; private static final BlockState ROOF_BLOCK = BackroomsBlocks.BEDROCK_BRICKS.getDefaultState(); @@ -63,33 +58,25 @@ public class LevelZeroChunkGenerator extends ChunkGenerator { private Identifier nbtId = BackroomsMod.id("level_zero"); private Random moldPlacementRandom; + private RegistryEntryLookup blockLookup; - public LevelZeroChunkGenerator(Registry registry, Registry biomeRegistry) { - super(registry, Optional.empty(), new LevelZeroBiomeSource(biomeRegistry)); - this.biomeRegistry = biomeRegistry; - } - - @Override - protected Codec getCodec() { - return CODEC; - } - - @Override - public ChunkGenerator withSeed(long seed) { - return this; - } + public LevelZeroChunkGenerator(RegistryEntryLookup biomeRegistry, RegistryEntryLookup blockLookup) { + super(new LevelZeroBiomeSource(biomeRegistry)); + this.blockLookup = blockLookup; + } - @Override - public MultiNoiseUtil.MultiNoiseSampler getMultiNoiseSampler() { - return null; - } + @Override + protected Codec getCodec() { + return CODEC; + } - @Override - public void carve(ChunkRegion chunkRegion, long l, BiomeAccess biomeAccess, StructureAccessor structureAccessor, Chunk chunk, GenerationStep.Carver carver) { - } + @Override + public void carve(ChunkRegion chunkRegion, long seed, NoiseConfig noiseConfig, BiomeAccess world, + StructureAccessor structureAccessor, Chunk chunk, Carver carverStep) { + } - @Override - public void buildSurface(ChunkRegion region, StructureAccessor structureAccessor, Chunk chunk) { + @Override + public void buildSurface(ChunkRegion region, StructureAccessor structures, NoiseConfig noiseConfig, Chunk chunk) { if (this.moldPlacementRandom == null) { this.moldPlacementRandom = new Random(BackroomsLevels.LEVEL_0_WORLD.getSeed()); @@ -103,24 +90,22 @@ public void buildSurface(ChunkRegion region, StructureAccessor structureAccessor for (int z = 0; z < 16; z++) { for (int y = 0; y < ROOF_BEGIN_Y; y++) { // does a swap from the various stones to the custom blocks - if(isBiomeEquals(BackroomsLevels.CRIMSON_WALLS_BIOME, chunk, biomePos)) { + if (isBiomeEquals(BackroomsLevels.CRIMSON_WALLS_BIOME, chunk, biomePos)) { final BlockPos pos = chunkPos.getBlockPos(x, y, z); final BlockState block = chunk.getBlockState(pos); if (block == BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState()) { replace(BackroomsBlocks.RED_PATTERNED_WALLPAPER, chunk, pos); - } - else if (block.getBlock() == BackroomsBlocks.WOOLEN_CARPET + } else if (block.getBlock() == BackroomsBlocks.WOOLEN_CARPET || block == BackroomsBlocks.MOLDY_WOOLEN_CARPET.getDefaultState()) { replace(BackroomsBlocks.RED_CARPETING, chunk, pos); - } - else if (block == BackroomsBlocks.CORK_TILE.getDefaultState() - && moldPlacementRandom.nextDouble() < BackroomsConfig.getInstance().moldyCorkTileChance) { + } else if (block == BackroomsBlocks.CORK_TILE.getDefaultState() + && moldPlacementRandom + .nextDouble() < BackroomsConfig.getInstance().moldyCorkTileChance) { replace(BackroomsBlocks.MOLDY_CORK_TILE, chunk, pos); } - } - else if(isBiomeEquals(BackroomsLevels.DECREPIT_BIOME, chunk, biomePos)) { + } else if (isBiomeEquals(BackroomsLevels.DECREPIT_BIOME, chunk, biomePos)) { final BlockPos pos = chunkPos.getBlockPos(x, y, z); final BlockState block = chunk.getBlockState(pos); @@ -134,36 +119,39 @@ else if(isBiomeEquals(BackroomsLevels.DECREPIT_BIOME, chunk, biomePos)) { } } + } - } - - @Override - public void populateEntities(ChunkRegion region) { - } + @Override + public void populateEntities(ChunkRegion region) { + } - @Override - public int getWorldHeight() { - return 0; - } + @Override + public int getWorldHeight() { + return 0; + } - @Override - public CompletableFuture populateNoise(Executor executor, Blender blender, StructureAccessor structureAccessor, Chunk chunk) { + @Override + public CompletableFuture populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig, + StructureAccessor structureAccessor, Chunk chunk) { // IMPORTANT NOTE: - // For biomes generation we're using various "placeholder" blocks to replace them later with blocks we actually need in biomes. - // If you're adding new type of structure then don't use blocks other than described below from our mod! + // For biomes generation we're using various "placeholder" blocks to replace + // them later with blocks we actually need in biomes. + // If you're adding new type of structure then don't use blocks other than + // described below from our mod! // Instead, use those blocks: // BackroomsBlocks.PATTERNED_WALLPAPER -> any wallpaper // BackroomsBlocks.WOOLEN_CARPET -> any carpet // BackroomsBlocks.CORK_TILE -> any cork tile // BackroomsBlocks.FLUORESCENT_LIGHT -> any light source - // BackroomsBlocks.MOLDY_WOOLEN_CARPET -> random blocks(you can just replace them with carpet) + // BackroomsBlocks.MOLDY_WOOLEN_CARPET -> random blocks(you can just replace + // them with carpet) final ChunkPos chunkPos = chunk.getPos(); final BlockPos biomePos = chunkPos.getBlockPos(4, 4, 4); - //Save the starting x and z position of the chunk. Note: positive x means east, positive z means south. + // Save the starting x and z position of the chunk. Note: positive x means east, + // positive z means south. final int startX = chunkPos.getStartX(); final int startZ = chunkPos.getStartZ(); - if (this.loadedStructures.isEmpty()) { storeStructures(BackroomsLevels.LEVEL_0_WORLD); } @@ -174,365 +162,429 @@ public CompletableFuture populateNoise(Executor executor, Blender blender chunk.setBlockState(new BlockPos(x, ROOF_BEGIN_Y, z), ROOF_BLOCK, false); } } - + if (isBiomeEquals(BackroomsLevels.MEGALOPHOBIA_BIOME, chunk, biomePos)) { - - - //Create 3 floors, top to bottom, because one Megalophobia floor equals 2 normal floors. - for (int y = 2; y >= 0; y--) { - //Create 16 smaller sections of the floor, layed out in a 4x4 pattern. Each section will consist of the carpeting, the ceiling, two walls (located on the eastern and southern side of the section) and a pillar, located in the southeasternmost space. - for (int x = 1; x >= 0; x--) { - for (int z = 1; z >= 0; z--) { - //Make a Random object controlling the generation of the section. - final Random random = new Random(BackroomsLevels.LEVEL_0_WORLD.getSeed()+ MathHelper.hashCode(startX, startZ, x + 4 * z + 20 * y)); - //Decide the arrangement of the walls of the section. The two numbers with an F directly after them denote the probability of an eastern wall and a southern wall generating, respectively. - final int wallType = (random.nextFloat() < 0.4F ? 1 : 0) + (random.nextFloat() < 0.4F ? 2 : 0); - - //Check if the arrangement includes the eastern wall. - // and create eastern wall if true - if ((wallType & 1) == 1) { - for(int i = 0; i < 7; i++){ - for(int j = 0; j < 10; j++) { - for(int k = 0; k < 2; k++){ - chunk.setBlockState( - new BlockPos(startX + x * 8 + 6 + k, 2 + 12 * y + j, startZ + z * 8 + i), - BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState(), - false); + // Create 3 floors, top to bottom, because one Megalophobia floor equals 2 + // normal floors. + for (int y = 2; y >= 0; y--) { + // Create 16 smaller sections of the floor, layed out in a 4x4 pattern. Each + // section will consist of the carpeting, the ceiling, two walls (located on the + // eastern and southern side of the section) and a pillar, located in the + // southeasternmost space. + for (int x = 1; x >= 0; x--) { + for (int z = 1; z >= 0; z--) { + // Make a Random object controlling the generation of the section. + final Random random = new Random(BackroomsLevels.LEVEL_0_WORLD.getSeed() + + BlockPos.asLong(startX, startZ, x + 4 * z + 20 * y)); + // Decide the arrangement of the walls of the section. The two numbers with an F + // directly after them denote the probability of an eastern wall and a southern + // wall generating, respectively. + final int wallType = (random.nextFloat() < 0.4F ? 1 : 0) + (random.nextFloat() < 0.4F ? 2 : 0); + + // Check if the arrangement includes the eastern wall. + // and create eastern wall if true + if ((wallType & 1) == 1) { + for (int i = 0; i < 7; i++) { + for (int j = 0; j < 10; j++) { + for (int k = 0; k < 2; k++) { + chunk.setBlockState( + new BlockPos(startX + x * 8 + 6 + k, 2 + 12 * y + j, + startZ + z * 8 + i), + BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState(), + false); + } } } } - } - // Check if the arrangement includes the southern wall - // and create southern wall if true - if ((wallType & 2) == 2) { - for(int i = 0; i < 7; i++){ - for(int j = 0; j < 10; j++){ - for(int k = 0; k < 2; k++){ - chunk.setBlockState( - new BlockPos(startX + x * 8 + i, 2 + 12 * y + j, startZ + z * 8 + 6 + k), - BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState(), - false); + // Check if the arrangement includes the southern wall + // and create southern wall if true + if ((wallType & 2) == 2) { + for (int i = 0; i < 7; i++) { + for (int j = 0; j < 10; j++) { + for (int k = 0; k < 2; k++) { + chunk.setBlockState( + new BlockPos(startX + x * 8 + i, 2 + 12 * y + j, + startZ + z * 8 + 6 + k), + BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState(), + false); + } } } } - } - // New variable controlling whether a pillar in generated. - // If there's a wall in the current section, always create a pillar. - boolean pillar = wallType != 0; - - //If you're on the southeasternmost spot on the chunk, always make a pillar. - pillar = pillar || (x == 1 && z == 1); - - // Check if you're not on the eastern edge of the chunk. If you aren't, proceed. - // Check one block east whether there's a wall there. If so, a pillar will always be generated. - if(x != 1) { - pillar = pillar || - !chunk.getBlockState(new BlockPos(startX + x * 8 + 8, 2 + 12 * y, startZ + z * 8 + 7)).isAir(); - } - // Check if you're not on the southern edge of the chunk. If you aren't, proceed. - if(z != 1) { - // Check one block south whether there's a wall there. If so, a pillar will always be generated. - pillar = pillar || !chunk.getBlockState(new BlockPos(startX + x * 8 + 7, 2 + 12 * y, startZ + z * 8 + 8)).isAir(); - } - pillar = pillar || (random.nextFloat() < 0.2F); //Sometimes generate a pillar anyways, even if none of the previous conditions were met. - if (pillar) { - //Create the pillar. - for (int i = 0; i < 10; i++) { - for (int j = 0; j < 2; j++) { - for (int k = 0; k < 2; k++) { - chunk.setBlockState(new BlockPos(startX + x * 8 + 6 + j, 2 + 12 * y + i, startZ + z * 8 + 6 + k), BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState(), false); + // New variable controlling whether a pillar in generated. + // If there's a wall in the current section, always create a pillar. + boolean pillar = wallType != 0; + + // If you're on the southeasternmost spot on the chunk, always make a pillar. + pillar = pillar || (x == 1 && z == 1); + + // Check if you're not on the eastern edge of the chunk. If you aren't, proceed. + // Check one block east whether there's a wall there. If so, a pillar will + // always be generated. + if (x != 1) { + pillar = pillar || + !chunk.getBlockState( + new BlockPos(startX + x * 8 + 8, 2 + 12 * y, startZ + z * 8 + 7)).isAir(); + } + // Check if you're not on the southern edge of the chunk. If you aren't, + // proceed. + if (z != 1) { + // Check one block south whether there's a wall there. If so, a pillar will + // always be generated. + pillar = pillar || !chunk + .getBlockState(new BlockPos(startX + x * 8 + 7, 2 + 12 * y, startZ + z * 8 + 8)) + .isAir(); + } + pillar = pillar || (random.nextFloat() < 0.2F); // Sometimes generate a pillar anyways, even if + // none of the previous conditions were met. + if (pillar) { + // Create the pillar. + for (int i = 0; i < 10; i++) { + for (int j = 0; j < 2; j++) { + for (int k = 0; k < 2; k++) { + chunk.setBlockState( + new BlockPos(startX + x * 8 + 6 + j, 2 + 12 * y + i, + startZ + z * 8 + 6 + k), + BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState(), false); + } } } } - } - // Generate the carpeting and the ceiling. - for(int i = 0; i < 8; i++) { - for(int j = 0; j < 8; j++){ - chunk.setBlockState(new BlockPos(startX + x * 8 + i, 1 + 12 * y, startZ + z * 8 + j), BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), false); - chunk.setBlockState(new BlockPos(startX + x * 8 + i, 12 + 12 * y, startZ + z * 8 + j), BackroomsBlocks.CORK_TILE.getDefaultState(), false); + // Generate the carpeting and the ceiling. + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 8; j++) { + chunk.setBlockState(new BlockPos(startX + x * 8 + i, 1 + 12 * y, startZ + z * 8 + j), + BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), false); + chunk.setBlockState(new BlockPos(startX + x * 8 + i, 12 + 12 * y, startZ + z * 8 + j), + BackroomsBlocks.CORK_TILE.getDefaultState(), false); + } } + // Place a ceiling light. + chunk.setBlockState(new BlockPos(startX + x * 8 + 2, 12 + 12 * y, startZ + z * 8 + 2), + BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); + chunk.setBlockState(new BlockPos(startX + x * 8 + 2, 12 + 12 * y, startZ + z * 8 + 3), + BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); + chunk.setBlockState(new BlockPos(startX + x * 8 + 3, 12 + 12 * y, startZ + z * 8 + 2), + BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); + chunk.setBlockState(new BlockPos(startX + x * 8 + 3, 12 + 12 * y, startZ + z * 8 + 3), + BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); } - //Place a ceiling light. - chunk.setBlockState(new BlockPos(startX + x * 8 + 2, 12 + 12 * y, startZ + z * 8 + 2), BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); - chunk.setBlockState(new BlockPos(startX + x * 8 + 2, 12 + 12 * y, startZ + z * 8 + 3), BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); - chunk.setBlockState(new BlockPos(startX + x * 8 + 3, 12 + 12 * y, startZ + z * 8 + 2), BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); - chunk.setBlockState(new BlockPos(startX + x * 8 + 3, 12 + 12 * y, startZ + z * 8 + 3), BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); } } - } - //Mold placement code; will be subject to heavy revisions, so ignore for now. - for (int y = getFloorCount(); y >= 0; y--) { - final Random fullFloorRandom = new Random(BackroomsLevels.LEVEL_0_WORLD.getSeed() - + MathHelper.hashCode(chunk.getPos().getStartX(), chunk.getPos().getStartZ(), y)); - - for(int i = 0 ; i < 300; i++){ - final int x = fullFloorRandom.nextInt(16); - final int z = fullFloorRandom.nextInt(16); - int x2 = x + fullFloorRandom.nextInt(3) - 1; - int z2 = fullFloorRandom.nextInt(3) - 1; - if(chunk.getBlockState(new BlockPos(startX + x, 1 + 12 * y, startZ + z)) - == BackroomsBlocks.WOOLEN_CARPET.getDefaultState()){ - if(x2 < 0) x2=0; - else if(x2 > 15) x2=15; - if(z2 < 0) z2=0; - else if(z2 > 15) z2=15; - if(fullFloorRandom.nextFloat() < 0.1F || chunk.getBlockState(new BlockPos(startX + x2, 1 + 12 * y, startZ + z2)) == BackroomsBlocks.CORK_TILE.getDefaultState()) { - chunk.setBlockState( - new BlockPos(startX + x, 1 + 12 * y, startZ + z), - BackroomsBlocks.MOLDY_WOOLEN_CARPET.getDefaultState(), - false); + // Mold placement code; will be subject to heavy revisions, so ignore for now. + for (int y = getFloorCount(); y >= 0; y--) { + final Random fullFloorRandom = new Random(BackroomsLevels.LEVEL_0_WORLD.getSeed() + + BlockPos.asLong(chunk.getPos().getStartX(), chunk.getPos().getStartZ(), y)); + + for (int i = 0; i < 300; i++) { + final int x = fullFloorRandom.nextInt(16); + final int z = fullFloorRandom.nextInt(16); + int x2 = x + fullFloorRandom.nextInt(3) - 1; + int z2 = fullFloorRandom.nextInt(3) - 1; + if (chunk.getBlockState(new BlockPos(startX + x, 1 + 12 * y, + startZ + z)) == BackroomsBlocks.WOOLEN_CARPET.getDefaultState()) { + if (x2 < 0) + x2 = 0; + else if (x2 > 15) + x2 = 15; + if (z2 < 0) + z2 = 0; + else if (z2 > 15) + z2 = 15; + if (fullFloorRandom.nextFloat() < 0.1F || chunk.getBlockState(new BlockPos(startX + x2, + 1 + 12 * y, startZ + z2)) == BackroomsBlocks.CORK_TILE.getDefaultState()) { + chunk.setBlockState( + new BlockPos(startX + x, 1 + 12 * y, startZ + z), + BackroomsBlocks.MOLDY_WOOLEN_CARPET.getDefaultState(), + false); + } } } } - } - // Place bedrock bricks at the bottom. - for (int x = startX; x < startX + 16; x++) { - for (int z = startZ; z < startZ + 16; z++) { - chunk.setBlockState(new BlockPos(x, 0, z), ROOF_BLOCK, false); + // Place bedrock bricks at the bottom. + for (int x = startX; x < startX + 16; x++) { + for (int z = startZ; z < startZ + 16; z++) { + chunk.setBlockState(new BlockPos(x, 0, z), ROOF_BLOCK, false); + } } - } - return CompletableFuture.completedFuture(chunk); - } else { - - - //Create 5 floors, top to bottom. - for (int y = getFloorCount(); y >= 0; y--) { - //Create 16 smaller sections of the floor, layed out in a 4x4 pattern. Each section will consist of the carpeting, the ceiling, two walls (located on the eastern and southern side of the section) and a pillar, located in the southeasternmost space. - for (int x = 3; x >= 0; x--) { - for (int z = 3; z >= 0; z--) { - //Make a Random object controlling the generation of the section. - final Random random = new Random(BackroomsLevels.LEVEL_0_WORLD.getSeed() + MathHelper.hashCode(startX, startZ, x + 4 * z + 20 * y)); - //Decide the arrangement of the walls of the section. The two numbers with an F directly after them denote the probability of an eastern wall and a southern wall generating, respectively. - final int wallType = (random.nextFloat() < 0.4F ? 1 : 0) + (random.nextFloat() < 0.4F ? 2 : 0); - - //Check if the arrangement includes the eastern wall. - // and create eastern wall if true - if ((wallType & 1) == 1) { - for(int i = 0; i < 3; i++){ - for(int j = 0; j < 4; j++){ - chunk.setBlockState( - new BlockPos(startX + x * 4 + 3, 2 + 6 * y + j, startZ + z * 4 + i), - BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState(), - false); + return CompletableFuture.completedFuture(chunk); + } else { + + // Create 5 floors, top to bottom. + for (int y = getFloorCount(); y >= 0; y--) { + // Create 16 smaller sections of the floor, layed out in a 4x4 pattern. Each + // section will consist of the carpeting, the ceiling, two walls (located on the + // eastern and southern side of the section) and a pillar, located in the + // southeasternmost space. + for (int x = 3; x >= 0; x--) { + for (int z = 3; z >= 0; z--) { + // Make a Random object controlling the generation of the section. + final Random random = new Random(BackroomsLevels.LEVEL_0_WORLD.getSeed() + + BlockPos.asLong(startX, startZ, x + 4 * z + 20 * y)); + // Decide the arrangement of the walls of the section. The two numbers with an F + // directly after them denote the probability of an eastern wall and a southern + // wall generating, respectively. + final int wallType = (random.nextFloat() < 0.4F ? 1 : 0) + (random.nextFloat() < 0.4F ? 2 : 0); + + // Check if the arrangement includes the eastern wall. + // and create eastern wall if true + if ((wallType & 1) == 1) { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 4; j++) { + chunk.setBlockState( + new BlockPos(startX + x * 4 + 3, 2 + 6 * y + j, startZ + z * 4 + i), + BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState(), + false); + } } } - } - // Check if the arrangement includes the southern wall - // and create southern wall if true - if ((wallType & 2) == 2) { - for(int i = 0; i < 3; i++){ - for(int j = 0; j < 4; j++){ - chunk.setBlockState( - new BlockPos(startX + x * 4 + i, 2 + 6 * y + j, startZ + z * 4 + 3), - BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState(), - false); + // Check if the arrangement includes the southern wall + // and create southern wall if true + if ((wallType & 2) == 2) { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 4; j++) { + chunk.setBlockState( + new BlockPos(startX + x * 4 + i, 2 + 6 * y + j, startZ + z * 4 + 3), + BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState(), + false); + } } } - } - // New variable controlling whether a pillar in generated. - // If there's a wall in the current section, always create a pillar. - boolean pillar = wallType != 0; - - //If you're on the southeasternmost spot on the chunk, always make a pillar. - pillar = pillar || (x == 3 && z == 3); - - // Check if you're not on the eastern edge of the chunk. If you aren't, proceed. - // Check one block east whether there's a wall there. If so, a pillar will always be generated. - if(x != 3) { - pillar = pillar || - !chunk.getBlockState(new BlockPos(startX + x * 4 + 4, 2 + 6 * y, startZ + z * 4 + 3)).isAir(); - } - // Check if you're not on the southern edge of the chunk. If you aren't, proceed. - if(z != 3) { - // Check one block south whether there's a wall there. If so, a pillar will always be generated. - pillar = pillar || !chunk.getBlockState(new BlockPos(startX + x * 4 + 3, 2 + 6 * y, startZ + z * 4 + 4)).isAir(); - } - pillar = pillar || (random.nextFloat() < 0.2F); //Sometimes generate a pillar anyways, even if none of the previous conditions were met. - if (pillar) { - //Create the pillar. - for (int i = 0; i < 4; i++) { - chunk.setBlockState(new BlockPos(startX + x * 4 + 3, 2 + 6 * y + i, startZ + z * 4 + 3), BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState(), false); + // New variable controlling whether a pillar in generated. + // If there's a wall in the current section, always create a pillar. + boolean pillar = wallType != 0; + + // If you're on the southeasternmost spot on the chunk, always make a pillar. + pillar = pillar || (x == 3 && z == 3); + + // Check if you're not on the eastern edge of the chunk. If you aren't, proceed. + // Check one block east whether there's a wall there. If so, a pillar will + // always be generated. + if (x != 3) { + pillar = pillar || + !chunk.getBlockState( + new BlockPos(startX + x * 4 + 4, 2 + 6 * y, startZ + z * 4 + 3)).isAir(); } - } - // Generate the carpeting and the ceiling. - for(int i = 0; i < 4; i++) { - for(int j = 0; j < 4; j++){ - chunk.setBlockState(new BlockPos(startX + x * 4 + i, 1 + 6 * y, startZ + z * 4 + j), BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), false); - chunk.setBlockState(new BlockPos(startX + x * 4 + i, 6 + 6 * y, startZ + z * 4 + j), BackroomsBlocks.CORK_TILE.getDefaultState(), false); + // Check if you're not on the southern edge of the chunk. If you aren't, + // proceed. + if (z != 3) { + // Check one block south whether there's a wall there. If so, a pillar will + // always be generated. + pillar = pillar || !chunk + .getBlockState(new BlockPos(startX + x * 4 + 3, 2 + 6 * y, startZ + z * 4 + 4)) + .isAir(); + } + pillar = pillar || (random.nextFloat() < 0.2F); // Sometimes generate a pillar anyways, even if + // none of the previous conditions were met. + if (pillar) { + // Create the pillar. + for (int i = 0; i < 4; i++) { + chunk.setBlockState(new BlockPos(startX + x * 4 + 3, 2 + 6 * y + i, startZ + z * 4 + 3), + BackroomsBlocks.PATTERNED_WALLPAPER.getDefaultState(), false); + } } + // Generate the carpeting and the ceiling. + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + chunk.setBlockState(new BlockPos(startX + x * 4 + i, 1 + 6 * y, startZ + z * 4 + j), + BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), false); + chunk.setBlockState(new BlockPos(startX + x * 4 + i, 6 + 6 * y, startZ + z * 4 + j), + BackroomsBlocks.CORK_TILE.getDefaultState(), false); + } + } + // Place a ceiling light. + chunk.setBlockState(new BlockPos(startX + x * 4 + 1, 6 + 6 * y, startZ + z * 4 + 1), + BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); } - //Place a ceiling light. - chunk.setBlockState(new BlockPos(startX + x * 4 + 1, 6 + 6 * y, startZ + z * 4 + 1), BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); } - } - // Create an unique random Object for the current floor. - final Random fullFloorRandom = new Random(BackroomsLevels.LEVEL_0_WORLD.getSeed() + MathHelper.hashCode(chunk.getPos().getStartX(), chunk.getPos().getStartZ(), y)); - // Check whether a random number between zero and one is less than the number with an F directly after it. Currently, for debugging reasons, a "|| true" has been placed, which means that the following code will be excecuted anyways. - // Place a large (7x7 or bigger) room in the current chunk at the current floor. Both dimensions of the base of the room must be of the form 4x-1. - if (fullFloorRandom.nextFloat() < 0.1F || true) { - //Define the amounts of regular and nofill rooms. - final int regularRooms = 14; - final int nofillRooms = 4; - //Choose the room that will be placed. - int roomNumber = (fullFloorRandom.nextInt(regularRooms + nofillRooms) + 1); - //The number with an F directly after it denotes the probability of an empty room being generated regardless. - if(fullFloorRandom.nextFloat() < 0.6F) { - roomNumber = 0; - } - String roomName = "backrooms_large_" + roomNumber; - if(roomNumber > regularRooms) { - roomName = "backrooms_large_nofill_" + (roomNumber - regularRooms); - } - //Choose the rotation for the room. - Direction dir = Direction.fromHorizontal(fullFloorRandom.nextInt(4)); - BlockRotation rotation = switch(dir) { - case NORTH -> BlockRotation.COUNTERCLOCKWISE_90; - case EAST -> BlockRotation.NONE; - case SOUTH -> BlockRotation.CLOCKWISE_90; - default -> BlockRotation.CLOCKWISE_180; - }; - - // Calculate size of current room - final var currentRoom = this.loadedStructures.get(roomName); - - int sizeY = currentRoom.sizeY, sizeX, sizeZ; - final boolean isEastOrWestDirection = dir.equals(Direction.EAST) || dir.equals(Direction.WEST); - if(isEastOrWestDirection) { - sizeX = currentRoom.sizeX; - sizeZ = currentRoom.sizeZ; - } else { - sizeX = currentRoom.sizeZ; - sizeZ = currentRoom.sizeX; - } - // Place a structure only if it fits before the bedrock - if(6 * y + sizeY < ROOF_BEGIN_Y) { - //Choose a spot in the chunk. - final int x = fullFloorRandom.nextInt(5 - (sizeX + 1) / 4); - final int z = fullFloorRandom.nextInt(5 - (sizeZ + 1) / 4); - //Fill the area the room will be placed in with air. - if(roomNumber <= regularRooms) { - for (int i = 0; i < sizeX; i++) { - for (int j = 0; j < sizeY; j++) { - for (int k = 0; k < sizeZ; k++) { - chunk.setBlockState( - new BlockPos(startX + x * 4 + i, 2 + 6 * y + j, startZ + z * 4 + k), - Blocks.AIR.getDefaultState(), - false); + // Create an unique random Object for the current floor. + final Random fullFloorRandom = new Random(BackroomsLevels.LEVEL_0_WORLD.getSeed() + + BlockPos.asLong(chunk.getPos().getStartX(), chunk.getPos().getStartZ(), y)); + // Check whether a random number between zero and one is less than the number + // with an F directly after it. Currently, for debugging reasons, a "|| true" + // has been placed, which means that the following code will be excecuted + // anyways. + // Place a large (7x7 or bigger) room in the current chunk at the current floor. + // Both dimensions of the base of the room must be of the form 4x-1. + if (fullFloorRandom.nextFloat() < 0.1F || true) { + // Define the amounts of regular and nofill rooms. + final int regularRooms = 14; + final int nofillRooms = 4; + // Choose the room that will be placed. + int roomNumber = (fullFloorRandom.nextInt(regularRooms + nofillRooms) + 1); + // The number with an F directly after it denotes the probability of an empty + // room being generated regardless. + if (fullFloorRandom.nextFloat() < 0.6F) { + roomNumber = 0; + } + String roomName = "backrooms_large_" + roomNumber; + if (roomNumber > regularRooms) { + roomName = "backrooms_large_nofill_" + (roomNumber - regularRooms); + } + // Choose the rotation for the room. + Direction dir = Direction.fromHorizontal(fullFloorRandom.nextInt(4)); + BlockRotation rotation = switch (dir) { + case NORTH -> BlockRotation.COUNTERCLOCKWISE_90; + case EAST -> BlockRotation.NONE; + case SOUTH -> BlockRotation.CLOCKWISE_90; + default -> BlockRotation.CLOCKWISE_180; + }; + + // Calculate size of current room + final var currentRoom = this.loadedStructures.get(roomName); + + int sizeY = currentRoom.sizeY, sizeX, sizeZ; + final boolean isEastOrWestDirection = dir.equals(Direction.EAST) || dir.equals(Direction.WEST); + if (isEastOrWestDirection) { + sizeX = currentRoom.sizeX; + sizeZ = currentRoom.sizeZ; + } else { + sizeX = currentRoom.sizeZ; + sizeZ = currentRoom.sizeX; + } + // Place a structure only if it fits before the bedrock + if (6 * y + sizeY < ROOF_BEGIN_Y) { + // Choose a spot in the chunk. + final int x = fullFloorRandom.nextInt(5 - (sizeX + 1) / 4); + final int z = fullFloorRandom.nextInt(5 - (sizeZ + 1) / 4); + // Fill the area the room will be placed in with air. + if (roomNumber <= regularRooms) { + for (int i = 0; i < sizeX; i++) { + for (int j = 0; j < sizeY; j++) { + for (int k = 0; k < sizeZ; k++) { + chunk.setBlockState( + new BlockPos(startX + x * 4 + i, 2 + 6 * y + j, startZ + z * 4 + k), + Blocks.AIR.getDefaultState(), + false); + } } } } + generateNbt(chunk, new BlockPos(startX + x * 4, 2 + 6 * y, startZ + z * 4), roomName, rotation); // Actually + // generate + // the + // room. } - generateNbt(chunk, new BlockPos(startX + x * 4, 2 + 6 * y, startZ + z * 4), roomName, rotation); //Actually generate the room. } } - } - //Mold placement code; will be subject to heavy revisions, so ignore for now. - for (int y = getFloorCount(); y >= 0; y--) { - final Random fullFloorRandom = new Random(BackroomsLevels.LEVEL_0_WORLD.getSeed() - + MathHelper.hashCode(chunk.getPos().getStartX(), chunk.getPos().getStartZ(), y)); - - for(int i = 0 ; i < 300; i++){ - final int x = fullFloorRandom.nextInt(16); - final int z = fullFloorRandom.nextInt(16); - int x2 = x + fullFloorRandom.nextInt(3) - 1; - int z2 = fullFloorRandom.nextInt(3) - 1; - if(chunk.getBlockState(new BlockPos(startX + x, 1 + 6 * y, startZ + z)) - == BackroomsBlocks.WOOLEN_CARPET.getDefaultState()){ - if(x2 < 0) x2=0; - else if(x2 > 15) x2=15; - if(z2 < 0) z2=0; - else if(z2 > 15) z2=15; - if(fullFloorRandom.nextFloat() < 0.1F || chunk.getBlockState(new BlockPos(startX + x2, 1 + 6 * y, startZ + z2)) == BackroomsBlocks.CORK_TILE.getDefaultState()) { - chunk.setBlockState( - new BlockPos(startX + x, 1 + 6 * y, startZ + z), - BackroomsBlocks.MOLDY_WOOLEN_CARPET.getDefaultState(), - false); + // Mold placement code; will be subject to heavy revisions, so ignore for now. + for (int y = getFloorCount(); y >= 0; y--) { + final Random fullFloorRandom = new Random(BackroomsLevels.LEVEL_0_WORLD.getSeed() + + BlockPos.asLong(chunk.getPos().getStartX(), chunk.getPos().getStartZ(), y)); + + for (int i = 0; i < 300; i++) { + final int x = fullFloorRandom.nextInt(16); + final int z = fullFloorRandom.nextInt(16); + int x2 = x + fullFloorRandom.nextInt(3) - 1; + int z2 = fullFloorRandom.nextInt(3) - 1; + if (chunk.getBlockState(new BlockPos(startX + x, 1 + 6 * y, + startZ + z)) == BackroomsBlocks.WOOLEN_CARPET.getDefaultState()) { + if (x2 < 0) + x2 = 0; + else if (x2 > 15) + x2 = 15; + if (z2 < 0) + z2 = 0; + else if (z2 > 15) + z2 = 15; + if (fullFloorRandom.nextFloat() < 0.1F || chunk.getBlockState(new BlockPos(startX + x2, + 1 + 6 * y, startZ + z2)) == BackroomsBlocks.CORK_TILE.getDefaultState()) { + chunk.setBlockState( + new BlockPos(startX + x, 1 + 6 * y, startZ + z), + BackroomsBlocks.MOLDY_WOOLEN_CARPET.getDefaultState(), + false); + } } } } - } - // Place bedrock bricks at the bottom. - for (int x = startX; x < startX + 16; x++) { - for (int z = startZ; z < startZ + 16; z++) { - chunk.setBlockState(new BlockPos(x, 0, z), ROOF_BLOCK, false); + // Place bedrock bricks at the bottom. + for (int x = startX; x < startX + 16; x++) { + for (int z = startZ; z < startZ + 16; z++) { + chunk.setBlockState(new BlockPos(x, 0, z), ROOF_BLOCK, false); + } } - } - - return CompletableFuture.completedFuture(chunk); + return CompletableFuture.completedFuture(chunk); + + } } - } - @Override - public int getSeaLevel() { - return 0; - } + @Override + public int getSeaLevel() { + return 0; + } - @Override - public int getMinimumY() { - return 0; - } + @Override + public int getMinimumY() { + return 0; + } - @Override - public int getHeight(int x, int z, Heightmap.Type heightmapType, HeightLimitView heightLimitView) { - return 128; - } + @Override + public int getHeight(int x, int z, Type heightmap, HeightLimitView world, NoiseConfig noiseConfig) { + return 128; + } - @Override - public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView heightLimitView) { - return new VerticalBlockSample(0, new BlockState[0]); - } + @Override + public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world, NoiseConfig noiseConfig) { + return new VerticalBlockSample(0, new BlockState[0]); + } - @Override - public void getDebugHudText(List list, BlockPos blockPos) { - } + @Override + public void getDebugHudText(List text, NoiseConfig noiseConfig, BlockPos pos) { + } public static int getFloorCount() { return 5; } - public void storeStructures(ServerWorld world) { - store("backrooms_large", world, 0, 14); //Makes it so the large regular rooms can be used while generating. - store("backrooms_large_nofill", world, 1, 4); //Makes it so the large nofill rooms can be used while generating. + store("backrooms_large", world, 0, 14); // Makes it so the large regular rooms can be used while generating. + store("backrooms_large_nofill", world, 1, 4); // Makes it so the large nofill rooms can be used while + // generating. } private void store(String id, ServerWorld world) { - loadedStructures.put(id, NbtPlacerUtil.load(world.getServer().getResourceManager(), new Identifier(this.nbtId.getNamespace(), "nbt/" + this.nbtId.getPath() + "/" + id + ".nbt")).get()); - } + loadedStructures.put(id, + NbtPlacerUtil.load(world.getServer().getResourceManager(), + new Identifier(this.nbtId.getNamespace(), "nbt/" + this.nbtId.getPath() + "/" + id + ".nbt"), + this.blockLookup).get()); + } - private void store(String id, ServerWorld world, int from, int to) { - for (int i = from; i <= to; i++) { - store(id + "_" + i, world); - } - } + private void store(String id, ServerWorld world, int from, int to) { + for (int i = from; i <= to; i++) { + store(id + "_" + i, world); + } + } - private void generateNbt(Chunk region, BlockPos at, String id, BlockRotation rotation) { - loadedStructures.get(id).rotate(rotation).generateNbt(region, at, (pos, state, nbt) -> this.modifyStructure(region, pos, state, nbt)); - } + private void generateNbt(Chunk region, BlockPos at, String id, BlockRotation rotation) { + loadedStructures.get(id).rotate(rotation, blockLookup).generateNbt(region, at, + (pos, state, nbt) -> this.modifyStructure(region, pos, state, nbt)); + } private void modifyStructure(Chunk region, BlockPos pos, BlockState state, NbtCompound nbt) { - if (!state.isAir()) { - if (state.isOf(Blocks.BARRIER)) { - region.setBlockState(pos, Blocks.AIR.getDefaultState(), true); - } else { - region.setBlockState(pos, state, true); + if (!state.isAir()) { + if (state.isOf(Blocks.BARRIER)) { + region.setBlockState(pos, Blocks.AIR.getDefaultState(), true); + } else { + region.setBlockState(pos, state, true); if (state.isOf(Blocks.BARREL)) { BarrelBlockEntity barrelBlockEntity = new BarrelBlockEntity(pos, state); region.setBlockEntity(barrelBlockEntity); - barrelBlockEntity.setLootTable(this.getBarrelLootTable(), BackroomsLevels.LEVEL_0_WORLD.getSeed() + MathHelper.hashCode(pos)); + barrelBlockEntity.setLootTable(this.getBarrelLootTable(), + BackroomsLevels.LEVEL_0_WORLD.getSeed() + pos.hashCode()); } else if (state.isOf(BackroomsBlocks.CRATE)) { CrateBlockEntity crateBlockEntity = new CrateBlockEntity(pos, state); region.setBlockEntity(crateBlockEntity); - crateBlockEntity.setLootTable(this.getBarrelLootTable(), BackroomsLevels.LEVEL_0_WORLD.getSeed() + MathHelper.hashCode(pos)); + crateBlockEntity.setLootTable(this.getBarrelLootTable(), + BackroomsLevels.LEVEL_0_WORLD.getSeed() + pos.hashCode()); } - } - } - } + } + } + } protected Identifier getBarrelLootTable() { return BackroomsLootTables.CRATE; diff --git a/src/main/java/com/kpabr/backrooms/world/chunk/level1chunkgenerators/CementHallsChunkGenerator.java b/src/main/java/com/kpabr/backrooms/world/chunk/level1chunkgenerators/CementHallsChunkGenerator.java index cadb8fc..bc2b1a0 100644 --- a/src/main/java/com/kpabr/backrooms/world/chunk/level1chunkgenerators/CementHallsChunkGenerator.java +++ b/src/main/java/com/kpabr/backrooms/world/chunk/level1chunkgenerators/CementHallsChunkGenerator.java @@ -1,6 +1,5 @@ package com.kpabr.backrooms.world.chunk.level1chunkgenerators; - import com.kpabr.backrooms.BackroomsMod; import com.kpabr.backrooms.init.BackroomsBlocks; import com.kpabr.backrooms.init.BackroomsLevels; @@ -8,7 +7,6 @@ import com.kpabr.backrooms.util.NbtPlacerUtil; import com.kpabr.backrooms.world.chunk.LevelOneChunkGenerator; import com.mojang.serialization.Codec; -import com.mojang.serialization.Lifecycle; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -21,78 +19,80 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.SimpleRegistry; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryOps; import net.minecraft.world.ChunkRegion; import net.minecraft.world.HeightLimitView; -import net.minecraft.world.Heightmap; +import net.minecraft.world.Heightmap.Type; import net.minecraft.world.biome.source.BiomeAccess; import net.minecraft.world.biome.source.BiomeSource; -import net.minecraft.world.biome.source.util.MultiNoiseUtil.MultiNoiseSampler; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.gen.GenerationStep.Carver; import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.chunk.Blender; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.VerticalBlockSample; +import net.minecraft.world.gen.noise.NoiseConfig; import java.util.HashMap; import java.util.List; -import java.util.Optional; import java.util.Random; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; public class CementHallsChunkGenerator extends ChunkGenerator { - public static final Codec CODEC = RecordCodecBuilder.create((instance) -> - instance.group( - BiomeSource.CODEC.fieldOf("biome_source") - .stable() - .forGetter((chunkGenerator) -> chunkGenerator.biomeSource), - Codec.LONG.fieldOf("seed") - .stable() - .forGetter((chunkGenerator) -> chunkGenerator.worldSeed) - ).apply(instance, instance.stable(CementHallsChunkGenerator::new)) - ); - + public static final Codec CODEC = RecordCodecBuilder.create((instance) -> instance.group( + BiomeSource.CODEC.fieldOf("biome_source") + .stable() + .forGetter((chunkGenerator) -> chunkGenerator.biomeSource), + Codec.LONG.fieldOf("seed") + .stable() + .forGetter((chunkGenerator) -> chunkGenerator.worldSeed), + RegistryOps.getEntryLookupCodec(RegistryKeys.BLOCK)) + .apply(instance, instance.stable(CementHallsChunkGenerator::new))); private final long worldSeed; private static final int ROOF_BEGIN_Y = 8 * (LevelOneChunkGenerator.getFloorCount() + 1) + 1; private final HashMap loadedStructures = new HashMap(30); private Identifier nbtId = BackroomsMod.id("level_1"); - - public CementHallsChunkGenerator(BiomeSource biomeSource, long worldSeed) { - super(new SimpleRegistry<>(Registry.STRUCTURE_SET_KEY, Lifecycle.stable(), null), Optional.empty(), biomeSource, biomeSource, worldSeed); + + private RegistryEntryLookup blockLookup; + + public CementHallsChunkGenerator(BiomeSource biomeSource, long worldSeed, RegistryEntryLookup blockLookup) { + super(biomeSource); this.worldSeed = worldSeed; + + this.blockLookup = blockLookup; } @Override protected Codec getCodec() { return CODEC; } - @Override - public ChunkGenerator withSeed(long seed) { - return new CementHallsChunkGenerator(this.biomeSource, seed); - } @Override - public CompletableFuture populateNoise(Executor executor, Blender blender, StructureAccessor structureAccessor, Chunk chunk) { + public CompletableFuture populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig, + StructureAccessor structureAccessor, Chunk chunk) { // IMPORTANT NOTE: - // For biomes generation we're using various "placeholder" blocks to replace them later with blocks we actually need in biomes. - // If you're adding new type of structure then don't use blocks other than described below from our mod! + // For biomes generation we're using various "placeholder" blocks to replace + // them later with blocks we actually need in biomes. + // If you're adding new type of structure then don't use blocks other than + // described below from our mod! // Instead, use those blocks: // BackroomsBlocks.PATTERNED_WALLPAPER -> any wallpaper // BackroomsBlocks.WOOLEN_CARPET -> any carpet // BackroomsBlocks.CORK_TILE -> any cork tile // BackroomsBlocks.FLUORESCENT_LIGHT -> any light source - // BackroomsBlocks.MOLDY_WOOLEN_CARPET -> random blocks(you can just replace them with carpet) + // BackroomsBlocks.MOLDY_WOOLEN_CARPET -> random blocks(you can just replace + // them with carpet) final ChunkPos chunkPos = chunk.getPos(); - // Save the starting x and z position of the chunk. Note: positive x means east, positive z means south. + // Save the starting x and z position of the chunk. Note: positive x means east, + // positive z means south. final int startX = chunkPos.getStartX(); final int startZ = chunkPos.getStartZ(); @@ -104,20 +104,26 @@ public CompletableFuture populateNoise(Executor executor, Blender blender final int floorCount = LevelOneChunkGenerator.getFloorCount(); for (int y = floorCount; y >= 0; y--) { - // Create 16 smaller sections of the floor, layed out in a 4x4 pattern. Each section will consist of the carpeting, the ceiling, two walls (located on the eastern and southern side of the section) and a pillar, located in the southeasternmost space. + // Create 16 smaller sections of the floor, layed out in a 4x4 pattern. Each + // section will consist of the carpeting, the ceiling, two walls (located on the + // eastern and southern side of the section) and a pillar, located in the + // southeasternmost space. for (int x = 3; x >= 0; x--) { for (int z = 3; z >= 0; z--) { // Make a Random object controlling the generation of the section. - final Random random = new Random(this.worldSeed + MathHelper.hashCode(startX, startZ, x + 4 * z + 20 * y)); - // Decide the arrangement of the walls of the section. The two numbers with an F directly after them denote the probability of an eastern wall and a southern wall generating, respectively. + final Random random = new Random( + this.worldSeed + BlockPos.asLong(startX, startZ, x + 4 * z + 20 * y)); + // Decide the arrangement of the walls of the section. The two numbers with an F + // directly after them denote the probability of an eastern wall and a southern + // wall generating, respectively. final int wallType = (random.nextFloat() < 0.4F ? 1 : 0) + (random.nextFloat() < 0.4F ? 2 : 0); // Check if the arrangement includes the eastern wall // and create the eastern wall if true. if ((wallType & 1) == 1) { for (int i = 0; i < 3; i++) { - for(int j = 0; j < 5; j++){ + for (int j = 0; j < 5; j++) { chunk.setBlockState( - new BlockPos(startX + x * 4 + 3 , 3 + 8 * y + j, startZ + z * 4 + i), + new BlockPos(startX + x * 4 + 3, 3 + 8 * y + j, startZ + z * 4 + i), BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), false); } @@ -129,12 +135,14 @@ public CompletableFuture populateNoise(Executor executor, Blender blender } // Check if the arrangement includes the southern wall // and create the southern wall if true. - if((wallType & 2) == 2) { - for(int i = 0; i < 3; i++){ - for(int j = 0; j < 5; j++){ - chunk.setBlockState(new BlockPos(startX + x * 4 + i, 3 + 8 * y + j, startZ + z * 4 + 3), BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), false); + if ((wallType & 2) == 2) { + for (int i = 0; i < 3; i++) { + for (int j = 0; j < 5; j++) { + chunk.setBlockState(new BlockPos(startX + x * 4 + i, 3 + 8 * y + j, startZ + z * 4 + 3), + BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), false); } - chunk.setBlockState(new BlockPos(startX + x * 4 + i, 2 + 8 * y, startZ + z * 4 + 3), BackroomsBlocks.CEMENT_BRICKS.getDefaultState(), false); + chunk.setBlockState(new BlockPos(startX + x * 4 + i, 2 + 8 * y, startZ + z * 4 + 3), + BackroomsBlocks.CEMENT_BRICKS.getDefaultState(), false); } } // Boolean variable controlling whether a pillar in generated. Initially false. @@ -143,24 +151,30 @@ public CompletableFuture populateNoise(Executor executor, Blender blender // Check if you're not on the eastern edge of the chunk. If you aren't, proceed. if (x != 3) { - // Check one block east whether there's a wall there. If so, a pillar will always be generated. - pillar = pillar || !chunk.getBlockState(new BlockPos(startX + x * 4 + 4, 2 + 8 * y, startZ + z * 4 + 3)).isAir(); + // Check one block east whether there's a wall there. If so, a pillar will + // always be generated. + pillar = pillar || !chunk + .getBlockState(new BlockPos(startX + x * 4 + 4, 2 + 8 * y, startZ + z * 4 + 3)).isAir(); } - // Check if you're not on the southern edge of the chunk. If you aren't, proceed. + // Check if you're not on the southern edge of the chunk. If you aren't, + // proceed. if (z != 3) { - // Check one block south whether there's a wall there. If so, a pillar will always be generated. - pillar = pillar || !chunk.getBlockState(new BlockPos(startX + x * 4 + 3, 2 + 8 * y, startZ + z * 4 + 4)).isAir(); + // Check one block south whether there's a wall there. If so, a pillar will + // always be generated. + pillar = pillar || !chunk + .getBlockState(new BlockPos(startX + x * 4 + 3, 2 + 8 * y, startZ + z * 4 + 4)).isAir(); } // If you're on the southeasternmost spot on the chunk, always make a pillar. pillar = pillar || (x == 3 && z == 3); - // Sometimes generate a pillar anyways, even if none of the previous conditions were met. + // Sometimes generate a pillar anyways, even if none of the previous conditions + // were met. pillar = pillar || (random.nextFloat() < 0.2F); - //Create the pillar. + // Create the pillar. if (pillar) { - for (int j = 0; j < 6; j++){ + for (int j = 0; j < 6; j++) { chunk.setBlockState( new BlockPos(startX + x * 4 + 3, 2 + 8 * y + j, startZ + z * 4 + 3), BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), @@ -172,13 +186,13 @@ public CompletableFuture populateNoise(Executor executor, Blender blender false); } // Generate the carpeting and the ceiling. - for(int i = 0; i < 4; i++){ - for(int j = 0; j < 4; j++){ + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { chunk.setBlockState( new BlockPos(startX + x * 4 + i, 1 + 8 * y, startZ + z * 4 + j), BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), false); - for(int k = 0; k < 4; k++) { + for (int k = 0; k < 4; k++) { chunk.setBlockState( new BlockPos(startX + x * 4 + i, 5 + 8 * y + k, startZ + z * 4 + j), BackroomsBlocks.CORK_TILE.getDefaultState(), @@ -186,7 +200,7 @@ public CompletableFuture populateNoise(Executor executor, Blender blender } } } - //Place a ceiling light at the correct height. + // Place a ceiling light at the correct height. chunk.setBlockState( new BlockPos(startX + x * 4 + 1, 5 + 8 * y, startZ + z * 4 + 1), BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), @@ -194,28 +208,32 @@ public CompletableFuture populateNoise(Executor executor, Blender blender } } - //Create an unique random Object for the current floor. - final Random fullFloorRandom = new Random(worldSeed + MathHelper.hashCode(startX, startZ, y)); + // Create an unique random Object for the current floor. + final Random fullFloorRandom = new Random(worldSeed + BlockPos.asLong(startX, startZ, y)); - //Check whether a random number between zero and one is less than the number with an F directly after it. Currently, for debugging reasons, a "|| true" has been placed, which means that the following code will be excecuted anyways. - //Place a large (7x7 or bigger) room in the current chunk at the current floor. Both dimensions of the base of the room must be of the form 4x-1. + // Check whether a random number between zero and one is less than the number + // with an F directly after it. Currently, for debugging reasons, a "|| true" + // has been placed, which means that the following code will be excecuted + // anyways. + // Place a large (7x7 or bigger) room in the current chunk at the current floor. + // Both dimensions of the base of the room must be of the form 4x-1. if (fullFloorRandom.nextFloat() < 0.2F) { - //Define the amounts of regular and nofill rooms. + // Define the amounts of regular and nofill rooms. final int regularRooms = 1; final int noFillRooms = 3; final int ponds = 8; - //Choose the room that will be placed. + // Choose the room that will be placed. int roomNumber = (fullFloorRandom.nextInt(regularRooms + noFillRooms)); String roomName = "cement_walls_" + roomNumber; - if(roomNumber >= regularRooms) { + if (roomNumber >= regularRooms) { roomName = "cement_walls_nofill_" + (roomNumber - regularRooms); } - if(roomNumber - regularRooms == 1) { + if (roomNumber - regularRooms == 1) { roomName = "cement_pond_" + fullFloorRandom.nextInt(ponds); } - //Choose the rotation for the room. + // Choose the rotation for the room. final Direction dir = Direction.fromHorizontal(fullFloorRandom.nextInt(4)); - BlockRotation rotation = switch(dir) { + BlockRotation rotation = switch (dir) { case NORTH -> BlockRotation.COUNTERCLOCKWISE_90; case EAST -> BlockRotation.NONE; case SOUTH -> BlockRotation.CLOCKWISE_90; @@ -227,7 +245,7 @@ public CompletableFuture populateNoise(Executor executor, Blender blender final boolean isEastOrWestDirection = dir.equals(Direction.EAST) || dir.equals(Direction.WEST); int sizeY = currentRoom.sizeY, sizeX, sizeZ; - if(isEastOrWestDirection) { + if (isEastOrWestDirection) { sizeX = currentRoom.sizeX; sizeZ = currentRoom.sizeZ; } else { @@ -236,12 +254,12 @@ public CompletableFuture populateNoise(Executor executor, Blender blender } // Only generate the structure if it has enough vertical space to generate. - if(8 * y + sizeY < ROOF_BEGIN_Y) { + if (8 * y + sizeY < ROOF_BEGIN_Y) { // Choose a spot in the chunk. final int x = fullFloorRandom.nextInt(5 - (sizeX + 1) / 4); final int z = fullFloorRandom.nextInt(5 - (sizeZ + 1) / 4); // Fill the area the room will be placed in with air. - if(roomNumber < regularRooms) { + if (roomNumber < regularRooms) { for (int i = 0; i < sizeX; i++) { for (int j = 0; j < sizeY; j++) { for (int k = 0; k < sizeZ; k++) { @@ -262,8 +280,8 @@ public CompletableFuture populateNoise(Executor executor, Blender blender } public void storeStructures(ServerWorld world) { - store("cement_walls", world, 0, 0); //Makes it so the large regular rooms can be used while generating. - store("cement_walls_nofill", world, 0, 2); //Makes it so the large nofill rooms can be used while generating.*/ + store("cement_walls", world, 0, 0); // Makes it so the large regular rooms can be used while generating. + store("cement_walls_nofill", world, 0, 2); // Makes it so the large nofill rooms can be used while generating.*/ store("cement_pond", world, 0, 7); } @@ -273,7 +291,7 @@ public int getWorldHeight() { } @Override - public int getHeight(int x, int y, Heightmap.Type type, HeightLimitView world) { + public int getHeight(int x, int z, Type heightmap, HeightLimitView world, NoiseConfig noiseConfig) { return world.getTopY(); } @@ -282,8 +300,8 @@ private void replace(Block block, Chunk chunk, BlockPos pos) { } @Override - public void buildSurface(ChunkRegion region, StructureAccessor structureAccessor, Chunk chunk) { - final ChunkPos chunkPos = chunk.getPos(); + public void buildSurface(ChunkRegion region, StructureAccessor structures, NoiseConfig noiseConfig, Chunk chunk) { + final ChunkPos chunkPos = chunk.getPos(); // controls every block up to the roof for (int x = 0; x < 16; x++) { @@ -306,68 +324,68 @@ public void buildSurface(ChunkRegion region, StructureAccessor structureAccessor } } - - private void store(String id, ServerWorld world) { - loadedStructures.put(id, NbtPlacerUtil.load(world.getServer().getResourceManager(), new Identifier(this.nbtId.getNamespace(), "nbt/" + this.nbtId.getPath() + "/" + id + ".nbt")).get()); - } + loadedStructures.put(id, + NbtPlacerUtil.load(world.getServer().getResourceManager(), + new Identifier(this.nbtId.getNamespace(), "nbt/" + this.nbtId.getPath() + "/" + id + ".nbt"), + this.blockLookup).get()); + } - private void store(String id, ServerWorld world, int from, int to) { - for (int i = from; i <= to; i++) { - store(id + "_" + i, world); - } - } + private void store(String id, ServerWorld world, int from, int to) { + for (int i = from; i <= to; i++) { + store(id + "_" + i, world); + } + } - private void generateNbt(Chunk region, BlockPos at, String id, BlockRotation rotation) { - loadedStructures.get(id).rotate(rotation).generateNbt(region, at, (pos, state, nbt) -> this.modifyStructure(region, pos, state, nbt)); - } + private void generateNbt(Chunk region, BlockPos at, String id, BlockRotation rotation) { + loadedStructures.get(id).rotate(rotation, this.blockLookup).generateNbt(region, at, + (pos, state, nbt) -> this.modifyStructure(region, pos, state, nbt)); + } private void modifyStructure(Chunk region, BlockPos pos, BlockState state, NbtCompound nbt) { - if (!state.isAir()) { - if (state.isOf(Blocks.BARRIER)) { - region.setBlockState(pos, Blocks.AIR.getDefaultState(), true); - } else { - region.setBlockState(pos, state, true); + if (!state.isAir()) { + if (state.isOf(Blocks.BARRIER)) { + region.setBlockState(pos, Blocks.AIR.getDefaultState(), true); + } else { + region.setBlockState(pos, state, true); if (state.isOf(Blocks.BARREL)) { BarrelBlockEntity barrelBlockEntity = new BarrelBlockEntity(pos, state); region.setBlockEntity(barrelBlockEntity); - barrelBlockEntity.setLootTable(this.getBarrelLootTable(), worldSeed + MathHelper.hashCode(pos)); + barrelBlockEntity.setLootTable(this.getBarrelLootTable(), worldSeed + pos.hashCode()); } - } - } - } + } + } + } protected Identifier getBarrelLootTable() { return BackroomsLootTables.CRATE; } @Override - public void carve(ChunkRegion chunkRegion, long seed, BiomeAccess biomeAccess, StructureAccessor structureAccessor, - Chunk chunk, Carver generationStep) {} + public void carve(ChunkRegion chunkRegion, long seed, NoiseConfig noiseConfig, BiomeAccess world, + StructureAccessor structureAccessor, Chunk chunk, Carver carverStep) { + } @Override - public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world) { + public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world, NoiseConfig noiseConfig) { return new VerticalBlockSample(0, new BlockState[0]); } @Override - public void getDebugHudText(List text, BlockPos pos) {} + public void getDebugHudText(List text, NoiseConfig noiseConfig, BlockPos pos) { + } @Override public int getMinimumY() { return 0; } - @Override - public MultiNoiseSampler getMultiNoiseSampler() { - return null; - } - @Override public int getSeaLevel() { return 0; } @Override - public void populateEntities(ChunkRegion region) {} + public void populateEntities(ChunkRegion region) { + } } diff --git a/src/main/java/com/kpabr/backrooms/world/chunk/level1chunkgenerators/ParkingGarageChunkGenerator.java b/src/main/java/com/kpabr/backrooms/world/chunk/level1chunkgenerators/ParkingGarageChunkGenerator.java index 09ef8a3..ccb4d8a 100644 --- a/src/main/java/com/kpabr/backrooms/world/chunk/level1chunkgenerators/ParkingGarageChunkGenerator.java +++ b/src/main/java/com/kpabr/backrooms/world/chunk/level1chunkgenerators/ParkingGarageChunkGenerator.java @@ -1,13 +1,11 @@ package com.kpabr.backrooms.world.chunk.level1chunkgenerators; - import com.kpabr.backrooms.BackroomsMod; import com.kpabr.backrooms.init.BackroomsBlocks; import com.kpabr.backrooms.init.BackroomsLevels; import com.kpabr.backrooms.util.NbtPlacerUtil; import com.kpabr.backrooms.world.chunk.LevelOneChunkGenerator; import com.mojang.serialization.Codec; -import com.mojang.serialization.Lifecycle; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.block.Block; @@ -20,76 +18,78 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.SimpleRegistry; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryOps; import net.minecraft.world.ChunkRegion; import net.minecraft.world.HeightLimitView; -import net.minecraft.world.Heightmap; +import net.minecraft.world.Heightmap.Type; import net.minecraft.world.biome.source.BiomeAccess; import net.minecraft.world.biome.source.BiomeSource; -import net.minecraft.world.biome.source.util.MultiNoiseUtil.MultiNoiseSampler; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.gen.GenerationStep.Carver; import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.chunk.Blender; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.VerticalBlockSample; +import net.minecraft.world.gen.noise.NoiseConfig; import java.util.HashMap; import java.util.List; -import java.util.Optional; import java.util.Random; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; public class ParkingGarageChunkGenerator extends ChunkGenerator { - public static final Codec CODEC = RecordCodecBuilder.create((instance) -> - instance.group( + public static final Codec CODEC = RecordCodecBuilder.create((instance) -> instance + .group( BiomeSource.CODEC.fieldOf("biome_source") .stable() .forGetter((chunkGenerator) -> chunkGenerator.biomeSource), Codec.LONG.fieldOf("seed") .stable() - .forGetter((chunkGenerator) -> chunkGenerator.worldSeed) - ).apply(instance, instance.stable(ParkingGarageChunkGenerator::new)) - ); + .forGetter((chunkGenerator) -> chunkGenerator.worldSeed), + RegistryOps.getEntryLookupCodec(RegistryKeys.BLOCK)) + .apply(instance, instance.stable(ParkingGarageChunkGenerator::new))); private final long worldSeed; private static final int ROOF_BEGIN_Y = 8 * (LevelOneChunkGenerator.getFloorCount() + 1) + 1; private final HashMap loadedStructures = new HashMap(30); private Identifier nbtId = BackroomsMod.id("level_1"); - - - public ParkingGarageChunkGenerator(BiomeSource biomeSource, long worldSeed) { - super(new SimpleRegistry<>(Registry.STRUCTURE_SET_KEY, Lifecycle.stable(), null), Optional.empty(), biomeSource, biomeSource, worldSeed); + private RegistryEntryLookup blockLookup; + + public ParkingGarageChunkGenerator(BiomeSource biomeSource, long worldSeed, + RegistryEntryLookup blockLookup) { + super(biomeSource); this.worldSeed = worldSeed; + this.blockLookup = blockLookup; } @Override protected Codec getCodec() { return CODEC; } - @Override - public ChunkGenerator withSeed(long seed) { - return new ParkingGarageChunkGenerator(this.biomeSource, seed); - } @Override - public CompletableFuture populateNoise(Executor executor, Blender blender, StructureAccessor structureAccessor, Chunk chunk) { + public CompletableFuture populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig, + StructureAccessor structureAccessor, Chunk chunk) { // IMPORTANT NOTE: - // For biomes generation we're using various "placeholder" blocks to replace them later with blocks we actually need in biomes. - // If you're adding new type of structure then don't use blocks other than described below from our mod! + // For biomes generation we're using various "placeholder" blocks to replace + // them later with blocks we actually need in biomes. + // If you're adding new type of structure then don't use blocks other than + // described below from our mod! // Instead, use those blocks: // BackroomsBlocks.PATTERNED_WALLPAPER -> any wallpaper // BackroomsBlocks.WOOLEN_CARPET -> any carpet // BackroomsBlocks.CORK_TILE -> any cork tile // BackroomsBlocks.FLUORESCENT_LIGHT -> any light source - // BackroomsBlocks.MOLDY_WOOLEN_CARPET -> random blocks(you can just replace them with carpet) + // BackroomsBlocks.MOLDY_WOOLEN_CARPET -> random blocks(you can just replace + // them with carpet) final ChunkPos chunkPos = chunk.getPos(); - // Save the starting x and z position of the chunk. Note: positive x means east, positive z means south. + // Save the starting x and z position of the chunk. Note: positive x means east, + // positive z means south. final int startX = chunkPos.getStartX(); final int startZ = chunkPos.getStartZ(); @@ -100,47 +100,60 @@ public CompletableFuture populateNoise(Executor executor, Blender blender // Create 5 floors, top to bottom. final int floorCount = LevelOneChunkGenerator.getFloorCount(); for (int y = floorCount; y >= 0; y--) { - //Create 16 smaller sections of the floor, layed out in a 4x4 pattern. Each section will consist of the carpeting, the ceiling, two walls (located on the eastern and southern side of the section) and a pillar, located in the southeasternmost space. + // Create 16 smaller sections of the floor, layed out in a 4x4 pattern. Each + // section will consist of the carpeting, the ceiling, two walls (located on the + // eastern and southern side of the section) and a pillar, located in the + // southeasternmost space. for (int x = 3; x >= 0; x--) { for (int z = 3; z >= 0; z--) { - if((x & 1) == 1){ - //Create a pillar. - chunk.setBlockState(new BlockPos(startX + x * 4 + 3, 2 + 8 * y, startZ + z * 4 + 3), BackroomsBlocks.PARKING_CEMENT_PILLAR.getDefaultState(), false); - chunk.setBlockState(new BlockPos(startX + x * 4 + 3, 3 + 8 * y, startZ + z * 4 + 3), BackroomsBlocks.PARKING_CEMENT_PILLAR.getDefaultState(), false); - chunk.setBlockState(new BlockPos(startX + x * 4 + 3, 4 + 8 * y, startZ + z * 4 + 3), BackroomsBlocks.CEMENT_PILLAR.getDefaultState(), false); - chunk.setBlockState(new BlockPos(startX + x * 4 + 3, 5 + 8 * y, startZ + z * 4 + 3), BackroomsBlocks.CEMENT_PILLAR.getDefaultState(), false); + if ((x & 1) == 1) { + // Create a pillar. + chunk.setBlockState(new BlockPos(startX + x * 4 + 3, 2 + 8 * y, startZ + z * 4 + 3), + BackroomsBlocks.PARKING_CEMENT_PILLAR.getDefaultState(), false); + chunk.setBlockState(new BlockPos(startX + x * 4 + 3, 3 + 8 * y, startZ + z * 4 + 3), + BackroomsBlocks.PARKING_CEMENT_PILLAR.getDefaultState(), false); + chunk.setBlockState(new BlockPos(startX + x * 4 + 3, 4 + 8 * y, startZ + z * 4 + 3), + BackroomsBlocks.CEMENT_PILLAR.getDefaultState(), false); + chunk.setBlockState(new BlockPos(startX + x * 4 + 3, 5 + 8 * y, startZ + z * 4 + 3), + BackroomsBlocks.CEMENT_PILLAR.getDefaultState(), false); } // Generate the carpeting and the ceiling. - for(int i = 0; i < 4; i++){ - for(int j = 0; j < 4; j++){ - chunk.setBlockState(new BlockPos(startX + x * 4 + i, 1 + 8 * y, startZ + z * 4 + j), BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), false); - for(int k = 0; k < 3; k++) { - chunk.setBlockState(new BlockPos(startX + x * 4 + i, 6 + 8 * y + k, startZ + z * 4 + j), BackroomsBlocks.CORK_TILE.getDefaultState(), false); + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { + chunk.setBlockState(new BlockPos(startX + x * 4 + i, 1 + 8 * y, startZ + z * 4 + j), + BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), false); + for (int k = 0; k < 3; k++) { + chunk.setBlockState(new BlockPos(startX + x * 4 + i, 6 + 8 * y + k, startZ + z * 4 + j), + BackroomsBlocks.CORK_TILE.getDefaultState(), false); } } } - //Place a ceiling light at the correct height. - chunk.setBlockState(new BlockPos(startX + x * 4 + 1, 6 + 8 * y, startZ + z * 4 + 1), BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); + // Place a ceiling light at the correct height. + chunk.setBlockState(new BlockPos(startX + x * 4 + 1, 6 + 8 * y, startZ + z * 4 + 1), + BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); } } - //Create an unique Random object for the current floor. - final Random fullFloorRandom = new Random(worldSeed + MathHelper.hashCode(startX, startZ, y)); + // Create an unique Random object for the current floor. + final Random fullFloorRandom = new Random(worldSeed + BlockPos.asLong(startX, startZ, y)); - if(fullFloorRandom.nextFloat() < 0.1F){ //Check whether a random number between zero and one is less than the number with an F directly after it. Currently, for debugging reasons, a "|| true" has been placed, which means that the following code will be excecuted anyways. + if (fullFloorRandom.nextFloat() < 0.1F) { // Check whether a random number between zero and one is less than + // the number with an F directly after it. Currently, for + // debugging reasons, a "|| true" has been placed, which means + // that the following code will be excecuted anyways. final int regularRooms = 1; final int noFillRooms = 0; - //Choose the room that will be placed. + // Choose the room that will be placed. int roomNumber = (fullFloorRandom.nextInt(regularRooms + noFillRooms)); String roomName = "parking_garage_" + roomNumber; - if(roomNumber >= regularRooms) { + if (roomNumber >= regularRooms) { roomName = "parking_garage_nofill_" + (roomNumber - regularRooms); } - //Choose the rotation for the room. + // Choose the rotation for the room. Direction dir = Direction.fromHorizontal(fullFloorRandom.nextInt(4)); - if(roomNumber==0){ - dir = Direction.fromHorizontal(fullFloorRandom.nextInt(2)*2+1); + if (roomNumber == 0) { + dir = Direction.fromHorizontal(fullFloorRandom.nextInt(2) * 2 + 1); } - BlockRotation rotation = switch(dir) { + BlockRotation rotation = switch (dir) { case NORTH -> BlockRotation.COUNTERCLOCKWISE_90; case EAST -> BlockRotation.NONE; case SOUTH -> BlockRotation.CLOCKWISE_90; @@ -152,7 +165,7 @@ public CompletableFuture populateNoise(Executor executor, Blender blender final boolean isEastOrWestDirection = dir.equals(Direction.EAST) || dir.equals(Direction.WEST); int sizeY = currentRoom.sizeY, sizeX, sizeZ; - if(isEastOrWestDirection) { + if (isEastOrWestDirection) { sizeX = currentRoom.sizeX; sizeZ = currentRoom.sizeZ; } else { @@ -162,18 +175,20 @@ public CompletableFuture populateNoise(Executor executor, Blender blender // Only generate the structure if it has enough vertical space to generate. if (8 * y + sizeY < ROOF_BEGIN_Y) { - //Choose a spot in the chunk. + // Choose a spot in the chunk. int x = fullFloorRandom.nextInt(5 - (sizeX + 1) / 4); int z = fullFloorRandom.nextInt(5 - (sizeZ + 1) / 4); - if(roomNumber==0){ - x = fullFloorRandom.nextInt(2)*2; + if (roomNumber == 0) { + x = fullFloorRandom.nextInt(2) * 2; } - //Fill the area the room will be placed in with air. - if(roomNumber <= regularRooms) { + // Fill the area the room will be placed in with air. + if (roomNumber <= regularRooms) { for (int i = 0; i < sizeX; i++) { for (int j = 0; j < sizeY; j++) { for (int k = 0; k < sizeZ; k++) { - chunk.setBlockState(new BlockPos(startX + x * 4 + i, 2 + 8 * y + j, startZ + z * 4 + k), Blocks.AIR.getDefaultState(), false); + chunk.setBlockState( + new BlockPos(startX + x * 4 + i, 2 + 8 * y + j, startZ + z * 4 + k), + Blocks.AIR.getDefaultState(), false); } } } @@ -187,33 +202,38 @@ public CompletableFuture populateNoise(Executor executor, Blender blender } public void storeStructures(ServerWorld world) { - store("parking_garage", world, 0, 0); //Makes it so the large regular rooms can be used while generating. - //store("parking_garage_nofill", world, 0, 0); //Makes it so the large nofill rooms can be used while generating.*/ + store("parking_garage", world, 0, 0); // Makes it so the large regular rooms can be used while generating. + // store("parking_garage_nofill", world, 0, 0); //Makes it so the large nofill + // rooms can be used while generating.*/ } private void store(String id, ServerWorld world) { - loadedStructures.put(id, NbtPlacerUtil.load(world.getServer().getResourceManager(), new Identifier(this.nbtId.getNamespace(), "nbt/" + this.nbtId.getPath() + "/" + id + ".nbt")).get()); - } + loadedStructures.put(id, + NbtPlacerUtil.load(world.getServer().getResourceManager(), + new Identifier(this.nbtId.getNamespace(), "nbt/" + this.nbtId.getPath() + "/" + id + ".nbt"), + this.blockLookup).get()); + } - private void store(String id, ServerWorld world, int from, int to) { - for (int i = from; i <= to; i++) { - store(id + "_" + i, world); - } - } + private void store(String id, ServerWorld world, int from, int to) { + for (int i = from; i <= to; i++) { + store(id + "_" + i, world); + } + } - private void generateNbt(Chunk region, BlockPos at, String id, BlockRotation rotation) { - loadedStructures.get(id).rotate(rotation).generateNbt(region, at, (pos, state, nbt) -> this.modifyStructure(region, pos, state, nbt)); - } + private void generateNbt(Chunk region, BlockPos at, String id, BlockRotation rotation) { + loadedStructures.get(id).rotate(rotation, this.blockLookup).generateNbt(region, at, + (pos, state, nbt) -> this.modifyStructure(region, pos, state, nbt)); + } private void modifyStructure(Chunk region, BlockPos pos, BlockState state, NbtCompound nbt) { - if (!state.isAir()) { - if (state.isOf(Blocks.BARRIER)) { - region.setBlockState(pos, Blocks.AIR.getDefaultState(), true); - } else { - region.setBlockState(pos, state, true); - } - } - } + if (!state.isAir()) { + if (state.isOf(Blocks.BARRIER)) { + region.setBlockState(pos, Blocks.AIR.getDefaultState(), true); + } else { + region.setBlockState(pos, state, true); + } + } + } @Override public int getWorldHeight() { @@ -221,7 +241,7 @@ public int getWorldHeight() { } @Override - public int getHeight(int x, int y, Heightmap.Type type, HeightLimitView world) { + public int getHeight(int x, int z, Type heightmap, HeightLimitView world, NoiseConfig noiseConfig) { return world.getTopY(); } @@ -230,7 +250,7 @@ private void replace(Block block, Chunk chunk, BlockPos pos) { } @Override - public void buildSurface(ChunkRegion region, StructureAccessor structureAccessor, Chunk chunk) { + public void buildSurface(ChunkRegion region, StructureAccessor structures, NoiseConfig noiseConfig, Chunk chunk) { final ChunkPos chunkPos = chunk.getPos(); // controls every block up to the roof @@ -254,33 +274,31 @@ public void buildSurface(ChunkRegion region, StructureAccessor structureAccessor } } - @Override - public void carve(ChunkRegion chunkRegion, long seed, BiomeAccess biomeAccess, StructureAccessor structureAccessor, - Chunk chunk, Carver generationStep) {} + @Override + public void carve(ChunkRegion chunkRegion, long seed, NoiseConfig noiseConfig, BiomeAccess world, + StructureAccessor structureAccessor, Chunk chunk, Carver carverStep) { + } @Override - public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world) { + public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world, NoiseConfig noiseConfig) { return new VerticalBlockSample(0, new BlockState[0]); } @Override - public void getDebugHudText(List text, BlockPos pos) {} + public void getDebugHudText(List text, NoiseConfig noiseConfig, BlockPos pos) { + } @Override public int getMinimumY() { return 0; } - @Override - public MultiNoiseSampler getMultiNoiseSampler() { - return null; - } - @Override public int getSeaLevel() { return 0; } @Override - public void populateEntities(ChunkRegion region) {} + public void populateEntities(ChunkRegion region) { + } } diff --git a/src/main/java/com/kpabr/backrooms/world/chunk/level1chunkgenerators/WarehouseChunkGenerator.java b/src/main/java/com/kpabr/backrooms/world/chunk/level1chunkgenerators/WarehouseChunkGenerator.java index 1862570..5118805 100644 --- a/src/main/java/com/kpabr/backrooms/world/chunk/level1chunkgenerators/WarehouseChunkGenerator.java +++ b/src/main/java/com/kpabr/backrooms/world/chunk/level1chunkgenerators/WarehouseChunkGenerator.java @@ -1,6 +1,5 @@ package com.kpabr.backrooms.world.chunk.level1chunkgenerators; - import com.kpabr.backrooms.BackroomsMod; import com.kpabr.backrooms.init.BackroomsBlocks; import com.kpabr.backrooms.init.BackroomsLevels; @@ -8,7 +7,6 @@ import com.kpabr.backrooms.util.NbtPlacerUtil; import com.kpabr.backrooms.world.chunk.LevelOneChunkGenerator; import com.mojang.serialization.Codec; -import com.mojang.serialization.Lifecycle; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.block.enums.WallMountLocation; import net.minecraft.block.enums.RailShape; @@ -26,7 +24,6 @@ import com.kpabr.backrooms.block.entity.CrateBlockEntity; import net.minecraft.block.WallMountedBlock; -import net.minecraft.block.entity.LootableContainerBlockEntity; import net.minecraft.nbt.NbtCompound; import net.minecraft.server.world.ServerWorld; @@ -35,45 +32,55 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.registry.Registry; -import net.minecraft.util.registry.SimpleRegistry; +import net.minecraft.registry.RegistryEntryLookup; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.RegistryOps; import net.minecraft.world.ChunkRegion; import net.minecraft.world.HeightLimitView; -import net.minecraft.world.Heightmap; +import net.minecraft.world.Heightmap.Type; import net.minecraft.world.biome.source.BiomeAccess; import net.minecraft.world.biome.source.BiomeSource; -import net.minecraft.world.biome.source.util.MultiNoiseUtil.MultiNoiseSampler; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.gen.GenerationStep.Carver; import net.minecraft.world.gen.StructureAccessor; import net.minecraft.world.gen.chunk.Blender; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.VerticalBlockSample; +import net.minecraft.world.gen.noise.NoiseConfig; import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; public class WarehouseChunkGenerator extends ChunkGenerator { - public static final Codec CODEC = RecordCodecBuilder.create((instance) -> - instance.group( - BiomeSource.CODEC.fieldOf("biome_source") - .stable() - .forGetter((chunkGenerator) -> chunkGenerator.biomeSource), - Codec.LONG.fieldOf("seed") - .stable() - .forGetter((chunkGenerator) -> chunkGenerator.worldSeed) - ).apply(instance, instance.stable(WarehouseChunkGenerator::new)) - ); - - private static final Block[] validCandles = new Block[]{Blocks.CANDLE, Blocks.YELLOW_CANDLE, Blocks.RED_CANDLE, Blocks.BLUE_CANDLE, Blocks.BROWN_CANDLE, Blocks.GREEN_CANDLE, Blocks.WHITE_CANDLE}; - private static final Block[] common = new Block[]{Blocks.STONE_BUTTON, Blocks.LEVER, Blocks.FLOWER_POT, Blocks.REDSTONE_TORCH, Blocks.RAIL, Blocks.STONE_PRESSURE_PLATE, Blocks.AIR, Blocks.WHITE_CONCRETE_POWDER, Blocks.BOOKSHELF}; - private static final Block[] uncommon = new Block[]{Blocks.COBWEB, Blocks.CAULDRON, Blocks.TORCH, Blocks.REDSTONE_WIRE, Blocks.CANDLE, Blocks.CRAFTING_TABLE, Blocks.FURNACE, Blocks.REPEATER, Blocks.COMPARATOR, Blocks.LOOM}; - private static final Block[] rare = new Block[]{Blocks.COMPOSTER, Blocks.SKELETON_SKULL, Blocks.ZOMBIE_HEAD, Blocks.BREWING_STAND, Blocks.DAYLIGHT_DETECTOR, Blocks.LANTERN, Blocks.PISTON, Blocks.OBSERVER, Blocks.LIGHTNING_ROD, BackroomsBlocks.FIRESALT_CRYSTAL, BackroomsBlocks.CRATE}; - private static final Block[] validPots = new Block[]{Blocks.POTTED_DANDELION, Blocks.POTTED_POPPY, Blocks.POTTED_BLUE_ORCHID, Blocks.POTTED_SPRUCE_SAPLING, Blocks.POTTED_CACTUS, Blocks.POTTED_RED_MUSHROOM, Blocks.POTTED_AZALEA_BUSH, Blocks.POTTED_BAMBOO}; - private static final Block[] validConcretePowder = new Block[]{Blocks.YELLOW_CONCRETE_POWDER, Blocks.RED_CONCRETE_POWDER, Blocks.BLUE_CONCRETE_POWDER, Blocks.BROWN_CONCRETE_POWDER, Blocks.GREEN_CONCRETE_POWDER, Blocks.WHITE_CONCRETE_POWDER}; - private static final BlockState[] rails = new BlockState[]{ + public static final Codec CODEC = RecordCodecBuilder.create((instance) -> instance.group( + BiomeSource.CODEC.fieldOf("biome_source") + .stable() + .forGetter((chunkGenerator) -> chunkGenerator.biomeSource), + Codec.LONG.fieldOf("seed") + .stable() + .forGetter((chunkGenerator) -> chunkGenerator.worldSeed), + RegistryOps.getEntryLookupCodec(RegistryKeys.BLOCK)) + .apply(instance, instance.stable(WarehouseChunkGenerator::new))); + + private static final Block[] validCandles = new Block[] { Blocks.CANDLE, Blocks.YELLOW_CANDLE, Blocks.RED_CANDLE, + Blocks.BLUE_CANDLE, Blocks.BROWN_CANDLE, Blocks.GREEN_CANDLE, Blocks.WHITE_CANDLE }; + private static final Block[] common = new Block[] { Blocks.STONE_BUTTON, Blocks.LEVER, Blocks.FLOWER_POT, + Blocks.REDSTONE_TORCH, Blocks.RAIL, Blocks.STONE_PRESSURE_PLATE, Blocks.AIR, Blocks.WHITE_CONCRETE_POWDER, + Blocks.BOOKSHELF }; + private static final Block[] uncommon = new Block[] { Blocks.COBWEB, Blocks.CAULDRON, Blocks.TORCH, + Blocks.REDSTONE_WIRE, Blocks.CANDLE, Blocks.CRAFTING_TABLE, Blocks.FURNACE, Blocks.REPEATER, + Blocks.COMPARATOR, Blocks.LOOM }; + private static final Block[] rare = new Block[] { Blocks.COMPOSTER, Blocks.SKELETON_SKULL, Blocks.ZOMBIE_HEAD, + Blocks.BREWING_STAND, Blocks.DAYLIGHT_DETECTOR, Blocks.LANTERN, Blocks.PISTON, Blocks.OBSERVER, + Blocks.LIGHTNING_ROD, BackroomsBlocks.FIRESALT_CRYSTAL, BackroomsBlocks.CRATE }; + private static final Block[] validPots = new Block[] { Blocks.POTTED_DANDELION, Blocks.POTTED_POPPY, + Blocks.POTTED_BLUE_ORCHID, Blocks.POTTED_SPRUCE_SAPLING, Blocks.POTTED_CACTUS, Blocks.POTTED_RED_MUSHROOM, + Blocks.POTTED_AZALEA_BUSH, Blocks.POTTED_BAMBOO }; + private static final Block[] validConcretePowder = new Block[] { Blocks.YELLOW_CONCRETE_POWDER, + Blocks.RED_CONCRETE_POWDER, Blocks.BLUE_CONCRETE_POWDER, Blocks.BROWN_CONCRETE_POWDER, + Blocks.GREEN_CONCRETE_POWDER, Blocks.WHITE_CONCRETE_POWDER }; + private static final BlockState[] rails = new BlockState[] { Blocks.RAIL.getDefaultState().with(RailBlock.SHAPE, RailShape.NORTH_SOUTH), Blocks.RAIL.getDefaultState().with(RailBlock.SHAPE, RailShape.EAST_WEST) }; @@ -82,35 +89,38 @@ public class WarehouseChunkGenerator extends ChunkGenerator { private final HashMap loadedStructures = new HashMap(30); private Identifier nbtId = BackroomsMod.id("level_1"); - - public WarehouseChunkGenerator(BiomeSource biomeSource, long worldSeed) { - super(new SimpleRegistry<>(Registry.STRUCTURE_SET_KEY, Lifecycle.stable(), null), Optional.empty(), biomeSource, biomeSource, worldSeed); + private RegistryEntryLookup blockLookup; + + public WarehouseChunkGenerator(BiomeSource biomeSource, long worldSeed, RegistryEntryLookup blockLookup) { + super(biomeSource); this.worldSeed = worldSeed; + this.blockLookup = blockLookup; } @Override protected Codec getCodec() { return CODEC; } - @Override - public ChunkGenerator withSeed(long seed) { - return new WarehouseChunkGenerator(this.biomeSource, seed); - } @Override - public CompletableFuture populateNoise(Executor executor, Blender blender, StructureAccessor structureAccessor, Chunk chunk) { + public CompletableFuture populateNoise(Executor executor, Blender blender, NoiseConfig noiseConfig, + StructureAccessor structureAccessor, Chunk chunk) { // IMPORTANT NOTE: - // For biomes generation we're using various "placeholder" blocks to replace them later with blocks we actually need in biomes. - // If you're adding new type of structure then don't use blocks other than described below from our mod! + // For biomes generation we're using various "placeholder" blocks to replace + // them later with blocks we actually need in biomes. + // If you're adding new type of structure then don't use blocks other than + // described below from our mod! // Instead, use those blocks: // BackroomsBlocks.PATTERNED_WALLPAPER -> any wallpaper // BackroomsBlocks.WOOLEN_CARPET -> any carpet // BackroomsBlocks.CORK_TILE -> any cork tile // BackroomsBlocks.FLUORESCENT_LIGHT -> any light source - // BackroomsBlocks.MOLDY_WOOLEN_CARPET -> random blocks(you can just replace them with carpet) + // BackroomsBlocks.MOLDY_WOOLEN_CARPET -> random blocks(you can just replace + // them with carpet) final ChunkPos chunkPos = chunk.getPos(); - // Save the starting x and z position of the chunk. Note: positive x means east, positive z means south. + // Save the starting x and z position of the chunk. Note: positive x means east, + // positive z means south. final int startX = chunkPos.getStartX(); final int startZ = chunkPos.getStartZ(); // Create 5 floors, top to bottom. @@ -126,130 +136,160 @@ public CompletableFuture populateNoise(Executor executor, Blender blender for (int y = floorCount; y >= 0; y--) { for (int x = 1; x >= 0; x--) { for (int z = 1; z >= 0; z--) { - //Make a Random object controlling the generation of the section. - final Random random = new Random(worldSeed + MathHelper.hashCode(startX, startZ, x + 4 * z + 20 * y)); + // Make a Random object controlling the generation of the section. + final Random random = new Random(worldSeed + BlockPos.asLong(startX, startZ, x + 4 * z + 20 * y)); // Decide the arrangement of the walls of the section. // The two numbers with an F directly after them denote the probability of // an eastern wall and a southern wall generating, respectively. final int wallType = (random.nextFloat() < 0.4F ? 1 : 0) + (random.nextFloat() < 0.4F ? 2 : 0); - final int shelfType = 4 * (random.nextFloat() < 0.7F ? random.nextInt(4) + 1 : 0) + random.nextInt(3); - //Same for the eastern adjacent section. - final Random eastRandom = new Random(worldSeed + MathHelper.hashCode(startX + x * 16, startZ, (1 - x) + 4 * z + 20 * y)); - final int eastWallType = (eastRandom.nextFloat() < 0.4F ? 1 : 0) + (eastRandom.nextFloat() < 0.4F ? 2 : 0); - final int eastShelfType = 4 * (eastRandom.nextFloat() < 0.7F ? eastRandom.nextInt(4) + 1 : 0) + eastRandom.nextInt(3); - //Same for the southern adjacent section. - final Random southRandom = new Random(worldSeed + MathHelper.hashCode(startX, startZ + z * 16, x + 4 * (1 - z) + 20 * y)); - final int southWallType = (southRandom.nextFloat() < 0.4F ? 1 : 0) + (southRandom.nextFloat() < 0.4F ? 2 : 0); - final int southShelfType = 4 * (southRandom.nextFloat() < 0.7F ? southRandom.nextInt(4) + 1 : 0) + southRandom.nextInt(3); + final int shelfType = 4 * (random.nextFloat() < 0.7F ? random.nextInt(4) + 1 : 0) + + random.nextInt(3); + // Same for the eastern adjacent section. + final Random eastRandom = new Random( + worldSeed + BlockPos.asLong(startX + x * 16, startZ, (1 - x) + 4 * z + 20 * y)); + final int eastWallType = (eastRandom.nextFloat() < 0.4F ? 1 : 0) + + (eastRandom.nextFloat() < 0.4F ? 2 : 0); + final int eastShelfType = 4 * (eastRandom.nextFloat() < 0.7F ? eastRandom.nextInt(4) + 1 : 0) + + eastRandom.nextInt(3); + // Same for the southern adjacent section. + final Random southRandom = new Random( + worldSeed + BlockPos.asLong(startX, startZ + z * 16, x + 4 * (1 - z) + 20 * y)); + final int southWallType = (southRandom.nextFloat() < 0.4F ? 1 : 0) + + (southRandom.nextFloat() < 0.4F ? 2 : 0); + final int southShelfType = 4 * (southRandom.nextFloat() < 0.7F ? southRandom.nextInt(4) + 1 : 0) + + southRandom.nextInt(3); // Check if the arrangement includes the eastern wall // and create eastern wall if it includes. if ((wallType & 1) == 1) { - for(int i = 0; i < 7; i++){ - for(int j = 0; j < 6; j++){ - chunk.setBlockState(new BlockPos(startX + x * 8 + 7 , 2 + 8 * y + j, startZ + z * 8 + i), BackroomsBlocks.CEMENT_BRICKS.getDefaultState(), false); + for (int i = 0; i < 7; i++) { + for (int j = 0; j < 6; j++) { + chunk.setBlockState(new BlockPos(startX + x * 8 + 7, 2 + 8 * y + j, startZ + z * 8 + i), + BackroomsBlocks.CEMENT_BRICKS.getDefaultState(), false); } } } // Check if the arrangement includes the southern wall // and create southern wall if it includes if ((wallType & 2) == 2) { - for(int i = 0; i < 7; i++){ - for(int j = 0; j < 6; j++){ - chunk.setBlockState(new BlockPos(startX + x * 8 + i, 2 + 8 * y + j, startZ + z * 8 + 7), BackroomsBlocks.CEMENT_BRICKS.getDefaultState(), false); + for (int i = 0; i < 7; i++) { + for (int j = 0; j < 6; j++) { + chunk.setBlockState(new BlockPos(startX + x * 8 + i, 2 + 8 * y + j, startZ + z * 8 + 7), + BackroomsBlocks.CEMENT_BRICKS.getDefaultState(), false); } } } // Create the pillar. if ((wallType & 1) + (wallType & 2) / 2 + (southWallType & 1) + (eastWallType & 2) / 2 > 0) { - for (int j = 0; j < 6; j++){ - chunk.setBlockState(new BlockPos(startX + x * 8 + 7, 2 + 8 * y + j, startZ + z * 8 + 7), BackroomsBlocks.CEMENT_BRICKS.getDefaultState(), false); + for (int j = 0; j < 6; j++) { + chunk.setBlockState(new BlockPos(startX + x * 8 + 7, 2 + 8 * y + j, startZ + z * 8 + 7), + BackroomsBlocks.CEMENT_BRICKS.getDefaultState(), false); } } - if(shelfType - (shelfType & 3) != 0){ + if (shelfType - (shelfType & 3) != 0) { final Direction dir = Direction.fromHorizontal((shelfType - (shelfType & 3)) / 4 - 1); - final BlockRotation rotation = switch(dir) { + final BlockRotation rotation = switch (dir) { case NORTH -> BlockRotation.COUNTERCLOCKWISE_90; case EAST -> BlockRotation.NONE; case SOUTH -> BlockRotation.CLOCKWISE_90; default -> BlockRotation.CLOCKWISE_180; }; - //BackroomsMod.LOGGER.info(dir +" & " + rotation); - generateNbt(chunk, new BlockPos(startX + x * 8, 2 + 8 * y, startZ + z * 8), "warehouse_" + ((shelfType & 3) + 4), rotation); //Actually generate the shelf. - //commented former code: generateNbt(chunk, new BlockPos(startX + x * 8, 2 + 8 * y, startZ + z * 8), "warehouse_5", BlockRotation.NONE); + generateNbt(chunk, new BlockPos(startX + x * 8, 2 + 8 * y, startZ + z * 8), + "warehouse_" + ((shelfType & 3) + 4), rotation); // Actually generate the shelf. + // commented former code: generateNbt(chunk, new BlockPos(startX + x * 8, 2 + 8 + // * y, startZ + z * 8), "warehouse_5", BlockRotation.NONE); } - //Generate the edges of the shelves. - if((wallType & 1) == 0) { - shelfEdge(chunk, new BlockPos(startX + x * 8 + 7, 2 + 8 * y, startZ + z * 8 + 6), Direction.EAST, 1, shelfType, eastShelfType); - shelfEdge(chunk, new BlockPos(startX + x * 8 + 7, 2 + 8 * y, startZ + z * 8), Direction.EAST, 3, shelfType, eastShelfType); + // Generate the edges of the shelves. + if ((wallType & 1) == 0) { + shelfEdge(chunk, new BlockPos(startX + x * 8 + 7, 2 + 8 * y, startZ + z * 8 + 6), + Direction.EAST, 1, shelfType, eastShelfType); + shelfEdge(chunk, new BlockPos(startX + x * 8 + 7, 2 + 8 * y, startZ + z * 8), Direction.EAST, 3, + shelfType, eastShelfType); } - if((wallType & 2) == 0) { - shelfEdge(chunk, new BlockPos(startX + x * 8 + 6, 2 + 8 * y, startZ + z * 8 + 7), Direction.SOUTH, 0, shelfType, southShelfType); - shelfEdge(chunk, new BlockPos(startX + x * 8, 2 + 8 * y, startZ + z * 8 + 7), Direction.SOUTH, 2, shelfType, southShelfType); + if ((wallType & 2) == 0) { + shelfEdge(chunk, new BlockPos(startX + x * 8 + 6, 2 + 8 * y, startZ + z * 8 + 7), + Direction.SOUTH, 0, shelfType, southShelfType); + shelfEdge(chunk, new BlockPos(startX + x * 8, 2 + 8 * y, startZ + z * 8 + 7), Direction.SOUTH, + 2, shelfType, southShelfType); } // blockState.with(FACING, direction) // Generate the carpeting and the ceiling. - for(int i = 0; i < 8; i++){ - for(int j = 0; j < 8; j++){ - chunk.setBlockState(new BlockPos(startX + x * 8 + i, 1 + 8 * y, startZ + z * 8 + j), BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), false); - chunk.setBlockState(new BlockPos(startX + x * 8 + i, 8 + 8 * y, startZ + z * 8 + j), BackroomsBlocks.CORK_TILE.getDefaultState(), false); - for(int k = 0; k < 6; k++){ - final BlockPos pos = new BlockPos(startX + x * 8 + i, 2 + 8 * y + k, startZ + z * 8 + j); + for (int i = 0; i < 8; i++) { + for (int j = 0; j < 8; j++) { + chunk.setBlockState(new BlockPos(startX + x * 8 + i, 1 + 8 * y, startZ + z * 8 + j), + BackroomsBlocks.WOOLEN_CARPET.getDefaultState(), false); + chunk.setBlockState(new BlockPos(startX + x * 8 + i, 8 + 8 * y, startZ + z * 8 + j), + BackroomsBlocks.CORK_TILE.getDefaultState(), false); + for (int k = 0; k < 6; k++) { + final BlockPos pos = new BlockPos(startX + x * 8 + i, 2 + 8 * y + k, + startZ + z * 8 + j); final BlockState state = chunk.getBlockState(pos); if (state.isOf(Blocks.GOLD_BLOCK)) { final int blockType = random.nextInt(11); Block chosenBlock; - if(blockType < 7) { + if (blockType < 7) { chosenBlock = common[random.nextInt(common.length)]; - } - else if(blockType < 10) { + } else if (blockType < 10) { chosenBlock = uncommon[random.nextInt(uncommon.length)]; - } - else { + } else { chosenBlock = rare[random.nextInt(rare.length)]; } - - if(chosenBlock == Blocks.STONE_BUTTON || chosenBlock == Blocks.LEVER) { - chunk.setBlockState(pos, chosenBlock.getDefaultState().with(WallMountedBlock.FACE, WallMountLocation.FLOOR).with(WallMountedBlock.FACING, Direction.fromHorizontal(random.nextInt(4))), false); - } - else if(chosenBlock == Blocks.FLOWER_POT) { - chunk.setBlockState(pos, validPots[random.nextInt(validPots.length)].getDefaultState(), false); - } - else if(chosenBlock == Blocks.WHITE_CONCRETE_POWDER) { - chunk.setBlockState(pos, validConcretePowder[random.nextInt(validConcretePowder.length)].getDefaultState(), false); - } - else if(chosenBlock == BackroomsBlocks.FIRESALT_CRYSTAL) { - chunk.setBlockState(pos, chosenBlock.getDefaultState().with(FiresaltCrystalBlock.FACING, Direction.UP), false); - } - else if(chosenBlock == Blocks.CANDLE) { - chunk.setBlockState(pos, validCandles[random.nextInt(validCandles.length)].getDefaultState().with(CandleBlock.LIT, true).with(CandleBlock.CANDLES, random.nextInt(4) + 1), false); - } - else if(chosenBlock == Blocks.REPEATER || chosenBlock == Blocks.COMPARATOR || chosenBlock == Blocks.FURNACE) { - chunk.setBlockState(pos, chosenBlock.getDefaultState().with(HorizontalFacingBlock.FACING, Direction.fromHorizontal(random.nextInt(4))), false); - } - else if(chosenBlock == Blocks.PISTON || chosenBlock == Blocks.OBSERVER){ - chunk.setBlockState(pos, chosenBlock.getDefaultState().with(FacingBlock.FACING, Direction.fromHorizontal(random.nextInt(4))), false); - } - else if(chosenBlock == Blocks.RAIL){ + + if (chosenBlock == Blocks.STONE_BUTTON || chosenBlock == Blocks.LEVER) { + chunk.setBlockState(pos, + chosenBlock.getDefaultState() + .with(WallMountedBlock.FACE, WallMountLocation.FLOOR) + .with(WallMountedBlock.FACING, + Direction.fromHorizontal(random.nextInt(4))), + false); + } else if (chosenBlock == Blocks.FLOWER_POT) { + chunk.setBlockState(pos, + validPots[random.nextInt(validPots.length)].getDefaultState(), false); + } else if (chosenBlock == Blocks.WHITE_CONCRETE_POWDER) { + chunk.setBlockState(pos, + validConcretePowder[random.nextInt(validConcretePowder.length)] + .getDefaultState(), + false); + } else if (chosenBlock == BackroomsBlocks.FIRESALT_CRYSTAL) { + chunk.setBlockState(pos, chosenBlock.getDefaultState() + .with(FiresaltCrystalBlock.FACING, Direction.UP), false); + } else if (chosenBlock == Blocks.CANDLE) { + chunk.setBlockState(pos, + validCandles[random.nextInt(validCandles.length)].getDefaultState() + .with(CandleBlock.LIT, true) + .with(CandleBlock.CANDLES, random.nextInt(4) + 1), + false); + } else if (chosenBlock == Blocks.REPEATER || chosenBlock == Blocks.COMPARATOR + || chosenBlock == Blocks.FURNACE) { + chunk.setBlockState(pos, + chosenBlock.getDefaultState().with(HorizontalFacingBlock.FACING, + Direction.fromHorizontal(random.nextInt(4))), + false); + } else if (chosenBlock == Blocks.PISTON || chosenBlock == Blocks.OBSERVER) { + chunk.setBlockState(pos, chosenBlock.getDefaultState().with(FacingBlock.FACING, + Direction.fromHorizontal(random.nextInt(4))), false); + } else if (chosenBlock == Blocks.RAIL) { chunk.setBlockState(pos, rails[random.nextInt(2)], false); - } - else if(chosenBlock == Blocks.SKELETON_SKULL || chosenBlock == Blocks.ZOMBIE_HEAD){ - chunk.setBlockState(pos, chosenBlock.getDefaultState().with(SkullBlock.ROTATION, random.nextInt(16)), false); - } - else if (chosenBlock == BackroomsBlocks.CRATE) { + } else if (chosenBlock == Blocks.SKELETON_SKULL + || chosenBlock == Blocks.ZOMBIE_HEAD) { + chunk.setBlockState(pos, chosenBlock.getDefaultState().with(SkullBlock.ROTATION, + random.nextInt(16)), false); + } else if (chosenBlock == BackroomsBlocks.CRATE) { chunk.setBlockState(pos, chosenBlock.getDefaultState(), false); - CrateBlockEntity crateBlockEntity = new CrateBlockEntity(pos, chosenBlock.getDefaultState()); + CrateBlockEntity crateBlockEntity = new CrateBlockEntity(pos, + chosenBlock.getDefaultState()); chunk.setBlockEntity(crateBlockEntity); - crateBlockEntity.setLootTable(this.getBarrelLootTable(), worldSeed + MathHelper.hashCode(pos)); -} - else{ + crateBlockEntity.setLootTable(this.getBarrelLootTable(), + worldSeed + pos.hashCode()); + } else { replace(chunk, chosenBlock, chunk, pos); } } } } } - //Place a ceiling light at the correct height. - chunk.setBlockState(new BlockPos(startX + x * 8 + 3, 8 + 8 * y, startZ + z * 8 + 3), BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); //Place a ceiling light. + // Place a ceiling light at the correct height. + chunk.setBlockState(new BlockPos(startX + x * 8 + 3, 8 + 8 * y, startZ + z * 8 + 3), + BackroomsBlocks.FLUORESCENT_LIGHT.getDefaultState(), false); // Place a ceiling light. } } } @@ -259,31 +299,34 @@ else if (chosenBlock == BackroomsBlocks.CRATE) { protected Identifier getBarrelLootTable() { return BackroomsLootTables.CRATE; } - + public void storeStructures(ServerWorld world) { - store("warehouse", world, 4, 6); //Makes it so the shelves can be used while generating + store("warehouse", world, 4, 6); // Makes it so the shelves can be used while generating store("warehouse_sliver", world, 4, 6); } private void store(String id, ServerWorld world) { - loadedStructures.put(id, NbtPlacerUtil.load(world.getServer().getResourceManager(), new Identifier(this.nbtId.getNamespace(), "nbt/" + this.nbtId.getPath() + "/" + id + ".nbt")).get()); - } + loadedStructures.put(id, + NbtPlacerUtil.load(world.getServer().getResourceManager(), + new Identifier(this.nbtId.getNamespace(), "nbt/" + this.nbtId.getPath() + "/" + id + ".nbt"), + this.blockLookup).get()); + } - private void store(String id, ServerWorld world, int from, int to) { - for (int i = from; i <= to; i++) { - store(id + "_" + i, world); - } - } + private void store(String id, ServerWorld world, int from, int to) { + for (int i = from; i <= to; i++) { + store(id + "_" + i, world); + } + } private void modifyStructure(Chunk region, BlockPos pos, BlockState state, NbtCompound nbt) { - if (!state.isAir()) { - if (state.isOf(Blocks.BARRIER)) { - region.setBlockState(pos, Blocks.AIR.getDefaultState(), true); - } else { - region.setBlockState(pos, state, true); - } - } - } + if (!state.isAir()) { + if (state.isOf(Blocks.BARRIER)) { + region.setBlockState(pos, Blocks.AIR.getDefaultState(), true); + } else { + region.setBlockState(pos, state, true); + } + } + } @Override public int getWorldHeight() { @@ -291,7 +334,7 @@ public int getWorldHeight() { } @Override - public int getHeight(int x, int y, Heightmap.Type type, HeightLimitView world) { + public int getHeight(int x, int z, Type heightmap, HeightLimitView world, NoiseConfig noiseConfig) { return world.getTopY(); } @@ -305,31 +348,35 @@ private void replace(ChunkRegion region, Block block, Chunk chunk, BlockPos pos) BackroomsLevels.LEVEL_1_WORLD.onBlockChanged(pos, oldState, block.getDefaultState()); } - private void shelfEdge(Chunk region, BlockPos pos, Direction direction, int shelfDirection, int shelfType, int adjacentShelfType) { + private void shelfEdge(Chunk region, BlockPos pos, Direction direction, int shelfDirection, int shelfType, + int adjacentShelfType) { if ((shelfType - (shelfType & 3)) / 4 - 1 == shelfDirection) { for (int j = 0; j < (shelfType & 3) + 4; j++) { - region.setBlockState(pos.add(new BlockPos(0,j,0)), Blocks.OAK_TRAPDOOR.getDefaultState().with(TrapdoorBlock.FACING, direction).with(TrapdoorBlock.OPEN, true), false); + region.setBlockState(pos.add(new BlockPos(0, j, 0)), Blocks.OAK_TRAPDOOR.getDefaultState() + .with(TrapdoorBlock.FACING, direction).with(TrapdoorBlock.OPEN, true), false); } - if((adjacentShelfType - (adjacentShelfType & 3)) / 4 - 1 == shelfDirection) { - if ((adjacentShelfType & 3) != (shelfType & 3)){ + if ((adjacentShelfType - (adjacentShelfType & 3)) / 4 - 1 == shelfDirection) { + if ((adjacentShelfType & 3) != (shelfType & 3)) { for (int j = 0; j < 6; j++) { - region.setBlockState(pos.add(new BlockPos(0,j,0)), BackroomsBlocks.CEMENT_PILLAR.getDefaultState(), false); + region.setBlockState(pos.add(new BlockPos(0, j, 0)), + BackroomsBlocks.CEMENT_PILLAR.getDefaultState(), false); } - } - else{ + } else { generateNbt(region, pos, "warehouse_sliver_" + ((shelfType & 3) + 4)); } } - } - else if((adjacentShelfType - (adjacentShelfType & 3)) / 4 - 1 == shelfDirection){ + } else if ((adjacentShelfType - (adjacentShelfType & 3)) / 4 - 1 == shelfDirection) { for (int j = 0; j < (adjacentShelfType & 3) + 4; j++) { - region.setBlockState(pos.add(new BlockPos(0,j,0)), Blocks.OAK_TRAPDOOR.getDefaultState().with(TrapdoorBlock.FACING, direction.getOpposite()).with(TrapdoorBlock.OPEN, true), false); + region.setBlockState( + pos.add(new BlockPos(0, j, 0)), Blocks.OAK_TRAPDOOR.getDefaultState() + .with(TrapdoorBlock.FACING, direction.getOpposite()).with(TrapdoorBlock.OPEN, true), + false); } } } @Override - public void buildSurface(ChunkRegion region, StructureAccessor structureAccessor, Chunk chunk) { + public void buildSurface(ChunkRegion region, StructureAccessor structures, NoiseConfig noiseConfig, Chunk chunk) { final ChunkPos chunkPos = chunk.getPos(); // controls every block up to the roof for (int x = 0; x < 16; x++) { @@ -359,41 +406,40 @@ public interface PentaConsumer { } private void generateNbt(Chunk region, BlockPos at, String id) { - generateNbt(region, at, id, BlockRotation.NONE); - } + generateNbt(region, at, id, BlockRotation.NONE); + } - private void generateNbt(Chunk region, BlockPos at, String id, BlockRotation rotation) { - loadedStructures.get(id).rotate(rotation).generateNbt(region, at, (pos, state, nbt) -> this.modifyStructure(region, pos, state, nbt)); - } + private void generateNbt(Chunk region, BlockPos at, String id, BlockRotation rotation) { + loadedStructures.get(id).rotate(rotation, this.blockLookup).generateNbt(region, at, + (pos, state, nbt) -> this.modifyStructure(region, pos, state, nbt)); + } @Override - public void carve(ChunkRegion chunkRegion, long seed, BiomeAccess biomeAccess, StructureAccessor structureAccessor, - Chunk chunk, Carver generationStep) {} + public void carve(ChunkRegion chunkRegion, long seed, NoiseConfig noiseConfig, BiomeAccess world, + StructureAccessor structureAccessor, Chunk chunk, Carver carverStep) { + } @Override - public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world) { + public VerticalBlockSample getColumnSample(int x, int z, HeightLimitView world, NoiseConfig noiseConfig) { return new VerticalBlockSample(0, new BlockState[0]); } @Override - public void getDebugHudText(List text, BlockPos pos) {} + public void getDebugHudText(List text, NoiseConfig noiseConfig, BlockPos pos) { + } @Override public int getMinimumY() { return 0; } - @Override - public MultiNoiseSampler getMultiNoiseSampler() { - return null; - } - @Override public int getSeaLevel() { return 0; } @Override - public void populateEntities(ChunkRegion region) {} + public void populateEntities(ChunkRegion region) { + } } diff --git a/src/main/java/name/trimsky/lib_ai/LibAI.java b/src/main/java/name/trimsky/lib_ai/LibAI.java index 3c66c1a..7cdfc49 100644 --- a/src/main/java/name/trimsky/lib_ai/LibAI.java +++ b/src/main/java/name/trimsky/lib_ai/LibAI.java @@ -1,21 +1,17 @@ package name.trimsky.lib_ai; import name.trimsky.lib_ai.tasks.Task; -import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerWorldEvents; import net.minecraft.world.World; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - public class LibAI { public static final String modID = "lib_ai"; public static boolean initialized = false; private static SimpleTaskControllerManager tasksManager; public static void initialize() { - if(!initialized) { + if (!initialized) { ServerTickEvents.START_SERVER_TICK.register(server -> tasksManager.tick()); ServerWorldEvents.LOAD.register((server, world) -> tasksManager = new SimpleTaskControllerManager()); @@ -24,12 +20,13 @@ public static void initialize() { } public static synchronized void removeEntity(World world, long uniqueId) { - if(!world.isClient) { + if (!world.isClient) { tasksManager.controllers.remove(uniqueId); } } + public static synchronized long generateNewUniqueId(World world, Task idleTask) { - if(!world.isClient) { + if (!world.isClient) { tasksManager.controllers.put(tasksManager.uniqueId, new TaskController(idleTask)); return tasksManager.uniqueId++; } else { @@ -37,8 +34,10 @@ public static synchronized long generateNewUniqueId(World world, Task idleTask) return -1; } } + public static TaskController getTaskControllerByEntityId(World world, long uniqueId) { - if(world.isClient) throw new IllegalStateException("Called on client"); + if (world.isClient) + throw new IllegalStateException("Called on client"); return tasksManager.controllers.get(uniqueId); } diff --git a/src/main/java/name/trimsky/lib_ai/SimpleTaskControllerManager.java b/src/main/java/name/trimsky/lib_ai/SimpleTaskControllerManager.java index 636752b..ace8600 100644 --- a/src/main/java/name/trimsky/lib_ai/SimpleTaskControllerManager.java +++ b/src/main/java/name/trimsky/lib_ai/SimpleTaskControllerManager.java @@ -13,7 +13,7 @@ public final class SimpleTaskControllerManager { public long uniqueId = 0; public void tick() { - for(final var controller : controllers.values()) { + for (final var controller : controllers.values()) { controller.tick(); } } diff --git a/src/main/java/name/trimsky/lib_ai/TaskController.java b/src/main/java/name/trimsky/lib_ai/TaskController.java index 59bc4b5..8a22410 100644 --- a/src/main/java/name/trimsky/lib_ai/TaskController.java +++ b/src/main/java/name/trimsky/lib_ai/TaskController.java @@ -16,7 +16,7 @@ public class TaskController { private Task idleTask; public TaskController(final Task idleTask) { - if(idleTask == null) { + if (idleTask == null) { throw new IllegalArgumentException("firstTask argument must be not null"); } tasksStack = new Stack<>(); @@ -28,19 +28,20 @@ public TaskController(final Task idleTask) { public Task getIdleTask() { return this.idleTask; } + public void setIdleTask(Task newIdleTask) { this.idleTask = newIdleTask; } public void popState() { tasksStack.pop(); - if(tasksStack.empty()) { + if (tasksStack.empty()) { tasksStack.push(idleTask); } } public void pushState(Task task) { - if(tasksStack.empty() || !tasksStack.peek().equals(task)) { + if (tasksStack.empty() || !tasksStack.peek().equals(task)) { task.setTaskController(this); tasksStack.push(task); } diff --git a/src/main/java/name/trimsky/lib_ai/example/LibAIMod.java b/src/main/java/name/trimsky/lib_ai/example/LibAIMod.java deleted file mode 100644 index 4775f11..0000000 --- a/src/main/java/name/trimsky/lib_ai/example/LibAIMod.java +++ /dev/null @@ -1,43 +0,0 @@ -package name.trimsky.lib_ai.example; - -import name.trimsky.lib_ai.LibAI; -import name.trimsky.lib_ai.example.client.ExampleEntityRenderer; -import name.trimsky.lib_ai.example.entity.ExampleEntity; -import net.fabricmc.api.ClientModInitializer; -import net.fabricmc.api.ModInitializer; -import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; -import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry; -import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.entity.EntityDimensions; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.SpawnGroup; -import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class LibAIMod implements ModInitializer, ClientModInitializer { - static final public String modID = "lib_ai_example"; - public static final Logger LOGGER = LoggerFactory.getLogger(modID); - public static boolean DISABLE_IN_DEV_ENVIRONMENT = false; - - public static EntityType EXAMPLE_ENTITY; - - @Override - public void onInitialize() { - LibAI.initialize(); - if(!DISABLE_IN_DEV_ENVIRONMENT && FabricLoader.getInstance().isDevelopmentEnvironment()) { - EXAMPLE_ENTITY = FabricEntityTypeBuilder.create(SpawnGroup.CREATURE, ExampleEntity::new).dimensions(EntityDimensions.fixed(1f, 1f)).build(); - Registry.register(Registry.ENTITY_TYPE, new Identifier(modID, "example_entity"), EXAMPLE_ENTITY); - FabricDefaultAttributeRegistry.register(EXAMPLE_ENTITY, ExampleEntity.createMobAttributes()); - } - } - - @Override - public void onInitializeClient() { - if(!LibAIMod.DISABLE_IN_DEV_ENVIRONMENT && FabricLoader.getInstance().isDevelopmentEnvironment()) { - EntityRendererRegistry.register(LibAIMod.EXAMPLE_ENTITY, ExampleEntityRenderer::new); - } - } -} diff --git a/src/main/java/name/trimsky/lib_ai/example/client/ExampleEntityModel.java b/src/main/java/name/trimsky/lib_ai/example/client/ExampleEntityModel.java deleted file mode 100644 index 9a4b6ca..0000000 --- a/src/main/java/name/trimsky/lib_ai/example/client/ExampleEntityModel.java +++ /dev/null @@ -1,27 +0,0 @@ -package name.trimsky.lib_ai.example.client; - -import name.trimsky.lib_ai.example.LibAIMod; -import name.trimsky.lib_ai.example.entity.ExampleEntity; -import net.minecraft.util.Identifier; -import software.bernie.geckolib3.model.AnimatedGeoModel; - -public class ExampleEntityModel extends AnimatedGeoModel { - private static final Identifier modelId = new Identifier(LibAIMod.modID, "geo/example_entity.geo.json"); - private static final Identifier textureId = new Identifier(LibAIMod.modID, "textures/entity/example_entity.png"); - private static final Identifier animationId = new Identifier(LibAIMod.modID, "animations/example_entity.animation.json"); - - @Override - public Identifier getModelLocation(ExampleEntity object) { - return modelId; - } - - @Override - public Identifier getTextureLocation(ExampleEntity object) { - return textureId; - } - - @Override - public Identifier getAnimationFileLocation(ExampleEntity animatable) { - return animationId; - } -} \ No newline at end of file diff --git a/src/main/java/name/trimsky/lib_ai/example/client/ExampleEntityRenderer.java b/src/main/java/name/trimsky/lib_ai/example/client/ExampleEntityRenderer.java deleted file mode 100644 index 7a760c6..0000000 --- a/src/main/java/name/trimsky/lib_ai/example/client/ExampleEntityRenderer.java +++ /dev/null @@ -1,12 +0,0 @@ -package name.trimsky.lib_ai.example.client; - -import name.trimsky.lib_ai.example.entity.ExampleEntity; -import net.minecraft.client.render.entity.EntityRendererFactory; -import software.bernie.geckolib3.renderers.geo.GeoEntityRenderer; - -public class ExampleEntityRenderer extends GeoEntityRenderer { - public ExampleEntityRenderer(EntityRendererFactory.Context renderManager) { - super(renderManager, new ExampleEntityModel()); - this.shadowRadius = 0.25f; - } -} diff --git a/src/main/java/name/trimsky/lib_ai/example/entity/ExampleEntity.java b/src/main/java/name/trimsky/lib_ai/example/entity/ExampleEntity.java deleted file mode 100644 index ad72c85..0000000 --- a/src/main/java/name/trimsky/lib_ai/example/entity/ExampleEntity.java +++ /dev/null @@ -1,72 +0,0 @@ -package name.trimsky.lib_ai.example.entity; - -import name.trimsky.lib_ai.LibAI; -import name.trimsky.lib_ai.example.tasks.LookAtEntityTask; -import name.trimsky.lib_ai.tasks.SingleTask; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.ai.TargetPredicate; -import net.minecraft.entity.mob.PathAwareEntity; -import net.minecraft.world.World; -import software.bernie.geckolib3.core.IAnimatable; -import software.bernie.geckolib3.core.PlayState; -import software.bernie.geckolib3.core.builder.AnimationBuilder; -import software.bernie.geckolib3.core.controller.AnimationController; -import software.bernie.geckolib3.core.event.predicate.AnimationEvent; -import software.bernie.geckolib3.core.manager.AnimationData; -import software.bernie.geckolib3.core.manager.AnimationFactory; - -public class ExampleEntity extends PathAwareEntity implements IAnimatable { - private final AnimationFactory factory = new AnimationFactory(this); - private final long entityId; - - public ExampleEntity(EntityType entityType, World world) { - super(entityType, world); - entityId = LibAI.generateNewUniqueId(world, new IdleTask(this)); - } - - @Override - public void onRemoved() { - LibAI.removeEntity(this.world, this.entityId); - super.onRemoved(); - } - - private PlayState predicate(AnimationEvent event) { - event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.example_entity.idle", true)); - return PlayState.CONTINUE; - } - - @Override - public void registerControllers(AnimationData data) { - data.addAnimationController(new AnimationController<>(this, "controller", 5, this::predicate)); - } - - @Override - public AnimationFactory getFactory() { - return this.factory; - } - - static final class IdleTask extends SingleTask { - public static final float LOOK_CHANCE = 0.02F; - public static final TargetPredicate lookAtPlayerPredicate = TargetPredicate.createNonAttackable().setBaseMaxDistance(6.0F); - - public IdleTask(ExampleEntity owner) { - super(owner); - } - - @Override - public void tick() { - if (this.owner.getRandom().nextFloat() >= LOOK_CHANCE) { - final var targetPlayer = this.owner.world.getClosestPlayer( - lookAtPlayerPredicate, - this.owner, - this.owner.getX(), - this.owner.getEyeY(), - this.owner.getZ()); - - if (targetPlayer != null) { - this.controller.pushState(new LookAtEntityTask<>(this.owner, targetPlayer, 6.0F)); - } - } - } - } -} \ No newline at end of file diff --git a/src/main/java/name/trimsky/lib_ai/example/tasks/LookAtEntityTask.java b/src/main/java/name/trimsky/lib_ai/example/tasks/LookAtEntityTask.java deleted file mode 100644 index b74b6ea..0000000 --- a/src/main/java/name/trimsky/lib_ai/example/tasks/LookAtEntityTask.java +++ /dev/null @@ -1,37 +0,0 @@ -package name.trimsky.lib_ai.example.tasks; - -import name.trimsky.lib_ai.tasks.SingleTask; -import net.minecraft.entity.LivingEntity; -import net.minecraft.entity.mob.MobEntity; - -public class LookAtEntityTask extends SingleTask { - protected LivingEntity target; - private int lookTime; - protected final float range; - - public LookAtEntityTask(T owner, LivingEntity target, float range) { - super(owner); - - if(owner == null) { - throw new NullPointerException("owner parameter must be not null!"); - } - if(target == null) { - throw new NullPointerException("target parameter must be not null!"); - } - this.target = target; - this.range = range; - this.lookTime = 40 + this.owner.getRandom().nextInt(40); - } - - @Override - public void tick() { - if (!this.target.isAlive() - || this.lookTime <= 0 - || this.owner.squaredDistanceTo(this.target) > (double) (this.range * this.range)) { - this.controller.popState(); - } - double d = this.target.getEyeY(); - this.owner.getLookControl().lookAt(this.target.getX(), d, this.target.getZ()); - --this.lookTime; - } -} diff --git a/src/main/java/name/trimsky/lib_ai/tasks/EmptyTask.java b/src/main/java/name/trimsky/lib_ai/tasks/EmptyTask.java index 30eb4f0..a12a45a 100644 --- a/src/main/java/name/trimsky/lib_ai/tasks/EmptyTask.java +++ b/src/main/java/name/trimsky/lib_ai/tasks/EmptyTask.java @@ -7,8 +7,10 @@ */ public class EmptyTask implements Task { @Override - public void tick() {} + public void tick() { + } @Override - public void setTaskController(TaskController controller) {} + public void setTaskController(TaskController controller) { + } } diff --git a/src/main/java/name/trimsky/lib_ai/tasks/GroupTask.java b/src/main/java/name/trimsky/lib_ai/tasks/GroupTask.java index 5e5c2f5..6bf862d 100644 --- a/src/main/java/name/trimsky/lib_ai/tasks/GroupTask.java +++ b/src/main/java/name/trimsky/lib_ai/tasks/GroupTask.java @@ -6,6 +6,7 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.world.World; +@SuppressWarnings("unused") public abstract class GroupTask implements Task { private TaskController controller; /** @@ -20,28 +21,34 @@ public GroupTask(World world) { previousTasks = new Long2ObjectOpenHashMap<>(); entityBehaviour = new Object2ObjectOpenHashMap<>(); } - public GroupTask WithCustomBehaviourFor(Class entityClass, Task task) { + + public GroupTask WithCustomBehaviourFor(Class entityClass, Task task) { this.entityBehaviour.put(entityClass, task); return this; } + public GroupTask SetDefaultBehaviour(Task task) { entityBehaviour.defaultReturnValue(task); return this; } public synchronized void onAttach(long entityId, Class entityClass) { - /*final var entityTaskController = LibAI.getTaskControllerByEntityId(entityId); - - previousTasks.put(entityId, entityTaskController.getIdleTask()); - entityTaskController.setIdleTask(entityBehaviour.get(entityClass));*/ + /* + * final var entityTaskController = LibAI.getTaskControllerByEntityId(entityId); + * + * previousTasks.put(entityId, entityTaskController.getIdleTask()); + * entityTaskController.setIdleTask(entityBehaviour.get(entityClass)); + */ } public void onDetach(long entityId) { - /*LibAI.getTaskControllerByEntityId(entityId) - .setIdleTask(previousTasks.get(entityId)); - synchronized (previousTasks) { - previousTasks.remove(entityId); - }*/ + /* + * LibAI.getTaskControllerByEntityId(entityId) + * .setIdleTask(previousTasks.get(entityId)); + * synchronized (previousTasks) { + * previousTasks.remove(entityId); + * } + */ } @Override diff --git a/src/main/java/name/trimsky/lib_ai/tasks/SingleTask.java b/src/main/java/name/trimsky/lib_ai/tasks/SingleTask.java index b8d8ce2..8a7b031 100644 --- a/src/main/java/name/trimsky/lib_ai/tasks/SingleTask.java +++ b/src/main/java/name/trimsky/lib_ai/tasks/SingleTask.java @@ -4,7 +4,8 @@ public abstract class SingleTask implements Task { /** - * This variable is actually sets in TaskControllerManager, not available in constructor! + * This variable is actually sets in TaskControllerManager, not available in + * constructor! */ protected TaskController controller; public T owner; @@ -16,7 +17,9 @@ public SingleTask(T owner) { /** * Private implementation, but I leaved it public. It actually sets * task controller for task - * @param controllerRef reference to already existing TaskController from TaskControllerManager + * + * @param controllerRef reference to already existing TaskController from + * TaskControllerManager */ public void setTaskController(TaskController controllerRef) { this.controller = controllerRef; diff --git a/src/main/java/name/trimsky/lib_ai/tasks/Task.java b/src/main/java/name/trimsky/lib_ai/tasks/Task.java index 00b0bbe..bfc93d3 100644 --- a/src/main/java/name/trimsky/lib_ai/tasks/Task.java +++ b/src/main/java/name/trimsky/lib_ai/tasks/Task.java @@ -10,5 +10,6 @@ public interface Task { * a function that is called every tick */ void tick(); + void setTaskController(TaskController controller); } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/blockstates/office_door.json b/src/main/resources/assets/backrooms/blockstates/office_door.json index dc08bea..a718098 100644 --- a/src/main/resources/assets/backrooms/blockstates/office_door.json +++ b/src/main/resources/assets/backrooms/blockstates/office_door.json @@ -1,123 +1,123 @@ { "variants": { "facing=east,half=lower,hinge=left,open=false": { - "model": "backrooms:block/office_door_bottom" + "model": "backrooms:block/office_door_bottom_left" }, "facing=east,half=lower,hinge=left,open=true": { - "model": "backrooms:block/office_door_bottom_hinge", + "model": "backrooms:block/office_door_bottom_left_open", "y": 90 }, "facing=east,half=lower,hinge=right,open=false": { - "model": "backrooms:block/office_door_bottom_hinge" + "model": "backrooms:block/office_door_bottom_right" }, "facing=east,half=lower,hinge=right,open=true": { - "model": "backrooms:block/office_door_bottom", + "model": "backrooms:block/office_door_bottom_right_open", "y": 270 }, "facing=east,half=upper,hinge=left,open=false": { - "model": "backrooms:block/office_door_top" + "model": "backrooms:block/office_door_top_left" }, "facing=east,half=upper,hinge=left,open=true": { - "model": "backrooms:block/office_door_top_hinge", + "model": "backrooms:block/office_door_top_left_open", "y": 90 }, "facing=east,half=upper,hinge=right,open=false": { - "model": "backrooms:block/office_door_top_hinge" + "model": "backrooms:block/office_door_top_right" }, "facing=east,half=upper,hinge=right,open=true": { - "model": "backrooms:block/office_door_top", + "model": "backrooms:block/office_door_top_right_open", "y": 270 }, "facing=north,half=lower,hinge=left,open=false": { - "model": "backrooms:block/office_door_bottom", + "model": "backrooms:block/office_door_bottom_left", "y": 270 }, "facing=north,half=lower,hinge=left,open=true": { - "model": "backrooms:block/office_door_bottom_hinge" + "model": "backrooms:block/office_door_bottom_left_open" }, "facing=north,half=lower,hinge=right,open=false": { - "model": "backrooms:block/office_door_bottom_hinge", + "model": "backrooms:block/office_door_bottom_right", "y": 270 }, "facing=north,half=lower,hinge=right,open=true": { - "model": "backrooms:block/office_door_bottom", + "model": "backrooms:block/office_door_bottom_right_open", "y": 180 }, "facing=north,half=upper,hinge=left,open=false": { - "model": "backrooms:block/office_door_top", + "model": "backrooms:block/office_door_top_left", "y": 270 }, "facing=north,half=upper,hinge=left,open=true": { - "model": "backrooms:block/office_door_top_hinge" + "model": "backrooms:block/office_door_top_left_open" }, "facing=north,half=upper,hinge=right,open=false": { - "model": "backrooms:block/office_door_top_hinge", + "model": "backrooms:block/office_door_top_right", "y": 270 }, "facing=north,half=upper,hinge=right,open=true": { - "model": "backrooms:block/office_door_top", + "model": "backrooms:block/office_door_top_right_open", "y": 180 }, "facing=south,half=lower,hinge=left,open=false": { - "model": "backrooms:block/office_door_bottom", + "model": "backrooms:block/office_door_bottom_left", "y": 90 }, "facing=south,half=lower,hinge=left,open=true": { - "model": "backrooms:block/office_door_bottom_hinge", + "model": "backrooms:block/office_door_bottom_left_open", "y": 180 }, "facing=south,half=lower,hinge=right,open=false": { - "model": "backrooms:block/office_door_bottom_hinge", + "model": "backrooms:block/office_door_bottom_right", "y": 90 }, "facing=south,half=lower,hinge=right,open=true": { - "model": "backrooms:block/office_door_bottom" + "model": "backrooms:block/office_door_bottom_right_open" }, "facing=south,half=upper,hinge=left,open=false": { - "model": "backrooms:block/office_door_top", + "model": "backrooms:block/office_door_top_left", "y": 90 }, "facing=south,half=upper,hinge=left,open=true": { - "model": "backrooms:block/office_door_top_hinge", + "model": "backrooms:block/office_door_top_left_open", "y": 180 }, "facing=south,half=upper,hinge=right,open=false": { - "model": "backrooms:block/office_door_top_hinge", + "model": "backrooms:block/office_door_top_right", "y": 90 }, "facing=south,half=upper,hinge=right,open=true": { - "model": "backrooms:block/office_door_top" + "model": "backrooms:block/office_door_top_right_open" }, "facing=west,half=lower,hinge=left,open=false": { - "model": "backrooms:block/office_door_bottom", + "model": "backrooms:block/office_door_bottom_left", "y": 180 }, "facing=west,half=lower,hinge=left,open=true": { - "model": "backrooms:block/office_door_bottom_hinge", + "model": "backrooms:block/office_door_bottom_left_open", "y": 270 }, "facing=west,half=lower,hinge=right,open=false": { - "model": "backrooms:block/office_door_bottom_hinge", + "model": "backrooms:block/office_door_bottom_right", "y": 180 }, "facing=west,half=lower,hinge=right,open=true": { - "model": "backrooms:block/office_door_bottom", + "model": "backrooms:block/office_door_bottom_right_open", "y": 90 }, "facing=west,half=upper,hinge=left,open=false": { - "model": "backrooms:block/office_door_top", + "model": "backrooms:block/office_door_top_left", "y": 180 }, "facing=west,half=upper,hinge=left,open=true": { - "model": "backrooms:block/office_door_top_hinge", + "model": "backrooms:block/office_door_top_left_open", "y": 270 }, "facing=west,half=upper,hinge=right,open=false": { - "model": "backrooms:block/office_door_top_hinge", + "model": "backrooms:block/office_door_top_right", "y": 180 }, "facing=west,half=upper,hinge=right,open=true": { - "model": "backrooms:block/office_door_top", + "model": "backrooms:block/office_door_top_right_open", "y": 90 } } diff --git a/src/main/resources/assets/backrooms/blockstates/plate_door.json b/src/main/resources/assets/backrooms/blockstates/plate_door.json index 3852e4b..2caa4d8 100644 --- a/src/main/resources/assets/backrooms/blockstates/plate_door.json +++ b/src/main/resources/assets/backrooms/blockstates/plate_door.json @@ -1,123 +1,123 @@ { "variants": { "facing=east,half=lower,hinge=left,open=false": { - "model": "backrooms:block/plate_door_bottom" + "model": "backrooms:block/plate_door_bottom_left" }, "facing=east,half=lower,hinge=left,open=true": { - "model": "backrooms:block/plate_door_bottom_hinge", + "model": "backrooms:block/plate_door_bottom_left_open", "y": 90 }, "facing=east,half=lower,hinge=right,open=false": { - "model": "backrooms:block/plate_door_bottom_hinge" + "model": "backrooms:block/plate_door_bottom_right" }, "facing=east,half=lower,hinge=right,open=true": { - "model": "backrooms:block/plate_door_bottom", + "model": "backrooms:block/plate_door_bottom_right_open", "y": 270 }, "facing=east,half=upper,hinge=left,open=false": { - "model": "backrooms:block/plate_door_top" + "model": "backrooms:block/plate_door_top_left" }, "facing=east,half=upper,hinge=left,open=true": { - "model": "backrooms:block/plate_door_top_hinge", + "model": "backrooms:block/plate_door_top_left_open", "y": 90 }, "facing=east,half=upper,hinge=right,open=false": { - "model": "backrooms:block/plate_door_top_hinge" + "model": "backrooms:block/plate_door_top_right" }, "facing=east,half=upper,hinge=right,open=true": { - "model": "backrooms:block/plate_door_top", + "model": "backrooms:block/plate_door_top_right_open", "y": 270 }, "facing=north,half=lower,hinge=left,open=false": { - "model": "backrooms:block/plate_door_bottom", + "model": "backrooms:block/plate_door_bottom_left", "y": 270 }, "facing=north,half=lower,hinge=left,open=true": { - "model": "backrooms:block/plate_door_bottom_hinge" + "model": "backrooms:block/plate_door_bottom_left_open" }, "facing=north,half=lower,hinge=right,open=false": { - "model": "backrooms:block/plate_door_bottom_hinge", + "model": "backrooms:block/plate_door_bottom_right", "y": 270 }, "facing=north,half=lower,hinge=right,open=true": { - "model": "backrooms:block/plate_door_bottom", + "model": "backrooms:block/plate_door_bottom_right_open", "y": 180 }, "facing=north,half=upper,hinge=left,open=false": { - "model": "backrooms:block/plate_door_top", + "model": "backrooms:block/plate_door_top_left", "y": 270 }, "facing=north,half=upper,hinge=left,open=true": { - "model": "backrooms:block/plate_door_top_hinge" + "model": "backrooms:block/plate_door_top_left_open" }, "facing=north,half=upper,hinge=right,open=false": { - "model": "backrooms:block/plate_door_top_hinge", + "model": "backrooms:block/plate_door_top_right", "y": 270 }, "facing=north,half=upper,hinge=right,open=true": { - "model": "backrooms:block/plate_door_top", + "model": "backrooms:block/plate_door_top_right_open", "y": 180 }, "facing=south,half=lower,hinge=left,open=false": { - "model": "backrooms:block/plate_door_bottom", + "model": "backrooms:block/plate_door_bottom_left", "y": 90 }, "facing=south,half=lower,hinge=left,open=true": { - "model": "backrooms:block/plate_door_bottom_hinge", + "model": "backrooms:block/plate_door_bottom_left_open", "y": 180 }, "facing=south,half=lower,hinge=right,open=false": { - "model": "backrooms:block/plate_door_bottom_hinge", + "model": "backrooms:block/plate_door_bottom_right", "y": 90 }, "facing=south,half=lower,hinge=right,open=true": { - "model": "backrooms:block/plate_door_bottom" + "model": "backrooms:block/plate_door_bottom_right_open" }, "facing=south,half=upper,hinge=left,open=false": { - "model": "backrooms:block/plate_door_top", + "model": "backrooms:block/plate_door_top_left", "y": 90 }, "facing=south,half=upper,hinge=left,open=true": { - "model": "backrooms:block/plate_door_top_hinge", + "model": "backrooms:block/plate_door_top_left_open", "y": 180 }, "facing=south,half=upper,hinge=right,open=false": { - "model": "backrooms:block/plate_door_top_hinge", + "model": "backrooms:block/plate_door_top_right", "y": 90 }, "facing=south,half=upper,hinge=right,open=true": { - "model": "backrooms:block/plate_door_top" + "model": "backrooms:block/plate_door_top_right_open" }, "facing=west,half=lower,hinge=left,open=false": { - "model": "backrooms:block/plate_door_bottom", + "model": "backrooms:block/plate_door_bottom_left", "y": 180 }, "facing=west,half=lower,hinge=left,open=true": { - "model": "backrooms:block/plate_door_bottom_hinge", + "model": "backrooms:block/plate_door_bottom_left_open", "y": 270 }, "facing=west,half=lower,hinge=right,open=false": { - "model": "backrooms:block/plate_door_bottom_hinge", + "model": "backrooms:block/plate_door_bottom_right", "y": 180 }, "facing=west,half=lower,hinge=right,open=true": { - "model": "backrooms:block/plate_door_bottom", + "model": "backrooms:block/plate_door_bottom_right_open", "y": 90 }, "facing=west,half=upper,hinge=left,open=false": { - "model": "backrooms:block/plate_door_top", + "model": "backrooms:block/plate_door_top_left", "y": 180 }, "facing=west,half=upper,hinge=left,open=true": { - "model": "backrooms:block/plate_door_top_hinge", + "model": "backrooms:block/plate_door_top_left_open", "y": 270 }, "facing=west,half=upper,hinge=right,open=false": { - "model": "backrooms:block/plate_door_top_hinge", + "model": "backrooms:block/plate_door_top_right", "y": 180 }, "facing=west,half=upper,hinge=right,open=true": { - "model": "backrooms:block/plate_door_top", + "model": "backrooms:block/plate_door_top_right_open", "y": 90 } } diff --git a/src/main/resources/assets/backrooms/lang/en_us.json b/src/main/resources/assets/backrooms/lang/en_us.json index e6df9a5..5f05073 100644 --- a/src/main/resources/assets/backrooms/lang/en_us.json +++ b/src/main/resources/assets/backrooms/lang/en_us.json @@ -125,7 +125,7 @@ "text.autoconfig.backrooms.category.Gameplay": "Gameplay", "text.autoconfig.backrooms.category.default": "Default", "text.autoconfig.backrooms.category.Render": "Client", - "text.autoconfig.backrooms.category.Miscellaneous": "Miscellaneous", + "text.autoconfig.backrooms.category.Entities/AI": "Entities/AI", "gamerule.category.backrooms_category": "Backrooms", diff --git a/src/main/resources/assets/backrooms/models/block/colombina_mask.json b/src/main/resources/assets/backrooms/models/block/colombina_mask.json index a2bc4e1..0f0d15a 100644 --- a/src/main/resources/assets/backrooms/models/block/colombina_mask.json +++ b/src/main/resources/assets/backrooms/models/block/colombina_mask.json @@ -2,8 +2,8 @@ "credit": "Made with Blockbench :)", "texture_size": [32, 32], "textures": { - "1": "backrooms:armor/colombina_mask", - "particle": "backrooms:armor/colombina_mask" + "1": "backrooms:block/colombina_mask", + "particle": "backrooms:block/colombina_mask" }, "elements": [ { diff --git a/src/main/resources/assets/backrooms/models/block/cracked_pipe_ew.json b/src/main/resources/assets/backrooms/models/block/cracked_pipe_ew.json index bee8f59..27e85c2 100644 --- a/src/main/resources/assets/backrooms/models/block/cracked_pipe_ew.json +++ b/src/main/resources/assets/backrooms/models/block/cracked_pipe_ew.json @@ -3,7 +3,7 @@ "textures": { "0": "backrooms:block/cracked_pipe_middle", "1": "backrooms:block/cracked_pipe", - "particle": "backrooms:cracked_block/pipe" + "particle": "backrooms:block/cracked_pipe" }, "elements": [ { diff --git a/src/main/resources/assets/backrooms/models/block/cracked_pipe_ns.json b/src/main/resources/assets/backrooms/models/block/cracked_pipe_ns.json index 8ec901e..041f64e 100644 --- a/src/main/resources/assets/backrooms/models/block/cracked_pipe_ns.json +++ b/src/main/resources/assets/backrooms/models/block/cracked_pipe_ns.json @@ -3,7 +3,7 @@ "textures": { "0": "backrooms:block/cracked_pipe_middle", "1": "backrooms:block/cracked_pipe", - "particle": "backrooms:cracked_block/pipe" + "particle": "backrooms:block/cracked_pipe" }, "elements": [ { diff --git a/src/main/resources/assets/backrooms/models/block/harlequin_mask.json b/src/main/resources/assets/backrooms/models/block/harlequin_mask.json index 0ac99ad..e43411e 100644 --- a/src/main/resources/assets/backrooms/models/block/harlequin_mask.json +++ b/src/main/resources/assets/backrooms/models/block/harlequin_mask.json @@ -2,8 +2,8 @@ "credit": "Made with Blockbench :)", "texture_size": [32, 32], "textures": { - "0": "backrooms:armor/harlequin_mask", - "particle": "backrooms:armor/harlequin_mask" + "0": "backrooms:block/harlequin_mask", + "particle": "backrooms:block/harlequin_mask" }, "elements": [ { diff --git a/src/main/resources/assets/backrooms/models/block/office_door_bottom.json b/src/main/resources/assets/backrooms/models/block/office_door_bottom.json deleted file mode 100644 index 2fcfc87..0000000 --- a/src/main/resources/assets/backrooms/models/block/office_door_bottom.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "minecraft:block/door_bottom", - "textures": { - "top": "backrooms:block/office_door_top", - "bottom": "backrooms:block/office_door_bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/office_door_bottom_hinge.json b/src/main/resources/assets/backrooms/models/block/office_door_bottom_hinge.json deleted file mode 100644 index b409d9f..0000000 --- a/src/main/resources/assets/backrooms/models/block/office_door_bottom_hinge.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "minecraft:block/door_bottom_rh", - "textures": { - "top": "backrooms:block/office_door_top", - "bottom": "backrooms:block/office_door_bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/office_door_bottom_left.json b/src/main/resources/assets/backrooms/models/block/office_door_bottom_left.json new file mode 100644 index 0000000..ace62a6 --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/office_door_bottom_left.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_left", + "textures": { + "bottom": "backrooms:block/office_door_bottom", + "top": "backrooms:block/office_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/office_door_bottom_left_open.json b/src/main/resources/assets/backrooms/models/block/office_door_bottom_left_open.json new file mode 100644 index 0000000..f7e8610 --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/office_door_bottom_left_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_left_open", + "textures": { + "bottom": "backrooms:block/office_door_bottom", + "top": "backrooms:block/office_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/office_door_bottom_right.json b/src/main/resources/assets/backrooms/models/block/office_door_bottom_right.json new file mode 100644 index 0000000..970c79a --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/office_door_bottom_right.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_right", + "textures": { + "bottom": "backrooms:block/office_door_bottom", + "top": "backrooms:block/office_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/office_door_bottom_right_open.json b/src/main/resources/assets/backrooms/models/block/office_door_bottom_right_open.json new file mode 100644 index 0000000..5fb8364 --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/office_door_bottom_right_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_right_open", + "textures": { + "bottom": "backrooms:block/office_door_bottom", + "top": "backrooms:block/office_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/office_door_top.json b/src/main/resources/assets/backrooms/models/block/office_door_top.json deleted file mode 100644 index 7677760..0000000 --- a/src/main/resources/assets/backrooms/models/block/office_door_top.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "minecraft:block/door_top", - "textures": { - "top": "backrooms:block/office_door_top", - "bottom": "backrooms:block/office_door_bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/office_door_top_hinge.json b/src/main/resources/assets/backrooms/models/block/office_door_top_hinge.json deleted file mode 100644 index 4ea54fc..0000000 --- a/src/main/resources/assets/backrooms/models/block/office_door_top_hinge.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "minecraft:block/door_top_rh", - "textures": { - "top": "backrooms:block/office_door_top", - "bottom": "backrooms:block/office_door_bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/office_door_top_left.json b/src/main/resources/assets/backrooms/models/block/office_door_top_left.json new file mode 100644 index 0000000..31d3a90 --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/office_door_top_left.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_left", + "textures": { + "bottom": "backrooms:block/office_door_bottom", + "top": "backrooms:block/office_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/office_door_top_left_open.json b/src/main/resources/assets/backrooms/models/block/office_door_top_left_open.json new file mode 100644 index 0000000..5dc50ca --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/office_door_top_left_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_left_open", + "textures": { + "bottom": "backrooms:block/office_door_bottom", + "top": "backrooms:block/office_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/office_door_top_right.json b/src/main/resources/assets/backrooms/models/block/office_door_top_right.json new file mode 100644 index 0000000..1e05bd6 --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/office_door_top_right.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_right", + "textures": { + "bottom": "backrooms:block/office_door_bottom", + "top": "backrooms:block/office_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/office_door_top_right_open.json b/src/main/resources/assets/backrooms/models/block/office_door_top_right_open.json new file mode 100644 index 0000000..ac3cdef --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/office_door_top_right_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_right_open", + "textures": { + "bottom": "backrooms:block/office_door_bottom", + "top": "backrooms:block/office_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/plate_door_bottom.json b/src/main/resources/assets/backrooms/models/block/plate_door_bottom.json deleted file mode 100644 index b56851a..0000000 --- a/src/main/resources/assets/backrooms/models/block/plate_door_bottom.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "minecraft:block/door_bottom", - "textures": { - "top": "backrooms:block/plate_door_top", - "bottom": "backrooms:block/plate_door_bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/plate_door_bottom_hinge.json b/src/main/resources/assets/backrooms/models/block/plate_door_bottom_hinge.json deleted file mode 100644 index b69aa6b..0000000 --- a/src/main/resources/assets/backrooms/models/block/plate_door_bottom_hinge.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "minecraft:block/door_bottom_rh", - "textures": { - "top": "backrooms:block/plate_door_top", - "bottom": "backrooms:block/plate_door_bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/plate_door_bottom_left.json b/src/main/resources/assets/backrooms/models/block/plate_door_bottom_left.json new file mode 100644 index 0000000..af35ec4 --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/plate_door_bottom_left.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_left", + "textures": { + "bottom": "backrooms:block/plate_door_bottom", + "top": "backrooms:block/plate_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/plate_door_bottom_left_open.json b/src/main/resources/assets/backrooms/models/block/plate_door_bottom_left_open.json new file mode 100644 index 0000000..55b8525 --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/plate_door_bottom_left_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_left_open", + "textures": { + "bottom": "backrooms:block/plate_door_bottom", + "top": "backrooms:block/plate_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/plate_door_bottom_right.json b/src/main/resources/assets/backrooms/models/block/plate_door_bottom_right.json new file mode 100644 index 0000000..cf362ce --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/plate_door_bottom_right.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_right", + "textures": { + "bottom": "backrooms:block/plate_door_bottom", + "top": "backrooms:block/plate_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/plate_door_bottom_right_open.json b/src/main/resources/assets/backrooms/models/block/plate_door_bottom_right_open.json new file mode 100644 index 0000000..c0c1b03 --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/plate_door_bottom_right_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_right_open", + "textures": { + "bottom": "backrooms:block/plate_door_bottom", + "top": "backrooms:block/plate_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/plate_door_top.json b/src/main/resources/assets/backrooms/models/block/plate_door_top.json deleted file mode 100644 index 8ac29b8..0000000 --- a/src/main/resources/assets/backrooms/models/block/plate_door_top.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "minecraft:block/door_top", - "textures": { - "top": "backrooms:block/plate_door_top", - "bottom": "backrooms:block/plate_door_bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/plate_door_top_hinge.json b/src/main/resources/assets/backrooms/models/block/plate_door_top_hinge.json deleted file mode 100644 index d22d1f4..0000000 --- a/src/main/resources/assets/backrooms/models/block/plate_door_top_hinge.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "parent": "minecraft:block/door_top_rh", - "textures": { - "top": "backrooms:block/plate_door_top", - "bottom": "backrooms:block/plate_door_bottom" - } -} \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/plate_door_top_left.json b/src/main/resources/assets/backrooms/models/block/plate_door_top_left.json new file mode 100644 index 0000000..e51ceb9 --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/plate_door_top_left.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_left", + "textures": { + "bottom": "backrooms:block/plate_door_bottom", + "top": "backrooms:block/plate_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/plate_door_top_left_open.json b/src/main/resources/assets/backrooms/models/block/plate_door_top_left_open.json new file mode 100644 index 0000000..405d4b4 --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/plate_door_top_left_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_left_open", + "textures": { + "bottom": "backrooms:block/plate_door_bottom", + "top": "backrooms:block/plate_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/plate_door_top_right.json b/src/main/resources/assets/backrooms/models/block/plate_door_top_right.json new file mode 100644 index 0000000..2b33d0d --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/plate_door_top_right.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_right", + "textures": { + "bottom": "backrooms:block/plate_door_bottom", + "top": "backrooms:block/plate_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/plate_door_top_right_open.json b/src/main/resources/assets/backrooms/models/block/plate_door_top_right_open.json new file mode 100644 index 0000000..35f3d11 --- /dev/null +++ b/src/main/resources/assets/backrooms/models/block/plate_door_top_right_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_right_open", + "textures": { + "bottom": "backrooms:block/plate_door_bottom", + "top": "backrooms:block/plate_door_top" + } + } \ No newline at end of file diff --git a/src/main/resources/assets/backrooms/models/block/sock_buskin_mask.json b/src/main/resources/assets/backrooms/models/block/sock_buskin_mask.json index e96791e..c37ddae 100644 --- a/src/main/resources/assets/backrooms/models/block/sock_buskin_mask.json +++ b/src/main/resources/assets/backrooms/models/block/sock_buskin_mask.json @@ -2,8 +2,8 @@ "credit": "Made with Blockbench", "texture_size": [32, 32], "textures": { - "0": "backrooms:armor/sock_buskin_mask", - "particle": "backrooms:armor/sock_buskin_mask" + "0": "backrooms:block/sock_buskin_mask", + "particle": "backrooms:block/sock_buskin_mask" }, "elements": [ { diff --git a/src/main/resources/assets/backrooms/textures/armor/colombina_mask.png b/src/main/resources/assets/backrooms/textures/block/colombina_mask.png similarity index 100% rename from src/main/resources/assets/backrooms/textures/armor/colombina_mask.png rename to src/main/resources/assets/backrooms/textures/block/colombina_mask.png diff --git a/src/main/resources/assets/backrooms/textures/armor/harlequin_mask.png b/src/main/resources/assets/backrooms/textures/block/harlequin_mask.png similarity index 100% rename from src/main/resources/assets/backrooms/textures/armor/harlequin_mask.png rename to src/main/resources/assets/backrooms/textures/block/harlequin_mask.png diff --git a/src/main/resources/assets/backrooms/textures/armor/sock_buskin_mask.png b/src/main/resources/assets/backrooms/textures/block/sock_buskin_mask.png similarity index 100% rename from src/main/resources/assets/backrooms/textures/armor/sock_buskin_mask.png rename to src/main/resources/assets/backrooms/textures/block/sock_buskin_mask.png diff --git a/src/main/resources/assets/backrooms/textures/block/wiring_edge.png b/src/main/resources/assets/backrooms/textures/block/wiring_edge.png index b0915f21b72876ed7b00638e9cb8c8269fe49dca..8cc8c1c2a3fe884a90be30d4fa8a2d73722209c2 100644 GIT binary patch delta 102 zcmbQsSgF_<;OEZECB?dBG16472y85}Sb4q9e06O3y!~g&Q diff --git a/src/main/resources/data/backrooms/damage_type/wretched_cycle.json b/src/main/resources/data/backrooms/damage_type/wretched_cycle.json new file mode 100644 index 0000000..6076e3a --- /dev/null +++ b/src/main/resources/data/backrooms/damage_type/wretched_cycle.json @@ -0,0 +1,7 @@ +{ + "bypasses_armor": true, + "out_of_world": true, + "exhaustion": 0.0, + "message_id": "wretched_cycle", + "scaling": "never" + } \ No newline at end of file diff --git a/src/main/resources/data/backrooms/dimension_type/level_0_type.json b/src/main/resources/data/backrooms/dimension_type/level_0_type.json index 8223529..e79765b 100644 --- a/src/main/resources/data/backrooms/dimension_type/level_0_type.json +++ b/src/main/resources/data/backrooms/dimension_type/level_0_type.json @@ -14,5 +14,7 @@ "piglin_safe" : false, "height": 128, "min_y": 0, - "effects": "minecraft:overworld" + "effects": "minecraft:overworld", + "monster_spawn_block_light_limit": 0, + "monster_spawn_light_level": 0 } \ No newline at end of file diff --git a/src/main/resources/data/backrooms/dimension_type/level_1_type.json b/src/main/resources/data/backrooms/dimension_type/level_1_type.json index 3d557a7..8f04ef2 100644 --- a/src/main/resources/data/backrooms/dimension_type/level_1_type.json +++ b/src/main/resources/data/backrooms/dimension_type/level_1_type.json @@ -7,12 +7,14 @@ "has_ceiling": false, "fixed_time": 18000, "infiniburn": "#minecraft:infiniburn_overworld", - "logical_height" : 128, + "logical_height" : 64, "has_raids" : false, "respawn_anchor_works": false, "bed_works" : true, "piglin_safe" : false, - "height": 128, + "height": 64, "min_y": 0, - "effects": "minecraft:overworld" + "effects": "minecraft:overworld", + "monster_spawn_block_light_limit": 0, + "monster_spawn_light_level": 0 } \ No newline at end of file diff --git a/src/main/resources/data/backrooms/dimension_type/level_2_type.json b/src/main/resources/data/backrooms/dimension_type/level_2_type.json index 3d557a7..e061399 100644 --- a/src/main/resources/data/backrooms/dimension_type/level_2_type.json +++ b/src/main/resources/data/backrooms/dimension_type/level_2_type.json @@ -14,5 +14,7 @@ "piglin_safe" : false, "height": 128, "min_y": 0, - "effects": "minecraft:overworld" + "effects": "minecraft:overworld", + "monster_spawn_block_light_limit": 0, + "monster_spawn_light_level": 0 } \ No newline at end of file diff --git a/src/main/resources/data/backrooms/dimension_type/level_3_type.json b/src/main/resources/data/backrooms/dimension_type/level_3_type.json index 14b1e94..749998b 100644 --- a/src/main/resources/data/backrooms/dimension_type/level_3_type.json +++ b/src/main/resources/data/backrooms/dimension_type/level_3_type.json @@ -14,5 +14,7 @@ "piglin_safe" : false, "height": 128, "min_y": 0, - "effects": "minecraft:overworld" + "effects": "minecraft:overworld", + "monster_spawn_block_light_limit": 0, + "monster_spawn_light_level": 0 } \ No newline at end of file diff --git a/src/main/resources/data/backrooms/worldgen/biome/cement_walls.json b/src/main/resources/data/backrooms/worldgen/biome/cement_walls.json new file mode 100644 index 0000000..db46d7c --- /dev/null +++ b/src/main/resources/data/backrooms/worldgen/biome/cement_walls.json @@ -0,0 +1,26 @@ +{ + "temperature": 0.8, + "downfall": 1, + "has_precipitation": false, + "effects": { + "sky_color": 10921378, + "fog_color": 10921378, + "water_color": 10921378, + "water_fog_color": 16735821, + "grass_color": 13818488 + }, + "spawners": { + "creature": [ + { + "type": "backrooms:hound", + "weight": 100, + "minCount": 1, + "maxCount": 1 + } + ] + }, + "spawn_costs": {}, + "carvers": {}, + "features": [] + } + \ No newline at end of file diff --git a/src/main/resources/data/backrooms/worldgen/biome/crimson_walls.json b/src/main/resources/data/backrooms/worldgen/biome/crimson_walls.json new file mode 100644 index 0000000..da45b0f --- /dev/null +++ b/src/main/resources/data/backrooms/worldgen/biome/crimson_walls.json @@ -0,0 +1,26 @@ +{ + "temperature": 0.8, + "downfall": 1, + "has_precipitation": false, + "effects": { + "sky_color": 13776695, + "fog_color": 11548232, + "water_color": 13548960, + "water_fog_color": 16735821, + "ambient_sound": "backrooms:humbuzz" + }, + "spawners": { + "creature": [ + { + "type": "backrooms:hound", + "weight": 100, + "minCount": 1, + "maxCount": 1 + } + ] + }, + "spawn_costs": {}, + "carvers": {}, + "features": [] + } + \ No newline at end of file diff --git a/src/main/resources/data/backrooms/worldgen/biome/decrepit.json b/src/main/resources/data/backrooms/worldgen/biome/decrepit.json new file mode 100644 index 0000000..c8df9f6 --- /dev/null +++ b/src/main/resources/data/backrooms/worldgen/biome/decrepit.json @@ -0,0 +1,26 @@ +{ + "temperature": 0.8, + "downfall": 1, + "has_precipitation": false, + "effects": { + "sky_color": 13548960, + "fog_color": 13548960, + "water_color": 13548960, + "water_fog_color": 13548960, + "grass_color": 13818488 + }, + "spawners": { + "creature": [ + { + "type": "backrooms:hound", + "weight": 100, + "minCount": 1, + "maxCount": 1 + } + ] + }, + "spawn_costs": {}, + "carvers": {}, + "features": [] + } + \ No newline at end of file diff --git a/src/main/resources/data/backrooms/worldgen/biome/electrical_station.json b/src/main/resources/data/backrooms/worldgen/biome/electrical_station.json new file mode 100644 index 0000000..7fb2cdc --- /dev/null +++ b/src/main/resources/data/backrooms/worldgen/biome/electrical_station.json @@ -0,0 +1,26 @@ +{ + "temperature": 15, + "downfall": 0, + "has_precipitation": false, + "effects": { + "sky_color": 2368548, + "fog_color": 2368548, + "water_color": 13548960, + "water_fog_color": 13548960, + "grass_color": 13818488 + }, + "spawners": { + "creature": [ + { + "type": "backrooms:hound", + "weight": 100, + "minCount": 1, + "maxCount": 1 + } + ] + }, + "spawn_costs": {}, + "carvers": {}, + "features": [] + } + \ No newline at end of file diff --git a/src/main/resources/data/backrooms/worldgen/biome/megalophobia.json b/src/main/resources/data/backrooms/worldgen/biome/megalophobia.json new file mode 100644 index 0000000..b16e52b --- /dev/null +++ b/src/main/resources/data/backrooms/worldgen/biome/megalophobia.json @@ -0,0 +1,18 @@ +{ + "temperature": 0.8, + "downfall": 0, + "has_precipitation": false, + "effects": { + "sky_color": 13548960, + "fog_color": 13548960, + "water_color": 13548960, + "water_fog_color": 13548960, + "grass_color": 13818488, + "ambient_sound": "backrooms:humbuzz" + }, + "spawners": {}, + "spawn_costs": {}, + "carvers": {}, + "features": [] + } + \ No newline at end of file diff --git a/src/main/resources/data/backrooms/worldgen/biome/parking_garage.json b/src/main/resources/data/backrooms/worldgen/biome/parking_garage.json new file mode 100644 index 0000000..db46d7c --- /dev/null +++ b/src/main/resources/data/backrooms/worldgen/biome/parking_garage.json @@ -0,0 +1,26 @@ +{ + "temperature": 0.8, + "downfall": 1, + "has_precipitation": false, + "effects": { + "sky_color": 10921378, + "fog_color": 10921378, + "water_color": 10921378, + "water_fog_color": 16735821, + "grass_color": 13818488 + }, + "spawners": { + "creature": [ + { + "type": "backrooms:hound", + "weight": 100, + "minCount": 1, + "maxCount": 1 + } + ] + }, + "spawn_costs": {}, + "carvers": {}, + "features": [] + } + \ No newline at end of file diff --git a/src/main/resources/data/backrooms/worldgen/biome/pipes.json b/src/main/resources/data/backrooms/worldgen/biome/pipes.json new file mode 100644 index 0000000..51c3368 --- /dev/null +++ b/src/main/resources/data/backrooms/worldgen/biome/pipes.json @@ -0,0 +1,17 @@ +{ + "temperature": 15, + "downfall": 0, + "has_precipitation": false, + "effects": { + "sky_color": 2368548, + "fog_color": 2368548, + "water_color": 13548960, + "water_fog_color": 13548960, + "grass_color": 13818488 + }, + "spawners": {}, + "spawn_costs": {}, + "carvers": {}, + "features": [] + } + \ No newline at end of file diff --git a/src/main/resources/data/backrooms/worldgen/biome/warehouse.json b/src/main/resources/data/backrooms/worldgen/biome/warehouse.json new file mode 100644 index 0000000..db46d7c --- /dev/null +++ b/src/main/resources/data/backrooms/worldgen/biome/warehouse.json @@ -0,0 +1,26 @@ +{ + "temperature": 0.8, + "downfall": 1, + "has_precipitation": false, + "effects": { + "sky_color": 10921378, + "fog_color": 10921378, + "water_color": 10921378, + "water_fog_color": 16735821, + "grass_color": 13818488 + }, + "spawners": { + "creature": [ + { + "type": "backrooms:hound", + "weight": 100, + "minCount": 1, + "maxCount": 1 + } + ] + }, + "spawn_costs": {}, + "carvers": {}, + "features": [] + } + \ No newline at end of file diff --git a/src/main/resources/data/backrooms/worldgen/biome/yellow_walls.json b/src/main/resources/data/backrooms/worldgen/biome/yellow_walls.json new file mode 100644 index 0000000..b16e52b --- /dev/null +++ b/src/main/resources/data/backrooms/worldgen/biome/yellow_walls.json @@ -0,0 +1,18 @@ +{ + "temperature": 0.8, + "downfall": 0, + "has_precipitation": false, + "effects": { + "sky_color": 13548960, + "fog_color": 13548960, + "water_color": 13548960, + "water_fog_color": 13548960, + "grass_color": 13818488, + "ambient_sound": "backrooms:humbuzz" + }, + "spawners": {}, + "spawn_costs": {}, + "carvers": {}, + "features": [] + } + \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d517910..3908884 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -47,10 +47,10 @@ "backrooms.mixins.json" ], "depends": { - "fabricloader": ">=0.14.6", + "fabricloader": ">=0.15.11", "fabric-key-binding-api-v1": "*", "fabric": "*", - "minecraft": "1.18.2", + "minecraft": "~1.20.1", "java": ">=17" }, "custom": {