diff --git a/bin/main/assets/backrooms/lang/en_us.json b/bin/main/assets/backrooms/lang/en_us.json index 939a1bc..db73912 100644 --- a/bin/main/assets/backrooms/lang/en_us.json +++ b/bin/main/assets/backrooms/lang/en_us.json @@ -58,11 +58,16 @@ "block.backrooms.dotted_red_torn_wallpaper": "Torn Dotted Red Wallpaper", "block.backrooms.vent": "Vent", "biome.backrooms.level0": "Level 0", + "biome.backrooms.level0decrepit": "Level 0 Decrepit", + "biome.backrooms.level0dotted": "Level 0 Dotted", + "biome.backrooms.level0red": "Level 0 Red", + "biome.backrooms.level0dottedred": "Level 0 Dotted Red", "biome.backrooms.level1": "Level 1", + "biome.backrooms.level1off": "Level 1 Off", "biome.backrooms.level2": "Level 2", + "biome.backrooms.level2long": "Level 2 Long", + "biome.backrooms.level2messy": "Level 2 Messy", "biome.backrooms.level3": "Level 3", - "biome.backrooms.level0red": "The Redrooms", - "biome.backrooms.level0dotted": "Level 0 Dotted", "block.buzz": "Buzz", "music.general.menu": "Backrooms Menu", "menu.switch": "§cSwitch", @@ -131,17 +136,19 @@ "text.autoconfig.backrooms.title": "Backrooms Configurations", "text.autoconfig.backrooms.option.Level0DoorChance": "Chance for door to appear in level 0", "text.autoconfig.backrooms.option.Level1DoorChance": "Chance for door to appear in level 1", + "text.autoconfig.backrooms.option.Level3DoorChance": "Chance for door to appear in level 3", "text.autoconfig.backrooms.option.Level0LayerCount": "How many Layers in level 0", "text.autoconfig.backrooms.option.Level1LayerCount": "How many Layers in level 1", "text.autoconfig.backrooms.option.VBDoor": "Chance for the void block to appear in a door", "text.autoconfig.backrooms.option.EnderPearlChance": "Chance for an enderpearl", "text.autoconfig.backrooms.option.SuffocationChance": "Chance for suffocation", "text.autoconfig.backrooms.option.ChestSpawnChance": "Chance for a chest to spawn", + "text.autoconfig.backrooms.option.SearchRange": "Search Range For Noise Making Blocks", "text.autoconfig.backrooms.option.ForceLevel0": "Forces title screen to stay as Level 0", "text.autoconfig.backrooms.option.ForceLevel1": "Forces title screen to stay as Level 1", "text.autoconfig.backrooms.option.ForceLevel2": "Forces title screen to stay as Level 2", "text.autoconfig.backrooms.option.ForceLevel3": "Forces title screen to stay as Level 3", "text.autoconfig.backrooms.option.ForceNormal": "Forces title screen to stay as it should be", - "text.autoconfig.backrooms.option.SanityEffects": "Sanity Effects", + "text.autoconfig.backrooms.option.SanityEffects": "(Currently not in use) Sanity Effects", "text.autoconfig.backrooms.option.TallDoors": "Have doors be ever so slightly taller" } diff --git a/bin/main/assets/backrooms/sounds.json b/bin/main/assets/backrooms/sounds.json index 5cc3b0e..e701dcb 100644 --- a/bin/main/assets/backrooms/sounds.json +++ b/bin/main/assets/backrooms/sounds.json @@ -248,81 +248,80 @@ } ] }, - "buzz": { + "humm_buzz": { "sounds": [ { - "name": "backrooms:buzz" - } - ] - }, - "gulp": { - "sounds": [ + "name": "backrooms:level_noise/buzz1" + }, { - "name": "backrooms:gulp/gulp1" + "name": "backrooms:level_noise/buzz2" }, { - "name": "backrooms:gulp/gulp2" + "name": "backrooms:level_noise/buzz3" }, { - "name": "backrooms:gulp/gulp3" + "name": "backrooms:level_noise/buzz4" } ] }, - "level.0.ambience": { + "humm_buzz_around": { "sounds": [ { - "name": "backrooms:ambient/breath1" + "name": "backrooms:level_noise/buzz_around1" }, { - "name": "backrooms:ambient/breath2" + "name": "backrooms:level_noise/buzz_around2" }, { - "name": "backrooms:ambient/breath3" + "name": "backrooms:level_noise/buzz_around3" }, { - "name": "backrooms:ambient/breath4" - }, - { - "name": "backrooms:ambient/harp1" - }, - { - "name": "backrooms:ambient/harp2" - }, - { - "name": "backrooms:ambient/harp3" - }, + "name": "backrooms:level_noise/buzz_around4" + } + ] + }, + "vent": { + "sounds": [ { - "name": "backrooms:ambient/knock1" + "name": "backrooms:level_noise/vent1" }, { - "name": "backrooms:ambient/knock2" + "name": "backrooms:level_noise/vent2" }, { - "name": "backrooms:ambient/knock3" + "name": "backrooms:level_noise/vent3" }, { - "name": "backrooms:ambient/synth1" - }, + "name": "backrooms:level_noise/vent4" + } + ] + }, + "sizzle": { + "sounds": [ { - "name": "backrooms:ambient/synth2" + "name": "backrooms:level_noise/sizzle1" }, { - "name": "backrooms:ambient/synth3" + "name": "backrooms:level_noise/sizzle2" }, { - "name": "backrooms:ambient/tone1" + "name": "backrooms:level_noise/sizzle3" }, { - "name": "backrooms:ambient/tone2" - }, + "name": "backrooms:level_noise/sizzle4" + } + ] + }, + "gulp": { + "sounds": [ { - "name": "backrooms:ambient/tone3" + "name": "backrooms:gulp/gulp1" }, { - "name": "backrooms:ambient/tone4" + "name": "backrooms:gulp/gulp2" }, { - "name": "backrooms:ambient/whistle1" + "name": "backrooms:gulp/gulp3" } ] } diff --git a/bin/main/backrooms.mixins.json b/bin/main/backrooms.mixins.json index 8e51f94..68efe34 100644 --- a/bin/main/backrooms.mixins.json +++ b/bin/main/backrooms.mixins.json @@ -10,7 +10,8 @@ "client": [ "BuiltinModelItemRendererMixin", "MusicMixin", - "TitleScreenMixin" + "TitleScreenMixin", + "WorldAccessor" ], "injectors": { "defaultRequire": 1 diff --git a/bin/main/fabric.mod.json b/bin/main/fabric.mod.json index f205f76..8d9f6c1 100644 --- a/bin/main/fabric.mod.json +++ b/bin/main/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "backrooms", - "version": "1.2.2", + "version": "$version", "name": "The Backrooms", "description": "The backrooms, endless mono yellow rooms to traverse.", "authors": [ diff --git a/bin/main/net/ludocrypt/backrooms/BackroomsClient.class b/bin/main/net/ludocrypt/backrooms/BackroomsClient.class index faebd68..8ae4b04 100644 Binary files a/bin/main/net/ludocrypt/backrooms/BackroomsClient.class and b/bin/main/net/ludocrypt/backrooms/BackroomsClient.class differ diff --git a/bin/main/net/ludocrypt/backrooms/config/BackroomsConfig.class b/bin/main/net/ludocrypt/backrooms/config/BackroomsConfig.class index 45e765d..73c3a55 100644 Binary files a/bin/main/net/ludocrypt/backrooms/config/BackroomsConfig.class and b/bin/main/net/ludocrypt/backrooms/config/BackroomsConfig.class differ diff --git a/bin/main/net/ludocrypt/backrooms/features/Level0DottedRoom.class b/bin/main/net/ludocrypt/backrooms/features/Level0DottedRoom.class index 5b22244..dc7a980 100644 Binary files a/bin/main/net/ludocrypt/backrooms/features/Level0DottedRoom.class and b/bin/main/net/ludocrypt/backrooms/features/Level0DottedRoom.class differ diff --git a/bin/main/net/ludocrypt/backrooms/features/Level0RedRoom.class b/bin/main/net/ludocrypt/backrooms/features/Level0RedRoom.class index 0c5823d..c341ff4 100644 Binary files a/bin/main/net/ludocrypt/backrooms/features/Level0RedRoom.class and b/bin/main/net/ludocrypt/backrooms/features/Level0RedRoom.class differ diff --git a/bin/main/net/ludocrypt/backrooms/features/Level0Room.class b/bin/main/net/ludocrypt/backrooms/features/Level0Room.class index efc024d..f742b14 100644 Binary files a/bin/main/net/ludocrypt/backrooms/features/Level0Room.class and b/bin/main/net/ludocrypt/backrooms/features/Level0Room.class differ diff --git a/bin/main/net/ludocrypt/backrooms/features/Level1Room.class b/bin/main/net/ludocrypt/backrooms/features/Level1Room.class index 3d729e2..75c4909 100644 Binary files a/bin/main/net/ludocrypt/backrooms/features/Level1Room.class and b/bin/main/net/ludocrypt/backrooms/features/Level1Room.class differ diff --git a/bin/main/net/ludocrypt/backrooms/features/Level3Room.class b/bin/main/net/ludocrypt/backrooms/features/Level3Room.class index d1e880f..db0adc0 100644 Binary files a/bin/main/net/ludocrypt/backrooms/features/Level3Room.class and b/bin/main/net/ludocrypt/backrooms/features/Level3Room.class differ diff --git a/bin/main/net/ludocrypt/backrooms/features/LevelsFeatureInit.class b/bin/main/net/ludocrypt/backrooms/features/LevelsFeatureInit.class index 738fc11..d241c99 100644 Binary files a/bin/main/net/ludocrypt/backrooms/features/LevelsFeatureInit.class and b/bin/main/net/ludocrypt/backrooms/features/LevelsFeatureInit.class differ diff --git a/bin/main/net/ludocrypt/backrooms/misc/BackroomsSoundEvents.class b/bin/main/net/ludocrypt/backrooms/misc/BackroomsSoundEvents.class index 58dcfb9..70d784a 100644 Binary files a/bin/main/net/ludocrypt/backrooms/misc/BackroomsSoundEvents.class and b/bin/main/net/ludocrypt/backrooms/misc/BackroomsSoundEvents.class differ diff --git a/build.gradle b/build.gradle index a00fa95..dca895e 100644 --- a/build.gradle +++ b/build.gradle @@ -27,19 +27,19 @@ repositories { dependencies { - minecraft "com.mojang:minecraft:1.16.2" - mappings "net.fabricmc:yarn:1.16.2+build.9:v2" - modImplementation "net.fabricmc:fabric-loader:0.9.1+build.205" - modImplementation "net.fabricmc.fabric-api:fabric-api:0.17.2+build.396-1.16" - modApi("me.shedaniel.cloth:config-2:4.7.0-unstable") { + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + modApi("me.shedaniel.cloth:config-2:4.8.1") { exclude(group: "net.fabricmc.fabric-api") } - include "me.shedaniel.cloth:config-2:4.7.0-unstable" - modApi "me.sargunvohra.mcmods:autoconfig1u:3.2.0-unstable" - include "me.sargunvohra.mcmods:autoconfig1u:3.2.0-unstable" + include "me.shedaniel.cloth:config-2:4.8.1" + modApi "me.sargunvohra.mcmods:autoconfig1u:3.2.2" + include "me.sargunvohra.mcmods:autoconfig1u:3.2.2" modImplementation "io.github.prospector:modmenu:1.14.6+build.31" include(modImplementation('com.github.Chocohead:Fabric-ASM:v2.1')) - include(modImplementation('com.github.rdvdev2:DisableCustomWorldsAdvice:v1.0')) + modImplementation 'com.github.grondag:darkness:1.16-SNAPSHOT' } processResources { diff --git a/gradle.properties b/gradle.properties index f07567b..ee84eee 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ org.gradle.jvmargs=-Xmx2G -mod_version = 1.2.3 +mod_version = 1.3.0 maven_group = net.ludocrypt archives_base_name = the-backrooms -minecraft_version=1.16.2 -yarn_mappings=1.16.2+build.9 -loader_version=0.9.1+build.205 -fabric_version=0.17.2+build.396-1.16 +minecraft_version=1.16.3 +yarn_mappings=1.16.3+build.7 +loader_version=0.9.3+build.207 +fabric_version=0.20.2+build.402-1.16 diff --git a/src/main/java/net/ludocrypt/backrooms/BackroomsClient.java b/src/main/java/net/ludocrypt/backrooms/BackroomsClient.java index 83940b7..def62dd 100644 --- a/src/main/java/net/ludocrypt/backrooms/BackroomsClient.java +++ b/src/main/java/net/ludocrypt/backrooms/BackroomsClient.java @@ -7,10 +7,13 @@ import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry; import net.ludocrypt.backrooms.client.render.block.entity.VoidBlockEntityRenderer; +import net.ludocrypt.backrooms.misc.BuzzHandler; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.RenderLayer; import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; import net.minecraft.client.render.block.entity.BlockEntityRenderer; @@ -24,7 +27,8 @@ public class BackroomsClient implements ClientModInitializer { @Override public void onInitializeClient() { registerBlockEntityRenderer("void_block", VoidBlockEntityRenderer::new); - + ClientTickEvents.START_CLIENT_TICK.register(BackroomsClient::clientTickEvent); + } public static void putItemRenderLayer(Item item, RenderLayer layer) { @@ -38,9 +42,15 @@ public static RenderLayer getItemRenderLayer(Item item) { @SuppressWarnings("unchecked") private void registerBlockEntityRenderer(String identifier, Function> blockEntityRenderer) { - BlockEntityRendererRegistry.INSTANCE.register((BlockEntityType) Registry.BLOCK_ENTITY_TYPE.get(Backrooms.getId(identifier)), blockEntityRenderer); + BlockEntityRendererRegistry.INSTANCE.register( + (BlockEntityType) Registry.BLOCK_ENTITY_TYPE.get(Backrooms.getId(identifier)), blockEntityRenderer); + } + + public static void clientTickEvent(MinecraftClient minecraft) { + if (minecraft.world != null) { + BuzzHandler.buzzCheckingAndRunning(minecraft.gameRenderer.getCamera(), minecraft, minecraft.worldRenderer, + minecraft.world); + } } - - } diff --git a/src/main/java/net/ludocrypt/backrooms/biome/BkBiomes.java b/src/main/java/net/ludocrypt/backrooms/biome/BkBiomes.java index 32b7405..3b53d3e 100644 --- a/src/main/java/net/ludocrypt/backrooms/biome/BkBiomes.java +++ b/src/main/java/net/ludocrypt/backrooms/biome/BkBiomes.java @@ -27,10 +27,7 @@ public static Biome Level0() { .surfaceBuilder(ConfiguratedSurfaceBuilders.LEVELBUILDER) .feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, LevelsFeatureInit.LEVEL0ROOM.configure(FeatureConfig.DEFAULT) - .decorate(LevelsFeatureInit.LEVEL0DECORATOR.configure(DecoratorConfig.DEFAULT))) - .feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, - LevelsFeatureInit.LEVEL01ROOF.configure(FeatureConfig.DEFAULT) - .decorate(LevelsFeatureInit.LEVEL01ROOFDECORATOR.configure(DecoratorConfig.DEFAULT))); + .decorate(LevelsFeatureInit.LEVEL0DECORATOR.configure(DecoratorConfig.DEFAULT))); return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level0")).depth(0F) .scale(0F).temperature(1.0F).downfall(0.0F) .effects((new BiomeEffects.Builder()).waterColor(14402413).waterFogColor(14402413).fogColor(14402413) @@ -48,8 +45,8 @@ public static Biome Level0Decrepit() { .feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, LevelsFeatureInit.LEVEL0DECREPITROOM.configure(FeatureConfig.DEFAULT) .decorate(LevelsFeatureInit.LEVEL0DECORATOR.configure(DecoratorConfig.DEFAULT))); - return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level0")).depth(0F) - .scale(0F).temperature(1.0F).downfall(0.0F) + return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level0")) + .depth(0F).scale(0F).temperature(1.0F).downfall(0.0F) .effects((new BiomeEffects.Builder()).waterColor(14402413).waterFogColor(14402413).fogColor(14402413) .skyColor(14402413).music(MusicType.createIngameMusic(BackroomsSoundEvents.LEVEL0WEIGHTEDMUSIC)) .build()) @@ -63,8 +60,8 @@ public static Biome Level0Dotted() { .feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, LevelsFeatureInit.LEVEL0DOTTEDROOM.configure(FeatureConfig.DEFAULT) .decorate(LevelsFeatureInit.LEVEL0DECORATOR.configure(DecoratorConfig.DEFAULT))); - return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level0")).depth(0F) - .scale(0F).temperature(1.0F).downfall(0.0F) + return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level0")) + .depth(0F).scale(0F).temperature(1.0F).downfall(0.0F) .effects((new BiomeEffects.Builder()).waterColor(14402413).waterFogColor(14402413).fogColor(14402413) .skyColor(14402413).music(MusicType.createIngameMusic(BackroomsSoundEvents.LEVEL0MUSIC)) .build()) @@ -78,8 +75,8 @@ public static Biome Level0DottedRed() { .feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, LevelsFeatureInit.LEVEL0DOTTEDREDROOM.configure(FeatureConfig.DEFAULT) .decorate(LevelsFeatureInit.LEVEL0DECORATOR.configure(DecoratorConfig.DEFAULT))); - return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level0")).depth(0F) - .scale(0F).temperature(1.0F).downfall(0.0F) + return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level0")) + .depth(0F).scale(0F).temperature(1.0F).downfall(0.0F) .effects((new BiomeEffects.Builder()).waterColor(14402413).waterFogColor(14402413).fogColor(-5171911) .skyColor(-5171911).music(MusicType.createIngameMusic(BackroomsSoundEvents.LEVEL0WEIGHTEDMUSIC)) .build()) @@ -95,8 +92,8 @@ public static Biome Level0Red() { .feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, LevelsFeatureInit.LEVEL0REDROOM.configure(FeatureConfig.DEFAULT) .decorate(LevelsFeatureInit.LEVEL0DECORATOR.configure(DecoratorConfig.DEFAULT))); - return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level0")).depth(0F) - .scale(0F).temperature(1.0F).downfall(0.0F) + return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level0")) + .depth(0F).scale(0F).temperature(1.0F).downfall(0.0F) .effects((new BiomeEffects.Builder()).waterColor(14402413).waterFogColor(14402413).fogColor(-5171911) .skyColor(-5171911).music(MusicType.createIngameMusic(BackroomsSoundEvents.LEVEL0WEIGHTEDMUSIC)) .build()) @@ -113,8 +110,8 @@ public static Biome Level1() { .feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, LevelsFeatureInit.LEVEL1ROOM.configure(FeatureConfig.DEFAULT) .decorate(LevelsFeatureInit.LEVEL1DECORATOR.configure(DecoratorConfig.DEFAULT))); - return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level1")).depth(0F) - .scale(0F).temperature(1.0F).downfall(0.0F) + return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level1")) + .depth(0F).scale(0F).temperature(1.0F).downfall(0.0F) .effects((new BiomeEffects.Builder()).waterColor(-6710887).waterFogColor(-6710887).fogColor(-6710887) .skyColor(-6710887).music(MusicType.createIngameMusic(BackroomsSoundEvents.LEVEL1ONMUSIC)) .build()) @@ -131,8 +128,8 @@ public static Biome Level1Off() { .feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, LevelsFeatureInit.LEVEL1OFFROOM.configure(FeatureConfig.DEFAULT) .decorate(LevelsFeatureInit.LEVEL1DECORATOR.configure(DecoratorConfig.DEFAULT))); - return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level1")).depth(0F) - .scale(0F).temperature(1.0F).downfall(0.0F) + return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level1")) + .depth(0F).scale(0F).temperature(1.0F).downfall(0.0F) .effects((new BiomeEffects.Builder()).waterColor(-6710887).waterFogColor(-6710887).fogColor(-6710887) .skyColor(-6710887).music(MusicType.createIngameMusic(BackroomsSoundEvents.LEVEL1OFFMUSIC)) .build()) @@ -150,8 +147,8 @@ public static Biome Level2() { .feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, LevelsFeatureInit.LEVEL2ROOM.configure(FeatureConfig.DEFAULT) .decorate(LevelsFeatureInit.LEVEL2DECORATOR.configure(DecoratorConfig.DEFAULT))); - return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level2")).depth(0F) - .scale(0F).temperature(1.0F).downfall(0.0F) + return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level2")) + .depth(0F).scale(0F).temperature(1.0F).downfall(0.0F) .effects((new BiomeEffects.Builder()).waterColor(-6710887).waterFogColor(-6710887).fogColor(-6710887) .skyColor(-6710887).music(MusicType.createIngameMusic(BackroomsSoundEvents.LEVEL2MUSIC)) .build()) @@ -169,8 +166,8 @@ public static Biome Level2Long() { .feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, LevelsFeatureInit.LEVEL2LONGROOM.configure(FeatureConfig.DEFAULT) .decorate(LevelsFeatureInit.LEVEL2DECORATOR.configure(DecoratorConfig.DEFAULT))); - return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level2")).depth(0F) - .scale(0F).temperature(1.0F).downfall(0.0F) + return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level2")) + .depth(0F).scale(0F).temperature(1.0F).downfall(0.0F) .effects((new BiomeEffects.Builder()).waterColor(-6710887).waterFogColor(-6710887).fogColor(-6710887) .skyColor(-6710887).music(MusicType.createIngameMusic(BackroomsSoundEvents.LEVEL2LONGMUSIC)) .build()) @@ -188,14 +185,14 @@ public static Biome Level2Messy() { .feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, LevelsFeatureInit.LEVEL2MESSYROOM.configure(FeatureConfig.DEFAULT) .decorate(LevelsFeatureInit.LEVEL2DECORATOR.configure(DecoratorConfig.DEFAULT))); - return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level2")).depth(0F) - .scale(0F).temperature(1.0F).downfall(0.0F) + return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level2")) + .depth(0F).scale(0F).temperature(1.0F).downfall(0.0F) .effects((new BiomeEffects.Builder()).waterColor(-6710887).waterFogColor(-6710887).fogColor(-6710887) .skyColor(-6710887).music(MusicType.createIngameMusic(BackroomsSoundEvents.LEVEL2MESSYMUSIC)) .build()) .spawnSettings(spawnSettings).generationSettings(builder.build()).build(); } - + public static Biome Level3() { SpawnSettings spawnSettings = (new SpawnSettings.Builder()) .spawn(SpawnGroup.AMBIENT, new SpawnSettings.SpawnEntry(EntityType.ENDERMAN, 2, 0, 2)) @@ -207,8 +204,8 @@ public static Biome Level3() { .feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, LevelsFeatureInit.LEVEL3ROOM.configure(FeatureConfig.DEFAULT) .decorate(LevelsFeatureInit.LEVEL3DECORATOR.configure(DecoratorConfig.DEFAULT))); - return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level3")).depth(0F) - .scale(0F).temperature(1.0F).downfall(0.0F) + return (new Biome.Builder()).precipitation(Biome.Precipitation.NONE).category(Biome.Category.valueOf("level3")) + .depth(0F).scale(0F).temperature(1.0F).downfall(0.0F) .effects((new BiomeEffects.Builder()).waterColor(-6710887).waterFogColor(-6710887).fogColor(-6710887) .skyColor(-6710887).music(MusicType.createIngameMusic(BackroomsSoundEvents.LEVEL3MUSIC)) .build()) diff --git a/src/main/java/net/ludocrypt/backrooms/config/BackroomsConfig.java b/src/main/java/net/ludocrypt/backrooms/config/BackroomsConfig.java index dbcfded..c0e2125 100644 --- a/src/main/java/net/ludocrypt/backrooms/config/BackroomsConfig.java +++ b/src/main/java/net/ludocrypt/backrooms/config/BackroomsConfig.java @@ -12,19 +12,22 @@ public class BackroomsConfig implements ConfigData { public double Level1DoorChance = 0.05; public int Level1LayerCount = 3; + + public double Level3DoorChance = 0.5; public double VBDoor = 0.05; public double EnderPearlChance = 0.01; public double SuffocationChance = 0.01; public double ChestSpawnChance = 0.1; + public int SearchRange = 5; public boolean TallDoors = true; public boolean ForceLevel0 = false; public boolean ForceLevel1 = false; public boolean ForceLevel2 = false; public boolean ForceLevel3 = false; public boolean ForceNormal = false; - public boolean SanityEffects = true; + public boolean SanityEffects = false; public static BackroomsConfig getInstance() { return AutoConfig.getConfigHolder(BackroomsConfig.class).getConfig(); diff --git a/src/main/java/net/ludocrypt/backrooms/features/Level01Roof.java b/src/main/java/net/ludocrypt/backrooms/features/Level01Roof.java deleted file mode 100644 index fcc1e84..0000000 --- a/src/main/java/net/ludocrypt/backrooms/features/Level01Roof.java +++ /dev/null @@ -1,138 +0,0 @@ -package net.ludocrypt.backrooms.features; - -import java.util.Random; - -import com.mojang.serialization.Codec; - -import net.ludocrypt.backrooms.Backrooms; -import net.ludocrypt.backrooms.blocks.Carpet; -import net.ludocrypt.backrooms.blocks.Tile; -import net.ludocrypt.backrooms.config.BackroomsConfig; -import net.ludocrypt.imagereader.Layout; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ChestBlock; -import net.minecraft.block.entity.LootableContainerBlockEntity; -import net.minecraft.block.enums.ChestType; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Direction; -import net.minecraft.world.ServerWorldAccess; -import net.minecraft.world.StructureWorldAccess; -import net.minecraft.world.gen.chunk.ChunkGenerator; -import net.minecraft.world.gen.feature.DefaultFeatureConfig; -import net.minecraft.world.gen.feature.Feature; - -public class Level01Roof extends Feature { - public Level01Roof(Codec configFactory) { - super(configFactory); - } - - private static final BlockState SOUTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.SOUTH) - .with(Tile.SINGLE, false); - private static final BlockState NORTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.NORTH) - .with(Tile.SINGLE, false); - private static final BlockState TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.EAST) - .with(Tile.SINGLE, true); - private static final BlockState LIGHT = Backrooms.LIGHT.getDefaultState(); - private static final BlockState VENT = Backrooms.VENT.getDefaultState(); - private static final BlockState AIR = Blocks.AIR.getDefaultState(); - private static final BlockState CARPET = Backrooms.CARPET.getDefaultState(); - private static final BlockState MOLDY_CARPET = Backrooms.CARPET.getDefaultState().with(Carpet.MOLDY, true); - private static final BlockState CHEST = Blocks.CHEST.getDefaultState().with(ChestBlock.CHEST_TYPE, ChestType.SINGLE) - .with(ChestBlock.FACING, Direction.NORTH).with(ChestBlock.WATERLOGGED, false); - - Integer[][] Roof = Layout.getLayout("roof", 0, 0, 1, 0, 3, 4, 2, 0, 0, 0); - Integer[][] air = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - - }; - Integer[][] carpet = { { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - - }; - - public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random rand, BlockPos position, - DefaultFeatureConfig featureConfig) { - BlockPos.Mutable mutableBlockPos = new BlockPos.Mutable().set(position); - - generateSlice(world, mutableBlockPos.move(Direction.DOWN), Roof, rand); - generateSlice(world, mutableBlockPos.move(Direction.DOWN), air, rand); - generateSlice(world, mutableBlockPos.move(Direction.DOWN), air, rand); - generateSlice(world, mutableBlockPos.move(Direction.DOWN), air, rand); - generateSlice(world, mutableBlockPos.move(Direction.DOWN), air, rand); - generateSlice(world, mutableBlockPos.move(Direction.DOWN), carpet, rand); - - return true; - - } - - private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, Integer[][] slice, Random rand) { - - BlockPos.Mutable currentPosition = new BlockPos.Mutable(centerPos.getX() - 1, centerPos.getY(), - centerPos.getZ()); - for (int x = 0; x < slice.length; x++) { - for (int z = 0; z < slice[0].length; z++) { - int sliceBlock = slice[x][z]; - if (((world.getBlockState(currentPosition).getBlock() == Backrooms.WALL) - || (world.getBlockState(currentPosition).getBlock() == Blocks.BEDROCK)) - && (world.getBlockState(currentPosition).getBlock() != Backrooms.CARPET_STAIRS)) { - switch (sliceBlock) { - case 0: - break; - case 1: - world.setBlockState(currentPosition, SOUTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 2: - world.setBlockState(currentPosition, NORTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 3: - world.setBlockState(currentPosition, TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 4: - world.setBlockState(currentPosition, LIGHT, 2); - break; - case 5: - if (rand.nextDouble() < 0.01) { - world.setBlockState(currentPosition, MOLDY_CARPET, 2); - } else { - world.setBlockState(currentPosition, CARPET, 2); - } - if (rand.nextDouble() < 0.001) { - if (rand.nextDouble() < BackroomsConfig.getInstance().ChestSpawnChance) { - world.setBlockState(currentPosition.add(0, 1, 0), CHEST, 2); - LootableContainerBlockEntity.setLootTable(world, rand, currentPosition.add(0, 1, 0), - Backrooms.LEVEL0CHEST); - } - } - break; - } - } - currentPosition.move(Direction.SOUTH); - } - currentPosition.move(-1, 0, -slice[0].length); - } - } -} \ No newline at end of file diff --git a/src/main/java/net/ludocrypt/backrooms/features/Level0DecrepitRoom.java b/src/main/java/net/ludocrypt/backrooms/features/Level0DecrepitRoom.java index 8ecf898..326db74 100644 --- a/src/main/java/net/ludocrypt/backrooms/features/Level0DecrepitRoom.java +++ b/src/main/java/net/ludocrypt/backrooms/features/Level0DecrepitRoom.java @@ -1,5 +1,6 @@ package net.ludocrypt.backrooms.features; +import java.util.List; import java.util.Random; import com.mojang.serialization.Codec; @@ -11,6 +12,7 @@ import net.ludocrypt.backrooms.blocks.Tile; import net.ludocrypt.backrooms.blocks.TornWallpaper; import net.ludocrypt.backrooms.config.BackroomsConfig; +import net.ludocrypt.imagereader.Layout; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.ChestBlock; @@ -31,92 +33,10 @@ public Level0DecrepitRoom(Codec configFactory) { super(configFactory); } - public static boolean door1 = true; - public static boolean door2 = true; - public static boolean door3 = true; - public static boolean door4 = true; - - private int[][] One = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Two = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Three = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Four = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] OneNoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] TwoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway1NoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 7, 4, 4, 4, 4, 8, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway1Light = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 7, 4, 4, 4, 4, 8, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Wall1 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Wall2 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2NoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Light = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Stair1Light = { { 0, 0, 0, 0, 0, 10, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 1, 10, 4, 4, 4, 4, 4, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 1, 1, 10, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 10, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 1, 10, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 10, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Stair1NoLight = { { 0, 0, 0, 0, 0, 10, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 1, 10, 4, 4, 4, 4, 4, 3, 3, 2, 11 }, { 5, 5, 5, 5, 5, 1, 1, 10, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 10, 4, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 1, 10, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 10, 4, 4, 4, 4, 8 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - - private int[][] StairWall = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; + private boolean door1 = true; private static final BlockState WALLPAPER = Backrooms.WALLPAPER.getDefaultState(); private static final BlockState CARPET = Backrooms.CARPET.getDefaultState(); - private static final BlockState CARPET_STAIRS = Backrooms.CARPET_STAIRS.getDefaultState() - .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) - .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); private static final BlockState MOLDY_CARPET = Backrooms.CARPET.getDefaultState().with(Carpet.MOLDY, true); private static final BlockState SOUTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.SOUTH) .with(Tile.SINGLE, false); @@ -138,175 +58,136 @@ public Level0DecrepitRoom(Codec configFactory) { private static final BlockState TORN_WALLPAPER_4 = Backrooms.TORN_WALLPAPER.getDefaultState() .with(TornWallpaper.TORN_LEVEL, 4); private static final BlockState VENT = Backrooms.VENT.getDefaultState(); + private static final BlockState STAIR = Backrooms.CARPET_STAIRS.getDefaultState() + .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) + .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); + + private static List LayoutsTop = Layout.listLayouts(27, "level01", 1, 0, new Layout()); + private static List LayoutsBottom = Layout.listLayouts(27, "level01", 2, 0, new Layout()); + private static Integer[][] Roof = Layout.getColoredLayout("roof", 0, 0, 3, 0, 6, 5, 4, 0, 0, 0, new Layout()); + private static Integer[][] Floor = Layout.getLayout("whiteblock", 0, 7, new Layout()); public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random rand, BlockPos position, DefaultFeatureConfig featureConfig) { - - Random generator = new Random(world.getSeed()); - long seed = world.getSeed(); - long l = generator.nextLong(); - long m = generator.nextLong(); - long n = generator.nextLong(); - long o = position.getX() * l ^ position.getY() * m ^ position.getZ() * n ^ seed; - generator = new Random(o); BlockPos.Mutable mutableBlockPos = new BlockPos.Mutable().set(position); + int layoutInt = 0; - if (generator.nextDouble() < 0.7) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); - } else if (generator.nextDouble() < 0.8) { - if (generator.nextDouble() < 0.5) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall1, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall2, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + if (rand.nextDouble() < 0.7) { + layoutInt = 0; + } else if (rand.nextDouble() < 0.8) { + int k = rand.nextInt(9); + switch (k) { + case 0: + layoutInt = 8; + break; + case 1: + layoutInt = 9; + break; + case 2: + layoutInt = 10; + break; + case 3: + layoutInt = 11; + break; + case 4: + layoutInt = 17; + break; + case 5: + layoutInt = 18; + break; + case 6: + layoutInt = 19; + break; + case 7: + layoutInt = 20; + break; + case 8: + layoutInt = 25; + break; + case 9: + layoutInt = 26; + break; + } + } else { + if (rand.nextDouble() < 0.5) { + layoutInt = 100; } else { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + layoutInt = rand.nextInt(27); } - } else if (generator.nextDouble() < 0.5) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), StairWall, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), StairWall, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + } + + if (layoutInt == 100) { + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.One, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Four, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, false); } else { - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); + Integer[][] layoutTop = LayoutsTop.get(layoutInt); + Integer[][] layoutBottom = LayoutsBottom.get(layoutInt); + + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Roof, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutBottom, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Floor, rand); } return true; } - private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, int[][] slice, Random rand) { + private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, Integer[][] slice, Random rand) { - BlockPos currentPositionOffsetted = new BlockPos(centerPos.add(-1, 3, slice[0].length)); - BlockPos.Mutable currentPosition = new BlockPos.Mutable(currentPositionOffsetted.getX(), - currentPositionOffsetted.getY(), currentPositionOffsetted.getZ()); + BlockPos.Mutable currentPosition = new BlockPos.Mutable(centerPos.getX() - 1, centerPos.getY(), + centerPos.getZ()); - for (int y = 0; y < slice.length; y++) { + for (int x = 0; x < slice.length; x++) { for (int z = 0; z < slice[0].length; z++) { - int sliceBlock = slice[y][z]; + int sliceBlock = slice[x][z]; if (((world.getBlockState(currentPosition).getBlock() == Backrooms.WALL) || (world.getBlockState(currentPosition).getBlock() == Blocks.BEDROCK)) && (world.getBlockState(currentPosition).getBlock() != Backrooms.CARPET_STAIRS)) { - - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0DecrepitRoom.door1 = true; - } else { - Level0DecrepitRoom.door1 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0DecrepitRoom.door2 = true; - } else { - Level0DecrepitRoom.door2 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0DecrepitRoom.door3 = true; - } else { - Level0DecrepitRoom.door3 = false; - } if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0DecrepitRoom.door4 = true; + door1 = true; } else { - Level0DecrepitRoom.door4 = false; + door1 = false; } switch (sliceBlock) { case 0: - break; - case 2: - world.setBlockState(currentPosition, SOUTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 11: - world.setBlockState(currentPosition, NORTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 12: - world.setBlockState(currentPosition, TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 3: - world.setBlockState(currentPosition, LIGHT, 8); - break; - case 4: world.setBlockState(currentPosition, AIR, 2); break; - case 5: + case 1: if (rand.nextDouble() < 0.35) { int k = rand.nextInt(4); switch (k) { @@ -327,120 +208,97 @@ private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, world.setBlockState(currentPosition, WALLPAPER, 2); } break; - case 6: + case 2: if (door1) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); + BlockState placement; + if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor && rand.nextDouble() < 0.1) { + placement = VOID_BLOCK; + } else { + placement = AIR; } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); - } - break; - case 7: - if (door2) { - world.setBlockState(currentPosition, AIR, 3); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 3); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 3); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 3); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 3); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 3); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 3); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 3); + world.setBlockState(currentPosition, placement, 2); + world.setBlockState(currentPosition.add(0, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 1), placement, 2); if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 1), placement, 2); } - if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor) { - world.setBlockState(currentPosition, VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(0, 1, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(0, 2, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 0, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 1, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 2, 0), VOID_BLOCK, 3); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), VOID_BLOCK, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), VOID_BLOCK, 2); + } else { + if (rand.nextDouble() < 0.35) { + int k = rand.nextInt(4); + switch (k) { + case 0: + world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); + break; + case 1: + world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); + break; + case 2: + world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); + break; + case 3: + world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); + break; } } else { - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 3); + world.setBlockState(currentPosition, WALLPAPER, 2); } - - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); } break; - case 8: - if (door3) { - world.setBlockState(currentPosition, AIR, 3); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 1), AIR, 2); - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); + case 3: + world.setBlockState(currentPosition, NORTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 9: - if (door4) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, -1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, -1), AIR, 2); - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); + case 4: + world.setBlockState(currentPosition, SOUTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); + } + break; + case 5: + world.setBlockState(currentPosition, TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 10: - world.setBlockState(currentPosition, CARPET_STAIRS, 2); + case 6: + world.setBlockState(currentPosition, LIGHT, 2); break; - case 1: + case 7: if (rand.nextDouble() < 0.25) { world.setBlockState(currentPosition, MOLDY_CARPET, 2); } else { @@ -458,7 +316,7 @@ private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, } currentPosition.move(Direction.SOUTH); } - currentPosition.move(0, -1, -slice[0].length); + currentPosition.move(-1, 0, -slice[0].length); } } } \ No newline at end of file diff --git a/src/main/java/net/ludocrypt/backrooms/features/Level0DottedRedRoom.java b/src/main/java/net/ludocrypt/backrooms/features/Level0DottedRedRoom.java index 4f216ab..4397ba8 100644 --- a/src/main/java/net/ludocrypt/backrooms/features/Level0DottedRedRoom.java +++ b/src/main/java/net/ludocrypt/backrooms/features/Level0DottedRedRoom.java @@ -1,5 +1,6 @@ package net.ludocrypt.backrooms.features; +import java.util.List; import java.util.Random; import com.mojang.serialization.Codec; @@ -10,6 +11,7 @@ import net.ludocrypt.backrooms.blocks.Tile; import net.ludocrypt.backrooms.blocks.TornWallpaper; import net.ludocrypt.backrooms.config.BackroomsConfig; +import net.ludocrypt.imagereader.Layout; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.ChestBlock; @@ -30,92 +32,10 @@ public Level0DottedRedRoom(Codec configFactory) { super(configFactory); } - public static boolean door1 = true; - public static boolean door2 = true; - public static boolean door3 = true; - public static boolean door4 = true; - - private int[][] One = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Two = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Three = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Four = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] OneNoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] TwoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway1NoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 7, 4, 4, 4, 4, 8, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway1Light = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 7, 4, 4, 4, 4, 8, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Wall1 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Wall2 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2NoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Light = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Stair1Light = { { 0, 0, 0, 0, 0, 10, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 1, 10, 4, 4, 4, 4, 4, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 1, 1, 10, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 10, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 1, 10, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 10, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Stair1NoLight = { { 0, 0, 0, 0, 0, 10, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 1, 10, 4, 4, 4, 4, 4, 3, 3, 2, 11 }, { 5, 5, 5, 5, 5, 1, 1, 10, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 10, 4, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 1, 10, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 10, 4, 4, 4, 4, 8 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - - private int[][] StairWall = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; + private boolean door1 = true; private static final BlockState WALLPAPER = Backrooms.DOTTED_RED_WALLPAPER.getDefaultState(); private static final BlockState CARPET = Backrooms.CARPET.getDefaultState(); - private static final BlockState CARPET_STAIRS = Backrooms.CARPET_STAIRS.getDefaultState() - .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) - .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); private static final BlockState MOLDY_CARPET = Backrooms.CARPET.getDefaultState().with(Carpet.MOLDY, true); private static final BlockState SOUTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.SOUTH) .with(Tile.SINGLE, false); @@ -137,175 +57,136 @@ public Level0DottedRedRoom(Codec configFactory) { private static final BlockState TORN_WALLPAPER_4 = Backrooms.DOTTED_RED_TORN_WALLPAPER.getDefaultState() .with(TornWallpaper.TORN_LEVEL, 4); private static final BlockState VENT = Backrooms.VENT.getDefaultState(); + private static final BlockState STAIR = Backrooms.CARPET_STAIRS.getDefaultState() + .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) + .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); + + private static List LayoutsTop = Layout.listLayouts(27, "level01", 1, 0, new Layout()); + private static List LayoutsBottom = Layout.listLayouts(27, "level01", 2, 0, new Layout()); + private static Integer[][] Roof = Layout.getColoredLayout("roof", 0, 0, 3, 0, 6, 5, 4, 0, 0, 0, new Layout()); + private static Integer[][] Floor = Layout.getLayout("whiteblock", 0, 7, new Layout()); public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random rand, BlockPos position, DefaultFeatureConfig featureConfig) { - - Random generator = new Random(world.getSeed()); - long seed = world.getSeed(); - long l = generator.nextLong(); - long m = generator.nextLong(); - long n = generator.nextLong(); - long o = position.getX() * l ^ position.getY() * m ^ position.getZ() * n ^ seed; - generator = new Random(o); BlockPos.Mutable mutableBlockPos = new BlockPos.Mutable().set(position); + int layoutInt = 0; - if (generator.nextDouble() < 0.7) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); - } else if (generator.nextDouble() < 0.8) { - if (generator.nextDouble() < 0.5) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall1, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall2, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + if (rand.nextDouble() < 0.7) { + layoutInt = 0; + } else if (rand.nextDouble() < 0.8) { + int k = rand.nextInt(9); + switch (k) { + case 0: + layoutInt = 8; + break; + case 1: + layoutInt = 9; + break; + case 2: + layoutInt = 10; + break; + case 3: + layoutInt = 11; + break; + case 4: + layoutInt = 17; + break; + case 5: + layoutInt = 18; + break; + case 6: + layoutInt = 19; + break; + case 7: + layoutInt = 20; + break; + case 8: + layoutInt = 25; + break; + case 9: + layoutInt = 26; + break; + } + } else { + if (rand.nextDouble() < 0.5) { + layoutInt = 100; } else { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + layoutInt = rand.nextInt(27); } - } else if (generator.nextDouble() < 0.5) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), StairWall, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), StairWall, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + } + + if (layoutInt == 100) { + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.One, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Four, rand, + Backrooms.DOTTED_RED_WALLPAPER, Backrooms.DOTTED_RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); } else { - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); + Integer[][] layoutTop = LayoutsTop.get(layoutInt); + Integer[][] layoutBottom = LayoutsBottom.get(layoutInt); + + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Roof, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutBottom, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Floor, rand); } return true; } - private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, int[][] slice, Random rand) { + private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, Integer[][] slice, Random rand) { - BlockPos currentPositionOffsetted = new BlockPos(centerPos.add(-1, 3, slice[0].length)); - BlockPos.Mutable currentPosition = new BlockPos.Mutable(currentPositionOffsetted.getX(), - currentPositionOffsetted.getY(), currentPositionOffsetted.getZ()); + BlockPos.Mutable currentPosition = new BlockPos.Mutable(centerPos.getX() - 1, centerPos.getY(), + centerPos.getZ()); - for (int y = 0; y < slice.length; y++) { + for (int x = 0; x < slice.length; x++) { for (int z = 0; z < slice[0].length; z++) { - int sliceBlock = slice[y][z]; + int sliceBlock = slice[x][z]; if (((world.getBlockState(currentPosition).getBlock() == Backrooms.WALL) || (world.getBlockState(currentPosition).getBlock() == Blocks.BEDROCK)) && (world.getBlockState(currentPosition).getBlock() != Backrooms.CARPET_STAIRS)) { - - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0DottedRedRoom.door1 = true; - } else { - Level0DottedRedRoom.door1 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0DottedRedRoom.door2 = true; - } else { - Level0DottedRedRoom.door2 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0DottedRedRoom.door3 = true; - } else { - Level0DottedRedRoom.door3 = false; - } if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0DottedRedRoom.door4 = true; + door1 = true; } else { - Level0DottedRedRoom.door4 = false; + door1 = false; } switch (sliceBlock) { case 0: - break; - case 2: - world.setBlockState(currentPosition, SOUTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 11: - world.setBlockState(currentPosition, NORTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 12: - world.setBlockState(currentPosition, TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 3: - world.setBlockState(currentPosition, LIGHT, 2); - break; - case 4: world.setBlockState(currentPosition, AIR, 2); break; - case 5: + case 1: if (rand.nextDouble() < 0.005) { int k = rand.nextInt(4); switch (k) { @@ -326,126 +207,102 @@ private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, world.setBlockState(currentPosition, WALLPAPER, 2); } break; - case 6: + case 2: if (door1) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); + BlockState placement; + if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor && rand.nextDouble() < 0.1) { + placement = VOID_BLOCK; + } else { + placement = AIR; } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); - } - break; - case 7: - if (door2) { - world.setBlockState(currentPosition, AIR, 3); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 3); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 3); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 3); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 3); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 3); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 3); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 3); + world.setBlockState(currentPosition, placement, 2); + world.setBlockState(currentPosition.add(0, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 1), placement, 2); if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 1), placement, 2); } - if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor) { - world.setBlockState(currentPosition, VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(0, 1, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(0, 2, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 0, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 1, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 2, 0), VOID_BLOCK, 3); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), VOID_BLOCK, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), VOID_BLOCK, 2); + } else { + if (rand.nextDouble() < 0.005) { + int k = rand.nextInt(4); + switch (k) { + case 0: + world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); + break; + case 1: + world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); + break; + case 2: + world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); + break; + case 3: + world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); + break; } } else { - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 3); + world.setBlockState(currentPosition, WALLPAPER, 2); } - - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); } break; - case 8: - if (door3) { - world.setBlockState(currentPosition, AIR, 3); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 1), AIR, 2); - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); + case 3: + world.setBlockState(currentPosition, NORTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 9: - if (door4) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, -1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, -1), AIR, 2); - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); + case 4: + world.setBlockState(currentPosition, SOUTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 10: - world.setBlockState(currentPosition, CARPET_STAIRS, 2); + case 5: + world.setBlockState(currentPosition, TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); + } break; - case 1: + case 6: + world.setBlockState(currentPosition, LIGHT, 2); + break; + case 7: if (rand.nextDouble() < 0.01) { world.setBlockState(currentPosition, MOLDY_CARPET, 2); } else { world.setBlockState(currentPosition, CARPET, 2); } - if (rand.nextDouble() < 0.001) { if (rand.nextDouble() < BackroomsConfig.getInstance().ChestSpawnChance) { world.setBlockState(currentPosition.add(0, 1, 0), CHEST, 2); @@ -458,7 +315,7 @@ private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, } currentPosition.move(Direction.SOUTH); } - currentPosition.move(0, -1, -slice[0].length); + currentPosition.move(-1, 0, -slice[0].length); } } } \ No newline at end of file diff --git a/src/main/java/net/ludocrypt/backrooms/features/Level0DottedRoom.java b/src/main/java/net/ludocrypt/backrooms/features/Level0DottedRoom.java index b78efcd..32d94ea 100644 --- a/src/main/java/net/ludocrypt/backrooms/features/Level0DottedRoom.java +++ b/src/main/java/net/ludocrypt/backrooms/features/Level0DottedRoom.java @@ -1,5 +1,6 @@ package net.ludocrypt.backrooms.features; +import java.util.List; import java.util.Random; import com.mojang.serialization.Codec; @@ -10,6 +11,7 @@ import net.ludocrypt.backrooms.blocks.Tile; import net.ludocrypt.backrooms.blocks.TornWallpaper; import net.ludocrypt.backrooms.config.BackroomsConfig; +import net.ludocrypt.imagereader.Layout; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.ChestBlock; @@ -30,92 +32,10 @@ public Level0DottedRoom(Codec configFactory) { super(configFactory); } - public static boolean door1 = true; - public static boolean door2 = true; - public static boolean door3 = true; - public static boolean door4 = true; - - private int[][] One = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Two = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Three = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Four = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] OneNoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] TwoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway1NoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 7, 4, 4, 4, 4, 8, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway1Light = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 7, 4, 4, 4, 4, 8, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Wall1 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Wall2 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2NoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Light = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Stair1Light = { { 0, 0, 0, 0, 0, 10, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 1, 10, 4, 4, 4, 4, 4, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 1, 1, 10, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 10, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 1, 10, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 10, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Stair1NoLight = { { 0, 0, 0, 0, 0, 10, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 1, 10, 4, 4, 4, 4, 4, 3, 3, 2, 11 }, { 5, 5, 5, 5, 5, 1, 1, 10, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 10, 4, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 1, 10, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 10, 4, 4, 4, 4, 8 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - - private int[][] StairWall = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; + private boolean door1 = true; private static final BlockState WALLPAPER = Backrooms.DOTTED_WALLPAPER.getDefaultState(); private static final BlockState CARPET = Backrooms.CARPET.getDefaultState(); - private static final BlockState CARPET_STAIRS = Backrooms.CARPET_STAIRS.getDefaultState() - .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) - .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); private static final BlockState MOLDY_CARPET = Backrooms.CARPET.getDefaultState().with(Carpet.MOLDY, true); private static final BlockState SOUTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.SOUTH) .with(Tile.SINGLE, false); @@ -137,175 +57,136 @@ public Level0DottedRoom(Codec configFactory) { private static final BlockState TORN_WALLPAPER_4 = Backrooms.DOTTED_TORN_WALLPAPER.getDefaultState() .with(TornWallpaper.TORN_LEVEL, 4); private static final BlockState VENT = Backrooms.VENT.getDefaultState(); + private static final BlockState STAIR = Backrooms.CARPET_STAIRS.getDefaultState() + .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) + .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); + + private static List LayoutsTop = Layout.listLayouts(27, "level01", 1, 0, new Layout()); + private static List LayoutsBottom = Layout.listLayouts(27, "level01", 2, 0, new Layout()); + private static Integer[][] Roof = Layout.getColoredLayout("roof", 0, 0, 3, 0, 6, 5, 4, 0, 0, 0, new Layout()); + private static Integer[][] Floor = Layout.getLayout("whiteblock", 0, 7, new Layout()); public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random rand, BlockPos position, DefaultFeatureConfig featureConfig) { - - Random generator = new Random(world.getSeed()); - long seed = world.getSeed(); - long l = generator.nextLong(); - long m = generator.nextLong(); - long n = generator.nextLong(); - long o = position.getX() * l ^ position.getY() * m ^ position.getZ() * n ^ seed; - generator = new Random(o); BlockPos.Mutable mutableBlockPos = new BlockPos.Mutable().set(position); + int layoutInt = 0; - if (generator.nextDouble() < 0.7) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); - } else if (generator.nextDouble() < 0.8) { - if (generator.nextDouble() < 0.5) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall1, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall2, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + if (rand.nextDouble() < 0.7) { + layoutInt = 0; + } else if (rand.nextDouble() < 0.8) { + int k = rand.nextInt(9); + switch (k) { + case 0: + layoutInt = 8; + break; + case 1: + layoutInt = 9; + break; + case 2: + layoutInt = 10; + break; + case 3: + layoutInt = 11; + break; + case 4: + layoutInt = 17; + break; + case 5: + layoutInt = 18; + break; + case 6: + layoutInt = 19; + break; + case 7: + layoutInt = 20; + break; + case 8: + layoutInt = 25; + break; + case 9: + layoutInt = 26; + break; + } + } else { + if (rand.nextDouble() < 0.5) { + layoutInt = 100; } else { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + layoutInt = rand.nextInt(27); } - } else if (generator.nextDouble() < 0.5) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), StairWall, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), StairWall, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + } + + if (layoutInt == 100) { + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.One, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Four, rand, + Backrooms.DOTTED_WALLPAPER, Backrooms.DOTTED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); } else { - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); + Integer[][] layoutTop = LayoutsTop.get(layoutInt); + Integer[][] layoutBottom = LayoutsBottom.get(layoutInt); + + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Roof, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutBottom, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Floor, rand); } return true; } - private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, int[][] slice, Random rand) { + private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, Integer[][] slice, Random rand) { - BlockPos currentPositionOffsetted = new BlockPos(centerPos.add(-1, 3, slice[0].length)); - BlockPos.Mutable currentPosition = new BlockPos.Mutable(currentPositionOffsetted.getX(), - currentPositionOffsetted.getY(), currentPositionOffsetted.getZ()); + BlockPos.Mutable currentPosition = new BlockPos.Mutable(centerPos.getX() - 1, centerPos.getY(), + centerPos.getZ()); - for (int y = 0; y < slice.length; y++) { + for (int x = 0; x < slice.length; x++) { for (int z = 0; z < slice[0].length; z++) { - int sliceBlock = slice[y][z]; + int sliceBlock = slice[x][z]; if (((world.getBlockState(currentPosition).getBlock() == Backrooms.WALL) || (world.getBlockState(currentPosition).getBlock() == Blocks.BEDROCK)) && (world.getBlockState(currentPosition).getBlock() != Backrooms.CARPET_STAIRS)) { - - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0DottedRoom.door1 = true; - } else { - Level0DottedRoom.door1 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0DottedRoom.door2 = true; - } else { - Level0DottedRoom.door2 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0DottedRoom.door3 = true; - } else { - Level0DottedRoom.door3 = false; - } if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0DottedRoom.door4 = true; + door1 = true; } else { - Level0DottedRoom.door4 = false; + door1 = false; } switch (sliceBlock) { case 0: - break; - case 2: - world.setBlockState(currentPosition, SOUTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 11: - world.setBlockState(currentPosition, NORTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 12: - world.setBlockState(currentPosition, TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 3: - world.setBlockState(currentPosition, LIGHT, 2); - break; - case 4: world.setBlockState(currentPosition, AIR, 2); break; - case 5: + case 1: if (rand.nextDouble() < 0.005) { int k = rand.nextInt(4); switch (k) { @@ -326,126 +207,102 @@ private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, world.setBlockState(currentPosition, WALLPAPER, 2); } break; - case 6: + case 2: if (door1) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); + BlockState placement; + if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor && rand.nextDouble() < 0.1) { + placement = VOID_BLOCK; + } else { + placement = AIR; } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); - } - break; - case 7: - if (door2) { - world.setBlockState(currentPosition, AIR, 3); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 3); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 3); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 3); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 3); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 3); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 3); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 3); + world.setBlockState(currentPosition, placement, 2); + world.setBlockState(currentPosition.add(0, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 1), placement, 2); if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 1), placement, 2); } - if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor) { - world.setBlockState(currentPosition, VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(0, 1, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(0, 2, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 0, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 1, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 2, 0), VOID_BLOCK, 3); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), VOID_BLOCK, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), VOID_BLOCK, 2); + } else { + if (rand.nextDouble() < 0.005) { + int k = rand.nextInt(4); + switch (k) { + case 0: + world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); + break; + case 1: + world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); + break; + case 2: + world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); + break; + case 3: + world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); + break; } } else { - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 3); + world.setBlockState(currentPosition, WALLPAPER, 2); } - - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); } break; - case 8: - if (door3) { - world.setBlockState(currentPosition, AIR, 3); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 1), AIR, 2); - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); + case 3: + world.setBlockState(currentPosition, NORTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 9: - if (door4) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, -1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, -1), AIR, 2); - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); + case 4: + world.setBlockState(currentPosition, SOUTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 10: - world.setBlockState(currentPosition, CARPET_STAIRS, 2); + case 5: + world.setBlockState(currentPosition, TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); + } break; - case 1: + case 6: + world.setBlockState(currentPosition, LIGHT, 2); + break; + case 7: if (rand.nextDouble() < 0.01) { world.setBlockState(currentPosition, MOLDY_CARPET, 2); } else { world.setBlockState(currentPosition, CARPET, 2); } - if (rand.nextDouble() < 0.001) { if (rand.nextDouble() < BackroomsConfig.getInstance().ChestSpawnChance) { world.setBlockState(currentPosition.add(0, 1, 0), CHEST, 2); @@ -458,7 +315,7 @@ private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, } currentPosition.move(Direction.SOUTH); } - currentPosition.move(0, -1, -slice[0].length); + currentPosition.move(-1, 0, -slice[0].length); } } } \ No newline at end of file diff --git a/src/main/java/net/ludocrypt/backrooms/features/Level0RedRoom.java b/src/main/java/net/ludocrypt/backrooms/features/Level0RedRoom.java index 5413478..9ed26ac 100644 --- a/src/main/java/net/ludocrypt/backrooms/features/Level0RedRoom.java +++ b/src/main/java/net/ludocrypt/backrooms/features/Level0RedRoom.java @@ -1,15 +1,24 @@ package net.ludocrypt.backrooms.features; +import java.util.List; import java.util.Random; import com.mojang.serialization.Codec; import net.ludocrypt.backrooms.Backrooms; +import net.ludocrypt.backrooms.blocks.BackroomsStairs; +import net.ludocrypt.backrooms.blocks.Carpet; import net.ludocrypt.backrooms.blocks.Tile; import net.ludocrypt.backrooms.blocks.TornWallpaper; import net.ludocrypt.backrooms.config.BackroomsConfig; +import net.ludocrypt.imagereader.Layout; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.block.ChestBlock; +import net.minecraft.block.entity.LootableContainerBlockEntity; +import net.minecraft.block.enums.BlockHalf; +import net.minecraft.block.enums.ChestType; +import net.minecraft.block.enums.StairShape; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.ServerWorldAccess; @@ -23,74 +32,11 @@ public Level0RedRoom(Codec configFactory) { super(configFactory); } - public static boolean door1 = true; - public static boolean door2 = true; - public static boolean door3 = true; - public static boolean door4 = true; - - private int[][] One = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Two = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Three = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Four = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] OneNoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] TwoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway1NoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 7, 4, 4, 4, 4, 8, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway1Light = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 7, 4, 4, 4, 4, 8, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Wall1 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Wall2 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2NoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Light = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; + private boolean door1 = true; private static final BlockState WALLPAPER = Backrooms.RED_WALLPAPER.getDefaultState(); private static final BlockState CARPET = Backrooms.CARPET.getDefaultState(); + private static final BlockState MOLDY_CARPET = Backrooms.CARPET.getDefaultState().with(Carpet.MOLDY, true); private static final BlockState SOUTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.SOUTH) .with(Tile.SINGLE, false); private static final BlockState NORTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.NORTH) @@ -99,6 +45,8 @@ public Level0RedRoom(Codec configFactory) { .with(Tile.SINGLE, true); private static final BlockState LIGHT = Backrooms.LIGHT.getDefaultState(); private static final BlockState AIR = Blocks.AIR.getDefaultState(); + private static final BlockState CHEST = Blocks.CHEST.getDefaultState().with(ChestBlock.CHEST_TYPE, ChestType.SINGLE) + .with(ChestBlock.FACING, Direction.NORTH).with(ChestBlock.WATERLOGGED, false); private static final BlockState VOID_BLOCK = Backrooms.VOID_BLOCK.getDefaultState(); private static final BlockState TORN_WALLPAPER_1 = Backrooms.RED_TORN_WALLPAPER.getDefaultState() .with(TornWallpaper.TORN_LEVEL, 1); @@ -109,176 +57,136 @@ public Level0RedRoom(Codec configFactory) { private static final BlockState TORN_WALLPAPER_4 = Backrooms.RED_TORN_WALLPAPER.getDefaultState() .with(TornWallpaper.TORN_LEVEL, 4); private static final BlockState VENT = Backrooms.VENT.getDefaultState(); + private static final BlockState STAIR = Backrooms.CARPET_STAIRS.getDefaultState() + .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) + .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); + + private static List LayoutsTop = Layout.listLayouts(27, "level01", 1, 0, new Layout()); + private static List LayoutsBottom = Layout.listLayouts(27, "level01", 2, 0, new Layout()); + private static Integer[][] Roof = Layout.getColoredLayout("roof", 0, 0, 3, 0, 6, 5, 4, 0, 0, 0, new Layout()); + private static Integer[][] Floor = Layout.getLayout("whiteblock", 0, 7, new Layout()); public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random rand, BlockPos position, DefaultFeatureConfig featureConfig) { - - Random generator = new Random(world.getSeed()); - long seed = world.getSeed(); - long l = generator.nextLong(); - long m = generator.nextLong(); - long n = generator.nextLong(); - long o = position.getX() * l ^ position.getY() * m ^ position.getZ() * n ^ seed; - generator = new Random(o); - BlockPos.Mutable mutableBlockPos = new BlockPos.Mutable().set(position); + int layoutInt = 0; - if (generator.nextDouble() < 0.7) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); - } else if (generator.nextDouble() < 0.8) { - if (generator.nextDouble() < 0.5) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall1, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall2, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + if (rand.nextDouble() < 0.7) { + layoutInt = 0; + } else if (rand.nextDouble() < 0.8) { + int k = rand.nextInt(9); + switch (k) { + case 0: + layoutInt = 8; + break; + case 1: + layoutInt = 9; + break; + case 2: + layoutInt = 10; + break; + case 3: + layoutInt = 11; + break; + case 4: + layoutInt = 17; + break; + case 5: + layoutInt = 18; + break; + case 6: + layoutInt = 19; + break; + case 7: + layoutInt = 20; + break; + case 8: + layoutInt = 25; + break; + case 9: + layoutInt = 26; + break; + } + } else { + if (rand.nextDouble() < 0.5) { + layoutInt = 100; } else { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + layoutInt = rand.nextInt(27); } - } else if (generator.nextDouble() < 0.5) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + } + + if (layoutInt == 100) { + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.One, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Four, rand, + Backrooms.RED_WALLPAPER, Backrooms.RED_TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); } else { - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); + Integer[][] layoutTop = LayoutsTop.get(layoutInt); + Integer[][] layoutBottom = LayoutsBottom.get(layoutInt); + + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Roof, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutBottom, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Floor, rand); } return true; } - private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, int[][] slice, Random rand) { + private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, Integer[][] slice, Random rand) { - BlockPos currentPositionOffsetted = new BlockPos(centerPos.add(-1, 3, slice[0].length)); - BlockPos.Mutable currentPosition = new BlockPos.Mutable(currentPositionOffsetted.getX(), - currentPositionOffsetted.getY(), currentPositionOffsetted.getZ()); + BlockPos.Mutable currentPosition = new BlockPos.Mutable(centerPos.getX() - 1, centerPos.getY(), + centerPos.getZ()); - for (int y = 0; y < slice.length; y++) { + for (int x = 0; x < slice.length; x++) { for (int z = 0; z < slice[0].length; z++) { - int sliceBlock = slice[y][z]; + int sliceBlock = slice[x][z]; if (((world.getBlockState(currentPosition).getBlock() == Backrooms.WALL) || (world.getBlockState(currentPosition).getBlock() == Blocks.BEDROCK)) && (world.getBlockState(currentPosition).getBlock() != Backrooms.CARPET_STAIRS)) { - - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0RedRoom.door1 = true; - } else { - Level0RedRoom.door1 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0RedRoom.door2 = true; - } else { - Level0RedRoom.door2 = false; - } if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0RedRoom.door3 = true; + door1 = true; } else { - Level0RedRoom.door3 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0RedRoom.door4 = true; - } else { - Level0RedRoom.door4 = false; + door1 = false; } switch (sliceBlock) { case 0: - break; - case 2: - world.setBlockState(currentPosition, SOUTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 11: - world.setBlockState(currentPosition, NORTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 12: - world.setBlockState(currentPosition, TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 3: - world.setBlockState(currentPosition, LIGHT, 2); - break; - case 4: world.setBlockState(currentPosition, AIR, 2); break; - case 5: + case 1: if (rand.nextDouble() < 0.005) { int k = rand.nextInt(4); switch (k) { @@ -299,125 +207,115 @@ private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, world.setBlockState(currentPosition, WALLPAPER, 2); } break; - case 6: + case 2: if (door1) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); + BlockState placement; + if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor && rand.nextDouble() < 0.1) { + placement = VOID_BLOCK; + } else { + placement = AIR; } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); - } - break; - case 7: - if (door2) { - world.setBlockState(currentPosition, AIR, 3); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 3); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 3); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 3); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 3); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 3); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 3); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 3); + world.setBlockState(currentPosition, placement, 2); + world.setBlockState(currentPosition.add(0, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 1), placement, 2); if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 1), placement, 2); } - if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor) { - world.setBlockState(currentPosition, VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(0, 1, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(0, 2, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 0, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 1, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 2, 0), VOID_BLOCK, 3); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), VOID_BLOCK, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), VOID_BLOCK, 2); + } else { + if (rand.nextDouble() < 0.005) { + int k = rand.nextInt(4); + switch (k) { + case 0: + world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); + break; + case 1: + world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); + break; + case 2: + world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); + break; + case 3: + world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); + break; } } else { - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 3); + world.setBlockState(currentPosition, WALLPAPER, 2); } - - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); } break; - case 8: - if (door3) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 1), AIR, 2); - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); + case 3: + world.setBlockState(currentPosition, NORTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 9: - if (door4) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, -1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, -1), AIR, 2); - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); + case 4: + world.setBlockState(currentPosition, SOUTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 1: - world.setBlockState(currentPosition, CARPET, 2); + case 5: + world.setBlockState(currentPosition, TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); + } + break; + case 6: + world.setBlockState(currentPosition, LIGHT, 2); + break; + case 7: + if (rand.nextDouble() < 0.01) { + world.setBlockState(currentPosition, MOLDY_CARPET, 2); + } else { + world.setBlockState(currentPosition, CARPET, 2); + } + if (rand.nextDouble() < 0.001) { + if (rand.nextDouble() < BackroomsConfig.getInstance().ChestSpawnChance) { + world.setBlockState(currentPosition.add(0, 1, 0), CHEST, 2); + LootableContainerBlockEntity.setLootTable(world, rand, currentPosition.add(0, 1, 0), + Backrooms.LEVEL0CHEST); + } + } break; } } currentPosition.move(Direction.SOUTH); } - currentPosition.move(0, -1, -slice[0].length); + currentPosition.move(-1, 0, -slice[0].length); } - } } \ No newline at end of file diff --git a/src/main/java/net/ludocrypt/backrooms/features/Level0Room.java b/src/main/java/net/ludocrypt/backrooms/features/Level0Room.java index 6966a55..78f11c4 100644 --- a/src/main/java/net/ludocrypt/backrooms/features/Level0Room.java +++ b/src/main/java/net/ludocrypt/backrooms/features/Level0Room.java @@ -19,10 +19,8 @@ import net.minecraft.block.enums.BlockHalf; import net.minecraft.block.enums.ChestType; import net.minecraft.block.enums.StairShape; -import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.Vec2f; import net.minecraft.world.ServerWorldAccess; import net.minecraft.world.StructureWorldAccess; import net.minecraft.world.gen.chunk.ChunkGenerator; @@ -34,16 +32,10 @@ public Level0Room(Codec configFactory) { super(configFactory); } - public static boolean door1 = true; - public static boolean door2 = true; - public static boolean door3 = true; - public static boolean door4 = true; + private boolean door1 = true; private static final BlockState WALLPAPER = Backrooms.WALLPAPER.getDefaultState(); private static final BlockState CARPET = Backrooms.CARPET.getDefaultState(); - private static final BlockState CARPET_STAIRS = Backrooms.CARPET_STAIRS.getDefaultState() - .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) - .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); private static final BlockState MOLDY_CARPET = Backrooms.CARPET.getDefaultState().with(Carpet.MOLDY, true); private static final BlockState SOUTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.SOUTH) .with(Tile.SINGLE, false); @@ -65,171 +57,115 @@ public Level0Room(Codec configFactory) { private static final BlockState TORN_WALLPAPER_4 = Backrooms.TORN_WALLPAPER.getDefaultState() .with(TornWallpaper.TORN_LEVEL, 4); private static final BlockState VENT = Backrooms.VENT.getDefaultState(); + private static final BlockState STAIR = Backrooms.CARPET_STAIRS.getDefaultState() + .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) + .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); -// private static Integer[][] WallsTop = Layout.getLayout("level0_1", 5, 0); -// private static Integer[][] WallsBottom = Layout.getLayout("level0_1", 4, 0); -// private static List LayoutsTop = Layout.listLayouts(32, "level0", 10, 0, 1, 2, 3, 4, 5, 6, 7, 8); -// private static List LayoutsBottom = Layout.listLayouts(32, "level0", 9, 0, 0, 0, 0, 0, 0, 0, 0, 0); -// private static Integer[][] layoutTest = Layout.getLayout("level0test", 10, 0, 1, 2, 3, 4, 5, 6, 7, 8); -// private static Integer[][] layoutTestBottom = Layout.getLayout("level0test", 9, 0, 1, 2, 3, 4, 5, 6, 7, 8); - - private static List LayoutsTop = Layout.listLayouts(4, "level0", 10, 0, 1, 2, 3, 4, 5, 6, 7, 8); - private static List LayoutsBottom = Layout.listLayouts(4, "level0", 9, 0, 1, 2, 3, 4, 5, 6, 7, 8); + private static List LayoutsTop = Layout.listLayouts(27, "level01", 1, 0, new Layout()); + private static List LayoutsBottom = Layout.listLayouts(27, "level01", 2, 0, new Layout()); + private static Integer[][] Roof = Layout.getColoredLayout("roof", 0, 0, 3, 0, 6, 5, 4, 0, 0, 0, new Layout()); + private static Integer[][] Floor = Layout.getLayout("whiteblock", 0, 7, new Layout()); public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random rand, BlockPos position, DefaultFeatureConfig featureConfig) { BlockPos.Mutable mutableBlockPos = new BlockPos.Mutable().set(position); - boolean red; - boolean red2; - boolean green; - boolean green2; - boolean blue; - boolean blue2; - boolean purple; - boolean purple2; - red = rand.nextBoolean(); - red2 = rand.nextBoolean(); - green = rand.nextBoolean(); - green2 = rand.nextBoolean(); - blue = rand.nextBoolean(); - blue2 = rand.nextBoolean(); - purple = rand.nextBoolean(); - purple2 = rand.nextBoolean(); - int layoutInt; + int layoutInt = 0; if (rand.nextDouble() < 0.7) { layoutInt = 0; } else if (rand.nextDouble() < 0.8) { - if (rand.nextDouble() < 0.5) { - layoutInt = 1; - } else { - layoutInt = 2; + int k = rand.nextInt(9); + switch (k) { + case 0: + layoutInt = 8; + break; + case 1: + layoutInt = 9; + break; + case 2: + layoutInt = 10; + break; + case 3: + layoutInt = 11; + break; + case 4: + layoutInt = 17; + break; + case 5: + layoutInt = 18; + break; + case 6: + layoutInt = 19; + break; + case 7: + layoutInt = 20; + break; + case 8: + layoutInt = 25; + break; + case 9: + layoutInt = 26; + break; } - } else if (rand.nextDouble() < 0.5) { + } else { if (rand.nextDouble() < 0.5) { - layoutInt = 3; + layoutInt = 100; } else { - layoutInt = 4; + layoutInt = rand.nextInt(27); } - } else { - layoutInt = 0; } - Integer[][] layoutTop = LayoutsTop.get(layoutInt); - Integer[][] layoutBottom = LayoutsBottom.get(layoutInt); - - generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand, red, red2, green, green2, blue, - blue2, purple, purple2); - generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand, red, red2, green, green2, blue, - blue2, purple, purple2); - generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand, red, red2, green, green2, blue, - blue2, purple, purple2); - generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutBottom, rand, red, red2, green, green2, blue, - blue2, purple, purple2); - -// generateSlice(world, mutableBlockPos.move(Direction.DOWN), WallsTop, rand, red, green, blue); -// generateSlice(world, mutableBlockPos.move(Direction.DOWN), WallsTop, rand, red, green, blue); -// generateSlice(world, mutableBlockPos.move(Direction.DOWN), WallsTop, rand, red, green, blue); -// generateSlice(world, mutableBlockPos.move(Direction.DOWN), WallsTop, rand, red, green, blue); + if (layoutInt == 100) { + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.One, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Four, rand, + Backrooms.WALLPAPER, Backrooms.TORN_WALLPAPER, STAIR, Backrooms.CARPET, MOLDY_CARPET, true); + } else { + Integer[][] layoutTop = LayoutsTop.get(layoutInt); + Integer[][] layoutBottom = LayoutsBottom.get(layoutInt); -// if (generator.nextDouble() < 0.7) { -// generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); -// } else if (generator.nextDouble() < 0.8) { -// if (generator.nextDouble() < 0.5) { -// generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall1, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall2, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); -// } else { -// generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); -// } -// } else if (generator.nextDouble() < 0.5) { -// generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), StairWall, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1Light, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1Light, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1NoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), StairWall, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); -// } else { -// generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); -// generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); -// } + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Roof, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutBottom, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Floor, rand); + } return true; } - private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, Integer[][] slice, Random rand, - boolean red, boolean red2, boolean green, boolean green2, boolean blue, boolean blue2, boolean purple, - boolean purple2) { + private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, Integer[][] slice, Random rand) { -// BlockPos currentPositionOffsetted = new BlockPos(centerPos.add(-1, 3, slice[0].length)); BlockPos.Mutable currentPosition = new BlockPos.Mutable(centerPos.getX() - 1, centerPos.getY(), centerPos.getZ()); @@ -240,88 +176,85 @@ private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, if (((world.getBlockState(currentPosition).getBlock() == Backrooms.WALL) || (world.getBlockState(currentPosition).getBlock() == Blocks.BEDROCK)) && (world.getBlockState(currentPosition).getBlock() != Backrooms.CARPET_STAIRS)) { - -// if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { -// Level0Room.door1 = rand.nextBoolean(); -// } if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { - Level0Room.door1 = true; + door1 = true; } else { - Level0Room.door1 = false; + door1 = false; } -// if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { -// Level0Room.door2 = true; -// } else { -// Level0Room.door2 = false; -// } -// if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { -// Level0Room.door3 = true; -// } else { -// Level0Room.door3 = false; -// } -// if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { -// Level0Room.door4 = true; -// } else { -// Level0Room.door4 = false; -// } switch (sliceBlock) { - case 0: world.setBlockState(currentPosition, AIR, 2); break; case 1: - if (red) { - if (rand.nextDouble() < 0.005) { - int k = rand.nextInt(4); - switch (k) { - case 0: - world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); - break; - case 1: - world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); - break; - case 2: - world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); - break; - case 3: - world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); - break; - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); + if (rand.nextDouble() < 0.005) { + int k = rand.nextInt(4); + switch (k) { + case 0: + world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); + break; + case 1: + world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); + break; + case 2: + world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); + break; + case 3: + world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); + break; } } else { - world.setBlockState(currentPosition, AIR, 2); + world.setBlockState(currentPosition, WALLPAPER, 2); } break; case 2: - if (red2) { - if (rand.nextDouble() < 0.005) { - int k = rand.nextInt(4); - switch (k) { - case 0: - world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); - break; - case 1: - world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); - break; - case 2: - world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); - break; - case 3: - world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); - break; - } + if (door1) { + BlockState placement; + if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor && rand.nextDouble() < 0.1) { + placement = VOID_BLOCK; } else { - world.setBlockState(currentPosition, WALLPAPER, 2); + placement = AIR; + } + world.setBlockState(currentPosition, placement, 2); + world.setBlockState(currentPosition.add(0, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 1), placement, 2); + if (BackroomsConfig.getInstance().TallDoors) { + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 1), placement, 2); } } else { - world.setBlockState(currentPosition, AIR, 2); - } - break; - case 3: - if (green) { if (rand.nextDouble() < 0.005) { int k = rand.nextInt(4); switch (k) { @@ -341,387 +274,43 @@ private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, } else { world.setBlockState(currentPosition, WALLPAPER, 2); } - } else { - world.setBlockState(currentPosition, AIR, 2); + } + break; + case 3: + world.setBlockState(currentPosition, NORTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; case 4: - if (green2) { - if (rand.nextDouble() < 0.005) { - int k = rand.nextInt(4); - switch (k) { - case 0: - world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); - break; - case 1: - world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); - break; - case 2: - world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); - break; - case 3: - world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); - break; - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); - } - } else { - world.setBlockState(currentPosition, AIR, 2); + world.setBlockState(currentPosition, SOUTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; case 5: - if (blue) { - if (rand.nextDouble() < 0.005) { - int k = rand.nextInt(4); - switch (k) { - case 0: - world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); - break; - case 1: - world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); - break; - case 2: - world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); - break; - case 3: - world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); - break; - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); - } - } else { - world.setBlockState(currentPosition, AIR, 2); + world.setBlockState(currentPosition, TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; case 6: - if (blue2) { - if (rand.nextDouble() < 0.005) { - int k = rand.nextInt(4); - switch (k) { - case 0: - world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); - break; - case 1: - world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); - break; - case 2: - world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); - break; - case 3: - world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); - break; - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); - } - } else { - world.setBlockState(currentPosition, AIR, 2); - } + world.setBlockState(currentPosition, LIGHT, 2); break; case 7: - if (purple) { - if (rand.nextDouble() < 0.005) { - int k = rand.nextInt(4); - switch (k) { - case 0: - world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); - break; - case 1: - world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); - break; - case 2: - world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); - break; - case 3: - world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); - break; - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); - } - } else { - world.setBlockState(currentPosition, AIR, 2); - } - break; - case 8: - if (purple2) { - if (rand.nextDouble() < 0.005) { - int k = rand.nextInt(4); - switch (k) { - case 0: - world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); - break; - case 1: - world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); - break; - case 2: - world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); - break; - case 3: - world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); - break; - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); - } - } else { - world.setBlockState(currentPosition, AIR, 2); - } - break; - - case 9: - if (door1) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 1), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, 1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, 1), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, 1), AIR, 2); - } + if (rand.nextDouble() < 0.01) { + world.setBlockState(currentPosition, MOLDY_CARPET, 2); } else { - if (rand.nextDouble() < 0.005) { - int k = rand.nextInt(4); - switch (k) { - case 0: - world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); - break; - case 1: - world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); - break; - case 2: - world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); - break; - case 3: - world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); - break; - } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); - } + world.setBlockState(currentPosition, CARPET, 2); } - break; - case 10: - if (rand.nextDouble() < 0.005) { - int k = rand.nextInt(4); - switch (k) { - case 0: - world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); - break; - case 1: - world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); - break; - case 2: - world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); - break; - case 3: - world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); - break; + if (rand.nextDouble() < 0.001) { + if (rand.nextDouble() < BackroomsConfig.getInstance().ChestSpawnChance) { + world.setBlockState(currentPosition.add(0, 1, 0), CHEST, 2); + LootableContainerBlockEntity.setLootTable(world, rand, currentPosition.add(0, 1, 0), + Backrooms.LEVEL0CHEST); } - } else { - world.setBlockState(currentPosition, WALLPAPER, 2); } break; - -// case 0: -// break; -// case 2: -// world.setBlockState(currentPosition, SOUTH_TILE, 2); -// if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { -// world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); -// } -// break; -// case 11: -// world.setBlockState(currentPosition, NORTH_TILE, 2); -// if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { -// world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); -// } -// break; -// case 12: -// world.setBlockState(currentPosition, TILE, 2); -// if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { -// world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); -// } -// break; -// case 3: -// world.setBlockState(currentPosition, LIGHT, 2); -// break; -// case 4: -// world.setBlockState(currentPosition, AIR, 2); -// break; -// case 5: -// if (rand.nextDouble() < 0.005) { -// int k = rand.nextInt(4); -// switch (k) { -// case 0: -// world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); -// break; -// case 1: -// world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); -// break; -// case 2: -// world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); -// break; -// case 3: -// world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); -// break; -// } -// } else { -// world.setBlockState(currentPosition, WALLPAPER, 2); -// } -// break; -// case 6: -// if (door1) { -// world.setBlockState(currentPosition, AIR, 2); -// world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); -// world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); -// world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); -// world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); -// world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 2); -// if (BackroomsConfig.getInstance().TallDoors) { -// world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); -// world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); -// } -// } else { -// world.setBlockState(currentPosition, WALLPAPER, 2); -// } -// break; -// case 7: -// if (door2) { -// world.setBlockState(currentPosition, AIR, 3); -// world.setBlockState(currentPosition.add(0, 1, 0), AIR, 3); -// world.setBlockState(currentPosition.add(0, 2, 0), AIR, 3); -// world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 3); -// world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 3); -// world.setBlockState(currentPosition.add(0, 0, -1), AIR, 3); -// world.setBlockState(currentPosition.add(0, 1, -1), AIR, 3); -// world.setBlockState(currentPosition.add(0, 2, -1), AIR, 3); -// world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 3); -// world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 3); -// world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 3); -// if (BackroomsConfig.getInstance().TallDoors) { -// world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); -// world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); -// } -// if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor) { -// world.setBlockState(currentPosition, VOID_BLOCK, 3); -// world.setBlockState(currentPosition.add(0, 1, 0), VOID_BLOCK, 3); -// world.setBlockState(currentPosition.add(0, 2, 0), VOID_BLOCK, 3); -// world.setBlockState(currentPosition.add(-1, 0, 0), VOID_BLOCK, 3); -// world.setBlockState(currentPosition.add(-1, 1, 0), VOID_BLOCK, 3); -// world.setBlockState(currentPosition.add(-1, 2, 0), VOID_BLOCK, 3); -// if (BackroomsConfig.getInstance().TallDoors) { -// world.setBlockState(currentPosition.add(0, 3, 0), VOID_BLOCK, 2); -// world.setBlockState(currentPosition.add(-1, 3, 0), VOID_BLOCK, 2); -// } -// } else { -// world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 3); -// } -// -// } else { -// world.setBlockState(currentPosition, WALLPAPER, 2); -// } -// break; -// case 8: -// if (door3) { -// world.setBlockState(currentPosition, AIR, 3); -// world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); -// world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); -// world.setBlockState(currentPosition.add(0, 0, 1), AIR, 2); -// world.setBlockState(currentPosition.add(0, 1, 1), AIR, 2); -// world.setBlockState(currentPosition.add(0, 2, 1), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 0, 1), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 1, 1), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 2, 1), AIR, 2); -// if (BackroomsConfig.getInstance().TallDoors) { -// world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); -// world.setBlockState(currentPosition.add(0, 3, 1), AIR, 2); -// world.setBlockState(currentPosition.add(-1, 3, 1), AIR, 2); -// } -// } else { -// world.setBlockState(currentPosition, WALLPAPER, 2); -// } -// break; -// case 9: -// if (door4) { -// world.setBlockState(currentPosition, AIR, 2); -// world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); -// world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); -// world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); -// world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); -// world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); -// world.setBlockState(currentPosition.add(1, 0, 0), AIR, 2); -// world.setBlockState(currentPosition.add(1, 1, 0), AIR, 2); -// world.setBlockState(currentPosition.add(1, 2, 0), AIR, 2); -// world.setBlockState(currentPosition.add(1, 0, -1), AIR, 2); -// world.setBlockState(currentPosition.add(1, 1, -1), AIR, 2); -// world.setBlockState(currentPosition.add(1, 2, -1), AIR, 2); -// if (BackroomsConfig.getInstance().TallDoors) { -// world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); -// world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); -// world.setBlockState(currentPosition.add(1, 3, 0), AIR, 2); -// world.setBlockState(currentPosition.add(1, 3, -1), AIR, 2); -// } -// } else { -// world.setBlockState(currentPosition, WALLPAPER, 2); -// } -// break; -// case 10: -// world.setBlockState(currentPosition, CARPET_STAIRS, 2); -// break; -// case 1: -// if (rand.nextDouble() < 0.01) { -// world.setBlockState(currentPosition, MOLDY_CARPET, 2); -// } else { -// world.setBlockState(currentPosition, CARPET, 2); -// } -// if (rand.nextDouble() < 0.001) { -// if (rand.nextDouble() < BackroomsConfig.getInstance().ChestSpawnChance) { -// world.setBlockState(currentPosition.add(0, 1, 0), CHEST, 2); -// LootableContainerBlockEntity.setLootTable(world, rand, currentPosition.add(0, 1, 0), -// Backrooms.LEVEL0CHEST); -// } -// } -// break; } } currentPosition.move(Direction.SOUTH); diff --git a/src/main/java/net/ludocrypt/backrooms/features/Level1OffRoom.java b/src/main/java/net/ludocrypt/backrooms/features/Level1OffRoom.java index 4d43b1b..84b5dda 100644 --- a/src/main/java/net/ludocrypt/backrooms/features/Level1OffRoom.java +++ b/src/main/java/net/ludocrypt/backrooms/features/Level1OffRoom.java @@ -1,5 +1,6 @@ package net.ludocrypt.backrooms.features; +import java.util.List; import java.util.Random; import com.mojang.serialization.Codec; @@ -9,6 +10,7 @@ import net.ludocrypt.backrooms.blocks.Light; import net.ludocrypt.backrooms.blocks.Tile; import net.ludocrypt.backrooms.config.BackroomsConfig; +import net.ludocrypt.imagereader.Layout; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.ChestBlock; @@ -29,92 +31,10 @@ public Level1OffRoom(Codec configFactory) { super(configFactory); } - public static boolean door1 = true; - public static boolean door2 = true; - public static boolean door3 = true; - public static boolean door4 = true; + private boolean door1 = true; - private int[][] One = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Two = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Three = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Four = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] OneNoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] TwoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway1NoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 7, 4, 4, 4, 4, 8, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway1Light = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 7, 4, 4, 4, 4, 8, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Wall1 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Wall2 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2NoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Light = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Stair1Light = { { 0, 0, 0, 0, 0, 10, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 1, 10, 4, 4, 4, 4, 4, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 1, 1, 10, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 10, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 1, 10, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 10, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Stair1NoLight = { { 0, 0, 0, 0, 0, 10, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 1, 10, 4, 4, 4, 4, 4, 3, 3, 2, 11 }, { 5, 5, 5, 5, 5, 1, 1, 10, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 10, 4, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 1, 10, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 10, 4, 4, 4, 4, 8 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - - private int[][] StairWall = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - - private static final BlockState CEMENT_BRICKS = Backrooms.CEMENT_BRICKS.getDefaultState(); private static final BlockState CEMENT = Backrooms.CEMENT.getDefaultState(); - private static final BlockState CEMENT_STAIRS = Backrooms.CEMENT_STAIRS.getDefaultState() - .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) - .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); + private static final BlockState CEMENT_BRICKS = Backrooms.CEMENT_BRICKS.getDefaultState(); private static final BlockState SOUTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.SOUTH) .with(Tile.SINGLE, false); private static final BlockState NORTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.NORTH) @@ -127,306 +47,225 @@ public Level1OffRoom(Codec configFactory) { .with(ChestBlock.FACING, Direction.NORTH).with(ChestBlock.WATERLOGGED, false); private static final BlockState VOID_BLOCK = Backrooms.VOID_BLOCK.getDefaultState(); private static final BlockState VENT = Backrooms.VENT.getDefaultState(); + private static final BlockState STAIR = Backrooms.CEMENT_STAIRS.getDefaultState() + .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) + .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); + + private static List LayoutsTop = Layout.listLayouts(27, "level01", 1, 0, new Layout()); + private static List LayoutsBottom = Layout.listLayouts(27, "level01", 2, 0, new Layout()); + private static Integer[][] Roof = Layout.getColoredLayout("roof", 0, 0, 3, 0, 6, 5, 4, 0, 0, 0, new Layout()); + private static Integer[][] Floor = Layout.getLayout("whiteblock", 0, 7, new Layout()); public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random rand, BlockPos position, DefaultFeatureConfig featureConfig) { - - Random generator = new Random(world.getSeed()); - long seed = world.getSeed(); - long l = generator.nextLong(); - long m = generator.nextLong(); - long n = generator.nextLong(); - long o = position.getX() * l ^ position.getY() * m ^ position.getZ() * n ^ seed * 5; - generator = new Random(o); - BlockPos.Mutable mutableBlockPos = new BlockPos.Mutable().set(position); + int layoutInt = 0; - if (generator.nextDouble() < 0.5) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); - } else if (generator.nextDouble() < 0.5) { - if (generator.nextDouble() < 0.5) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall1, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall2, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + if (rand.nextDouble() < 0.7) { + layoutInt = 0; + } else if (rand.nextDouble() < 0.8) { + int k = rand.nextInt(9); + switch (k) { + case 0: + layoutInt = 8; + break; + case 1: + layoutInt = 9; + break; + case 2: + layoutInt = 10; + break; + case 3: + layoutInt = 11; + break; + case 4: + layoutInt = 17; + break; + case 5: + layoutInt = 18; + break; + case 6: + layoutInt = 19; + break; + case 7: + layoutInt = 20; + break; + case 8: + layoutInt = 25; + break; + case 9: + layoutInt = 26; + break; + } + } else { + if (rand.nextDouble() < 0.5) { + layoutInt = 100; } else { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + layoutInt = rand.nextInt(27); } - } else if (generator.nextDouble() < 0.3) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), StairWall, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), StairWall, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + } + + if (layoutInt == 100) { + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.One, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Four, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, false); } else { - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); + Integer[][] layoutTop = LayoutsTop.get(layoutInt); + Integer[][] layoutBottom = LayoutsBottom.get(layoutInt); + + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Roof, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutBottom, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Floor, rand); } return true; } - private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, int[][] slice, Random rand) { + private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, Integer[][] slice, Random rand) { - BlockPos currentPositionOffsetted = new BlockPos(centerPos.add(-1, 3, -slice[0].length)); - BlockPos.Mutable currentPosition = new BlockPos.Mutable(currentPositionOffsetted.getX(), - currentPositionOffsetted.getY(), currentPositionOffsetted.getZ()); + BlockPos.Mutable currentPosition = new BlockPos.Mutable(centerPos.getX() - 1, centerPos.getY(), + centerPos.getZ()); - for (int y = 0; y < slice.length; y++) { + for (int x = 0; x < slice.length; x++) { for (int z = 0; z < slice[0].length; z++) { - int sliceBlock = slice[y][z]; + int sliceBlock = slice[x][z]; if (((world.getBlockState(currentPosition).getBlock() == Backrooms.WALL) || (world.getBlockState(currentPosition).getBlock() == Blocks.BEDROCK)) - && (world.getBlockState(currentPosition).getBlock() != Backrooms.CEMENT_STAIRS)) { - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level1DoorChance))) { - Level1OffRoom.door1 = true; - } else { - Level1OffRoom.door1 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level1DoorChance))) { - Level1OffRoom.door2 = true; - } else { - Level1OffRoom.door2 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level1DoorChance))) { - Level1OffRoom.door3 = true; - } else { - Level1OffRoom.door3 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level1DoorChance))) { - Level1OffRoom.door4 = true; + && (world.getBlockState(currentPosition).getBlock() != Backrooms.CARPET_STAIRS)) { + if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { + door1 = true; } else { - Level1OffRoom.door4 = false; + door1 = false; } switch (sliceBlock) { case 0: - break; - case 2: - - world.setBlockState(currentPosition, SOUTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 11: - world.setBlockState(currentPosition, NORTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 12: - world.setBlockState(currentPosition, TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 3: - world.setBlockState(currentPosition, LIGHT, 2); - break; - case 4: world.setBlockState(currentPosition, AIR, 2); break; - case 5: + case 1: world.setBlockState(currentPosition, CEMENT_BRICKS, 2); break; - case 6: + case 2: if (door1) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 2); + BlockState placement; + if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor && rand.nextDouble() < 0.1) { + placement = VOID_BLOCK; + } else { + placement = AIR; + } + world.setBlockState(currentPosition, placement, 2); + world.setBlockState(currentPosition.add(0, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 1), placement, 2); if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 1), placement, 2); } } else { world.setBlockState(currentPosition, CEMENT_BRICKS, 2); } break; - case 7: - if (door2) { - world.setBlockState(currentPosition, AIR, 3); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 3); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 3); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 3); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 3); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 3); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 3); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 3); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); - } - if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor) { - world.setBlockState(currentPosition, VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(0, 1, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(0, 2, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 0, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 1, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 2, 0), VOID_BLOCK, 3); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), VOID_BLOCK, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), VOID_BLOCK, 2); - } - } else { - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 3); - } - - } else { - world.setBlockState(currentPosition, CEMENT_BRICKS, 2); + case 3: + world.setBlockState(currentPosition, NORTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 8: - if (door3) { - world.setBlockState(currentPosition, AIR, 3); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 1), AIR, 2); - } - } else { - world.setBlockState(currentPosition, CEMENT_BRICKS, 2); + case 4: + world.setBlockState(currentPosition, SOUTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 9: - if (door4) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, -1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, -1), AIR, 2); - } - } else { - world.setBlockState(currentPosition, CEMENT_BRICKS, 2); + case 5: + world.setBlockState(currentPosition, TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 10: - world.setBlockState(currentPosition, CEMENT_STAIRS, 2); + case 6: + world.setBlockState(currentPosition, LIGHT, 2); break; - case 1: - if (rand.nextDouble() < 0.005) { + case 7: + world.setBlockState(currentPosition, CEMENT, 2); + if (rand.nextDouble() < 0.001) { if (rand.nextDouble() < BackroomsConfig.getInstance().ChestSpawnChance) { world.setBlockState(currentPosition.add(0, 1, 0), CHEST, 2); LootableContainerBlockEntity.setLootTable(world, rand, currentPosition.add(0, 1, 0), Backrooms.LEVEL1CHEST); } } - world.setBlockState(currentPosition, CEMENT, 2); break; } } currentPosition.move(Direction.SOUTH); } - currentPosition.move(0, -1, -slice[0].length); + currentPosition.move(-1, 0, -slice[0].length); } } } \ No newline at end of file diff --git a/src/main/java/net/ludocrypt/backrooms/features/Level1Room.java b/src/main/java/net/ludocrypt/backrooms/features/Level1Room.java index 121dc2d..3af3e86 100644 --- a/src/main/java/net/ludocrypt/backrooms/features/Level1Room.java +++ b/src/main/java/net/ludocrypt/backrooms/features/Level1Room.java @@ -1,5 +1,6 @@ package net.ludocrypt.backrooms.features; +import java.util.List; import java.util.Random; import com.mojang.serialization.Codec; @@ -8,6 +9,7 @@ import net.ludocrypt.backrooms.blocks.BackroomsStairs; import net.ludocrypt.backrooms.blocks.Tile; import net.ludocrypt.backrooms.config.BackroomsConfig; +import net.ludocrypt.imagereader.Layout; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.ChestBlock; @@ -28,92 +30,10 @@ public Level1Room(Codec configFactory) { super(configFactory); } - public static boolean door1 = true; - public static boolean door2 = true; - public static boolean door3 = true; - public static boolean door4 = true; + private boolean door1 = true; - private int[][] One = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Two = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Three = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Four = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] OneNoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] TwoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway1NoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 7, 4, 4, 4, 4, 8, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway1Light = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 7, 4, 4, 4, 4, 8, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Wall1 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Wall2 = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2NoLight = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Hallway2Light = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Stair1Light = { { 0, 0, 0, 0, 0, 10, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 1, 10, 4, 4, 4, 4, 4, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 1, 1, 10, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 10, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 1, 10, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 10, 4, 4, 4, 4, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - private int[][] Stair1NoLight = { { 0, 0, 0, 0, 0, 10, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0 }, - { 2, 11, 3, 3, 2, 1, 10, 4, 4, 4, 4, 4, 3, 3, 2, 11 }, { 5, 5, 5, 5, 5, 1, 1, 10, 4, 4, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 10, 4, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 1, 10, 4, 4, 4, 4, 4, 5 }, - { 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 10, 4, 4, 4, 4, 8 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - - private int[][] StairWall = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8, 8 }, - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; - - private static final BlockState CEMENT_BRICKS = Backrooms.CEMENT_BRICKS.getDefaultState(); private static final BlockState CEMENT = Backrooms.CEMENT.getDefaultState(); - private static final BlockState CEMENT_STAIRS = Backrooms.CEMENT_STAIRS.getDefaultState() - .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) - .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); + private static final BlockState CEMENT_BRICKS = Backrooms.CEMENT_BRICKS.getDefaultState(); private static final BlockState SOUTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.SOUTH) .with(Tile.SINGLE, false); private static final BlockState NORTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.NORTH) @@ -126,307 +46,225 @@ public Level1Room(Codec configFactory) { .with(ChestBlock.FACING, Direction.NORTH).with(ChestBlock.WATERLOGGED, false); private static final BlockState VOID_BLOCK = Backrooms.VOID_BLOCK.getDefaultState(); private static final BlockState VENT = Backrooms.VENT.getDefaultState(); + private static final BlockState STAIR = Backrooms.CEMENT_STAIRS.getDefaultState() + .with(BackroomsStairs.FACING, Direction.NORTH).with(BackroomsStairs.HALF, BlockHalf.BOTTOM) + .with(BackroomsStairs.SHAPE, StairShape.STRAIGHT); + + private static List LayoutsTop = Layout.listLayouts(27, "level01", 1, 0, new Layout()); + private static List LayoutsBottom = Layout.listLayouts(27, "level01", 2, 0, new Layout()); + private static Integer[][] Roof = Layout.getColoredLayout("roof", 0, 0, 3, 0, 6, 5, 4, 0, 0, 0, new Layout()); + private static Integer[][] Floor = Layout.getLayout("whiteblock", 0, 7, new Layout()); public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random rand, BlockPos position, DefaultFeatureConfig featureConfig) { - - Random generator = new Random(world.getSeed()); - long seed = world.getSeed(); - long l = generator.nextLong(); - long m = generator.nextLong(); - long n = generator.nextLong(); - long o = position.getX() * l ^ position.getY() * m ^ position.getZ() * n ^ seed * 5; - generator = new Random(o); - BlockPos.Mutable mutableBlockPos = new BlockPos.Mutable().set(position); + int layoutInt = 0; - if (generator.nextDouble() < 0.5) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); - } else if (generator.nextDouble() < 0.5) { - if (generator.nextDouble() < 0.5) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall1, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Wall2, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway2NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + if (rand.nextDouble() < 0.7) { + layoutInt = 0; + } else if (rand.nextDouble() < 0.8) { + int k = rand.nextInt(9); + switch (k) { + case 0: + layoutInt = 8; + break; + case 1: + layoutInt = 9; + break; + case 2: + layoutInt = 10; + break; + case 3: + layoutInt = 11; + break; + case 4: + layoutInt = 17; + break; + case 5: + layoutInt = 18; + break; + case 6: + layoutInt = 19; + break; + case 7: + layoutInt = 20; + break; + case 8: + layoutInt = 25; + break; + case 9: + layoutInt = 26; + break; + } + } else { + if (rand.nextDouble() < 0.5) { + layoutInt = 100; } else { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Hallway1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + layoutInt = rand.nextInt(27); } - } else if (generator.nextDouble() < 0.3) { - generateSlice(world, mutableBlockPos.move(Direction.EAST), One, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), StairWall, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1Light, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Stair1NoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), StairWall, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Three, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Two, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), Four, rand); + } + + if (layoutInt == 100) { + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.One, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1Light, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Stair1NoLight, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.StairWall, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Three, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Two, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); + RoomArchives.generateSlice(world, mutableBlockPos.move(Direction.EAST), RoomArchives.Four, rand, + Backrooms.CEMENT_BRICKS, null, STAIR, Backrooms.CEMENT, null, true); } else { - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), TwoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); - generateSlice(world, mutableBlockPos.move(Direction.EAST), OneNoLight, rand); + Integer[][] layoutTop = LayoutsTop.get(layoutInt); + Integer[][] layoutBottom = LayoutsBottom.get(layoutInt); + + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Roof, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutTop, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), layoutBottom, rand); + generateSlice(world, mutableBlockPos.move(Direction.DOWN), Floor, rand); } return true; } - private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, int[][] slice, Random rand) { + private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, Integer[][] slice, Random rand) { - BlockPos currentPositionOffsetted = new BlockPos(centerPos.add(-1, 3, -slice[0].length)); - BlockPos.Mutable currentPosition = new BlockPos.Mutable(currentPositionOffsetted.getX(), - currentPositionOffsetted.getY(), currentPositionOffsetted.getZ()); + BlockPos.Mutable currentPosition = new BlockPos.Mutable(centerPos.getX() - 1, centerPos.getY(), + centerPos.getZ()); - for (int y = 0; y < slice.length; y++) { + for (int x = 0; x < slice.length; x++) { for (int z = 0; z < slice[0].length; z++) { - int sliceBlock = slice[y][z]; + int sliceBlock = slice[x][z]; if (((world.getBlockState(currentPosition).getBlock() == Backrooms.WALL) || (world.getBlockState(currentPosition).getBlock() == Blocks.BEDROCK)) - && (world.getBlockState(currentPosition).getBlock() != Backrooms.CEMENT_STAIRS)) { - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level1DoorChance))) { - Level1Room.door1 = true; - } else { - Level1Room.door1 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level1DoorChance))) { - Level1Room.door2 = true; - } else { - Level1Room.door2 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level1DoorChance))) { - Level1Room.door3 = true; - } else { - Level1Room.door3 = false; - } - if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level1DoorChance))) { - Level1Room.door4 = true; + && (world.getBlockState(currentPosition).getBlock() != Backrooms.CARPET_STAIRS)) { + if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { + door1 = true; } else { - Level1Room.door4 = false; + door1 = false; } switch (sliceBlock) { case 0: - break; - case 2: - - world.setBlockState(currentPosition, SOUTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 11: - world.setBlockState(currentPosition, NORTH_TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 12: - world.setBlockState(currentPosition, TILE, 2); - if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { - world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); - } - break; - case 3: - world.setBlockState(currentPosition, LIGHT, 2); - break; - case 4: world.setBlockState(currentPosition, AIR, 2); break; - case 5: + case 1: world.setBlockState(currentPosition, CEMENT_BRICKS, 2); break; - case 6: + case 2: if (door1) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 2); + BlockState placement; + if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor && rand.nextDouble() < 0.1) { + placement = VOID_BLOCK; + } else { + placement = AIR; + } + world.setBlockState(currentPosition, placement, 2); + world.setBlockState(currentPosition.add(0, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(0, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 0, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 1, -1), placement, 2); + world.setBlockState(currentPosition.add(1, 2, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 0, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 1, 1), placement, 2); + world.setBlockState(currentPosition.add(-1, 2, 1), placement, 2); if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(0, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 0), placement, 2); + world.setBlockState(currentPosition.add(1, 3, 1), placement, 2); + world.setBlockState(currentPosition.add(1, 3, -1), placement, 2); + world.setBlockState(currentPosition.add(-1, 3, 1), placement, 2); } } else { world.setBlockState(currentPosition, CEMENT_BRICKS, 2); } break; - case 7: - if (door2) { - world.setBlockState(currentPosition, AIR, 3); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 3); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 3); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 3); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 3); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 3); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 3); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 3); - world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 3); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); - } - if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor) { - world.setBlockState(currentPosition, VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(0, 1, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(0, 2, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 0, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 1, 0), VOID_BLOCK, 3); - world.setBlockState(currentPosition.add(-1, 2, 0), VOID_BLOCK, 3); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), VOID_BLOCK, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), VOID_BLOCK, 2); - } - } else { - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 3); - } - - } else { - world.setBlockState(currentPosition, CEMENT_BRICKS, 2); + case 3: + world.setBlockState(currentPosition, NORTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 8: - if (door3) { - world.setBlockState(currentPosition, AIR, 3); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 0, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 1, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 2, 1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, 1), AIR, 2); - world.setBlockState(currentPosition.add(-1, 3, 1), AIR, 2); - } - } else { - world.setBlockState(currentPosition, CEMENT_BRICKS, 2); + case 4: + world.setBlockState(currentPosition, SOUTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - case 9: - if (door4) { - world.setBlockState(currentPosition, AIR, 2); - world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 0, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 1, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 2, -1), AIR, 2); - if (BackroomsConfig.getInstance().TallDoors) { - world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, 0), AIR, 2); - world.setBlockState(currentPosition.add(1, 3, -1), AIR, 2); - } - } else { - world.setBlockState(currentPosition, CEMENT_BRICKS, 2); + case 5: + world.setBlockState(currentPosition, TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); } break; - - case 10: - world.setBlockState(currentPosition, CEMENT_STAIRS, 2); + case 6: + world.setBlockState(currentPosition, LIGHT, 2); break; - case 1: - if (rand.nextDouble() < 0.005) { + case 7: + world.setBlockState(currentPosition, CEMENT, 2); + if (rand.nextDouble() < 0.001) { if (rand.nextDouble() < BackroomsConfig.getInstance().ChestSpawnChance) { world.setBlockState(currentPosition.add(0, 1, 0), CHEST, 2); LootableContainerBlockEntity.setLootTable(world, rand, currentPosition.add(0, 1, 0), Backrooms.LEVEL1CHEST); } } - world.setBlockState(currentPosition, CEMENT, 2); break; } } currentPosition.move(Direction.SOUTH); } - currentPosition.move(0, -1, -slice[0].length); + currentPosition.move(-1, 0, -slice[0].length); } } } \ No newline at end of file diff --git a/src/main/java/net/ludocrypt/backrooms/features/Level3Room.java b/src/main/java/net/ludocrypt/backrooms/features/Level3Room.java index 8646cff..7ac896a 100644 --- a/src/main/java/net/ludocrypt/backrooms/features/Level3Room.java +++ b/src/main/java/net/ludocrypt/backrooms/features/Level3Room.java @@ -218,6 +218,7 @@ public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerato return true; } + private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, int[][] slice, Random rand) { BlockPos currentPositionOffsetted = new BlockPos(centerPos.add(0, 3, slice[0].length)); @@ -261,7 +262,16 @@ private void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, break; case 7: world.setBlockState(currentPosition, FLOOR, 2); - if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor) { + if (rand.nextDouble() < BackroomsConfig.getInstance().Level3DoorChance) { + world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 4, 0), PIPE, 2); + world.setBlockState(currentPosition.add(0, 1, 1), AIR, 2); + world.setBlockState(currentPosition.add(0, 2, 1), AIR, 2); + world.setBlockState(currentPosition.add(0, 3, 1), AIR, 2); + world.setBlockState(currentPosition.add(0, 4, 1), PIPE, 2); + } else if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor) { if (rand.nextDouble() < 0.05) { world.setBlockState(currentPosition.add(0, 1, 0), VOID_BLOCK, 2); world.setBlockState(currentPosition.add(0, 2, 0), VOID_BLOCK, 2); diff --git a/src/main/java/net/ludocrypt/backrooms/features/LevelsFeatureInit.java b/src/main/java/net/ludocrypt/backrooms/features/LevelsFeatureInit.java index e7121b1..1f21c0e 100644 --- a/src/main/java/net/ludocrypt/backrooms/features/LevelsFeatureInit.java +++ b/src/main/java/net/ludocrypt/backrooms/features/LevelsFeatureInit.java @@ -13,7 +13,7 @@ import net.minecraft.world.gen.feature.Feature; public class LevelsFeatureInit { - public static Feature LEVEL01ROOF = new Level01Roof(DefaultFeatureConfig.CODEC); + public static Feature LEVEL0ROOM = new Level0Room(DefaultFeatureConfig.CODEC); public static Feature LEVEL0REDROOM = new Level0RedRoom(DefaultFeatureConfig.CODEC); public static Feature LEVEL0DOTTEDROOM = new Level0DottedRoom(DefaultFeatureConfig.CODEC); @@ -34,7 +34,7 @@ public class LevelsFeatureInit { public static Decorator LEVEL3DECORATOR = new Level3RoomDecorator(NopeDecoratorConfig.CODEC); public static void registerFeatures() { - Registry.register(Registry.FEATURE, new Identifier("backrooms", "level01roof"), LEVEL01ROOF); + Registry.register(Registry.FEATURE, new Identifier("backrooms", "level0room"), LEVEL0ROOM); Registry.register(Registry.FEATURE, new Identifier("backrooms", "level0redroom"), LEVEL0REDROOM); Registry.register(Registry.FEATURE, new Identifier("backrooms", "level0dottedroom"), LEVEL0DOTTEDROOM); diff --git a/src/main/java/net/ludocrypt/backrooms/features/RoomArchives.java b/src/main/java/net/ludocrypt/backrooms/features/RoomArchives.java new file mode 100644 index 0000000..be39463 --- /dev/null +++ b/src/main/java/net/ludocrypt/backrooms/features/RoomArchives.java @@ -0,0 +1,325 @@ +package net.ludocrypt.backrooms.features; + +import java.util.Random; + +import me.sargunvohra.mcmods.autoconfig1u.shadowed.blue.endless.jankson.annotation.Nullable; +import net.ludocrypt.backrooms.Backrooms; +import net.ludocrypt.backrooms.blocks.Light; +import net.ludocrypt.backrooms.blocks.Tile; +import net.ludocrypt.backrooms.blocks.TornWallpaper; +import net.ludocrypt.backrooms.config.BackroomsConfig; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.ChestBlock; +import net.minecraft.block.entity.LootableContainerBlockEntity; +import net.minecraft.block.enums.ChestType; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.ServerWorldAccess; + +public class RoomArchives { + + public static boolean door1 = true; + public static boolean door2 = true; + public static boolean door3 = true; + public static boolean door4 = true; + + public static int[][] One = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, + { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, + { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 6, 5, 6, 5, 6, 6, 6, 6, 5, 6, 5, 6, 5, 5 }, + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; + public static int[][] Two = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, + { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, + { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; + public static int[][] Three = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 2, 11, 3, 3, 2, 11, 12, 3, 3, 12, 2, 11, 3, 3, 2, 11 }, + { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, + { 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5 }, { 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8 }, + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; + public static int[][] Four = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, + { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, + { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 9, 5, 9, 5, 9, 9, 9, 9, 5, 9, 5, 9, 5, 5 }, + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; + public static int[][] Stair1Light = { { 0, 0, 0, 0, 0, 10, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0 }, + { 2, 11, 2, 11, 2, 1, 10, 4, 4, 4, 4, 4, 2, 11, 2, 11 }, + { 5, 5, 5, 5, 5, 1, 1, 10, 4, 4, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 10, 4, 4, 4, 4, 4, 4, 5 }, + { 5, 5, 5, 5, 5, 1, 1, 1, 1, 10, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 10, 4, 4, 4, 4, 8 }, + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; + public static int[][] Stair1NoLight = { { 0, 0, 0, 0, 0, 10, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0 }, + { 2, 11, 3, 3, 2, 1, 10, 4, 4, 4, 4, 4, 3, 3, 2, 11 }, { 5, 5, 5, 5, 5, 1, 1, 10, 4, 4, 4, 4, 4, 4, 4, 5 }, + { 5, 5, 5, 5, 5, 1, 1, 1, 10, 4, 4, 4, 4, 4, 4, 5 }, { 5, 5, 5, 5, 5, 1, 1, 1, 1, 10, 4, 4, 4, 4, 4, 5 }, + { 5, 5, 5, 5, 5, 1, 1, 1, 1, 1, 10, 4, 4, 4, 4, 8 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; + public static int[][] StairWall = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, + { 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11 }, + { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, + { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 }, { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 8, 8, 8, 8, 8, 8 }, + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }; + + private static final BlockState SOUTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.SOUTH) + .with(Tile.SINGLE, false); + private static final BlockState NORTH_TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.NORTH) + .with(Tile.SINGLE, false); + private static final BlockState TILE = Backrooms.TILE.getDefaultState().with(Tile.FACING, Direction.EAST) + .with(Tile.SINGLE, true); + private static final BlockState LIGHT = Backrooms.LIGHT.getDefaultState(); + private static final BlockState AIR = Blocks.AIR.getDefaultState(); + private static final BlockState CHEST = Blocks.CHEST.getDefaultState().with(ChestBlock.CHEST_TYPE, ChestType.SINGLE) + .with(ChestBlock.FACING, Direction.NORTH).with(ChestBlock.WATERLOGGED, false); + private static final BlockState VOID_BLOCK = Backrooms.VOID_BLOCK.getDefaultState(); + private static final BlockState VENT = Backrooms.VENT.getDefaultState(); + + public static void generateSlice(ServerWorldAccess world, BlockPos.Mutable centerPos, int[][] slice, Random rand, + Block wallpaper, @Nullable Block tornWallpaper, BlockState stair, Block floor, + @Nullable BlockState floorAlternative, boolean lightsOn) { + + BlockPos.Mutable currentPosition = new BlockPos.Mutable(centerPos.getX() - 1 - 16, centerPos.getY(), + centerPos.getZ()); + BlockState WALLPAPER = wallpaper.getDefaultState(); + BlockState TORN_WALLPAPER_1; + BlockState TORN_WALLPAPER_2; + BlockState TORN_WALLPAPER_3; + BlockState TORN_WALLPAPER_4; + if (tornWallpaper != null) { + TORN_WALLPAPER_1 = tornWallpaper.getDefaultState().with(TornWallpaper.TORN_LEVEL, 1); + TORN_WALLPAPER_2 = tornWallpaper.getDefaultState().with(TornWallpaper.TORN_LEVEL, 2); + TORN_WALLPAPER_3 = tornWallpaper.getDefaultState().with(TornWallpaper.TORN_LEVEL, 3); + TORN_WALLPAPER_4 = tornWallpaper.getDefaultState().with(TornWallpaper.TORN_LEVEL, 4); + } else { + TORN_WALLPAPER_1 = wallpaper.getDefaultState(); + TORN_WALLPAPER_2 = wallpaper.getDefaultState(); + TORN_WALLPAPER_3 = wallpaper.getDefaultState(); + TORN_WALLPAPER_4 = wallpaper.getDefaultState(); + } + BlockState STAIRS = stair; + BlockState CARPET = floor.getDefaultState(); + BlockState MOLDY_CARPET; + if (floorAlternative != null) { + MOLDY_CARPET = floorAlternative; + } else { + MOLDY_CARPET = floor.getDefaultState(); + } + BlockState LIGHT; + if (lightsOn) { + LIGHT = Backrooms.LIGHT.getDefaultState(); + } else { + LIGHT = Backrooms.LIGHT.getDefaultState().with(Light.ON, false); + } + + for (int y = 0; y < slice.length; y++) { + for (int z = 0; z < slice[0].length; z++) { + int sliceBlock = slice[y][z]; + + if (((world.getBlockState(currentPosition).getBlock() == Backrooms.WALL) + || (world.getBlockState(currentPosition).getBlock() == Blocks.BEDROCK)) + && (world.getBlockState(currentPosition).getBlock() != Backrooms.CARPET_STAIRS)) { + + if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { + RoomArchives.door1 = true; + } else { + RoomArchives.door1 = false; + } + if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { + RoomArchives.door2 = true; + } else { + RoomArchives.door2 = false; + } + if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { + RoomArchives.door3 = true; + } else { + RoomArchives.door3 = false; + } + if ((rand.nextDouble()) < ((BackroomsConfig.getInstance().Level0DoorChance))) { + RoomArchives.door4 = true; + } else { + RoomArchives.door4 = false; + } + + switch (sliceBlock) { + case 0: + break; + case 2: + world.setBlockState(currentPosition, SOUTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); + } + break; + case 11: + world.setBlockState(currentPosition, NORTH_TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); + } + break; + case 12: + world.setBlockState(currentPosition, TILE, 2); + if (world.getBlockState(currentPosition.add(0, -1, 0)) == AIR && rand.nextDouble() < 0.25) { + world.setBlockState(currentPosition.add(0, -1, 0), VENT, 2); + } + break; + case 3: + world.setBlockState(currentPosition, LIGHT, 2); + break; + case 4: + world.setBlockState(currentPosition, AIR, 2); + break; + case 5: + if (rand.nextDouble() < 0.005) { + int k = rand.nextInt(4); + switch (k) { + case 0: + world.setBlockState(currentPosition, TORN_WALLPAPER_1, 2); + break; + case 1: + world.setBlockState(currentPosition, TORN_WALLPAPER_2, 2); + break; + case 2: + world.setBlockState(currentPosition, TORN_WALLPAPER_3, 2); + break; + case 3: + world.setBlockState(currentPosition, TORN_WALLPAPER_4, 2); + break; + } + } else { + world.setBlockState(currentPosition, WALLPAPER, 2); + } + break; + case 6: + if (door1) { + world.setBlockState(currentPosition, AIR, 2); + world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); + world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); + world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); + world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); + world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); + world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); + world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 2); + world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 2); + world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 2); + if (BackroomsConfig.getInstance().TallDoors) { + world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); + world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); + world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); + } + } else { + world.setBlockState(currentPosition, WALLPAPER, 2); + } + break; + case 7: + if (door2) { + world.setBlockState(currentPosition, AIR, 3); + world.setBlockState(currentPosition.add(0, 1, 0), AIR, 3); + world.setBlockState(currentPosition.add(0, 2, 0), AIR, 3); + world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 3); + world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 3); + world.setBlockState(currentPosition.add(0, 0, -1), AIR, 3); + world.setBlockState(currentPosition.add(0, 1, -1), AIR, 3); + world.setBlockState(currentPosition.add(0, 2, -1), AIR, 3); + world.setBlockState(currentPosition.add(-1, 0, -1), AIR, 3); + world.setBlockState(currentPosition.add(-1, 1, -1), AIR, 3); + world.setBlockState(currentPosition.add(-1, 2, -1), AIR, 3); + if (BackroomsConfig.getInstance().TallDoors) { + world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); + world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); + world.setBlockState(currentPosition.add(-1, 3, -1), AIR, 2); + } + if (rand.nextDouble() < BackroomsConfig.getInstance().VBDoor) { + world.setBlockState(currentPosition, VOID_BLOCK, 3); + world.setBlockState(currentPosition.add(0, 1, 0), VOID_BLOCK, 3); + world.setBlockState(currentPosition.add(0, 2, 0), VOID_BLOCK, 3); + world.setBlockState(currentPosition.add(-1, 0, 0), VOID_BLOCK, 3); + world.setBlockState(currentPosition.add(-1, 1, 0), VOID_BLOCK, 3); + world.setBlockState(currentPosition.add(-1, 2, 0), VOID_BLOCK, 3); + if (BackroomsConfig.getInstance().TallDoors) { + world.setBlockState(currentPosition.add(0, 3, 0), VOID_BLOCK, 2); + world.setBlockState(currentPosition.add(-1, 3, 0), VOID_BLOCK, 2); + } + } else { + world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 3); + } + + } else { + world.setBlockState(currentPosition, WALLPAPER, 2); + } + break; + case 8: + if (door3) { + world.setBlockState(currentPosition, AIR, 3); + world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); + world.setBlockState(currentPosition.add(-1, 0, 0), AIR, 2); + world.setBlockState(currentPosition.add(-1, 1, 0), AIR, 2); + world.setBlockState(currentPosition.add(-1, 2, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 0, 1), AIR, 2); + world.setBlockState(currentPosition.add(0, 1, 1), AIR, 2); + world.setBlockState(currentPosition.add(0, 2, 1), AIR, 2); + world.setBlockState(currentPosition.add(-1, 0, 1), AIR, 2); + world.setBlockState(currentPosition.add(-1, 1, 1), AIR, 2); + world.setBlockState(currentPosition.add(-1, 2, 1), AIR, 2); + if (BackroomsConfig.getInstance().TallDoors) { + world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); + world.setBlockState(currentPosition.add(-1, 3, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 3, 1), AIR, 2); + world.setBlockState(currentPosition.add(-1, 3, 1), AIR, 2); + } + } else { + world.setBlockState(currentPosition, WALLPAPER, 2); + } + break; + case 9: + if (door4) { + world.setBlockState(currentPosition, AIR, 2); + world.setBlockState(currentPosition.add(0, 1, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 2, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 0, -1), AIR, 2); + world.setBlockState(currentPosition.add(0, 1, -1), AIR, 2); + world.setBlockState(currentPosition.add(0, 2, -1), AIR, 2); + world.setBlockState(currentPosition.add(1, 0, 0), AIR, 2); + world.setBlockState(currentPosition.add(1, 1, 0), AIR, 2); + world.setBlockState(currentPosition.add(1, 2, 0), AIR, 2); + world.setBlockState(currentPosition.add(1, 0, -1), AIR, 2); + world.setBlockState(currentPosition.add(1, 1, -1), AIR, 2); + world.setBlockState(currentPosition.add(1, 2, -1), AIR, 2); + if (BackroomsConfig.getInstance().TallDoors) { + world.setBlockState(currentPosition.add(0, 3, 0), AIR, 2); + world.setBlockState(currentPosition.add(0, 3, -1), AIR, 2); + world.setBlockState(currentPosition.add(1, 3, 0), AIR, 2); + world.setBlockState(currentPosition.add(1, 3, -1), AIR, 2); + } + } else { + world.setBlockState(currentPosition, WALLPAPER, 2); + } + break; + case 10: + world.setBlockState(currentPosition, STAIRS, 2); + break; + case 1: + if (rand.nextDouble() < 0.01) { + world.setBlockState(currentPosition, MOLDY_CARPET, 2); + } else { + world.setBlockState(currentPosition, CARPET, 2); + } + + if (rand.nextDouble() < 0.001) { + if (rand.nextDouble() < BackroomsConfig.getInstance().ChestSpawnChance) { + world.setBlockState(currentPosition.add(0, 1, 0), CHEST, 2); + LootableContainerBlockEntity.setLootTable(world, rand, currentPosition.add(0, 1, 0), + Backrooms.LEVEL0CHEST); + } + } + break; + } + } + currentPosition.move(Direction.SOUTH); + } + currentPosition.move(0, -1, -slice[0].length); + } + } +} diff --git a/src/main/java/net/ludocrypt/backrooms/misc/BackroomsSoundEvents.java b/src/main/java/net/ludocrypt/backrooms/misc/BackroomsSoundEvents.java index 1ea4980..cf70c23 100644 --- a/src/main/java/net/ludocrypt/backrooms/misc/BackroomsSoundEvents.java +++ b/src/main/java/net/ludocrypt/backrooms/misc/BackroomsSoundEvents.java @@ -22,10 +22,12 @@ public class BackroomsSoundEvents { public static final SoundEvent MUSIC_DISC_BURGERS_AND_FRIES = register("backrooms:music_disc.burgers_and_fries"); public static final SoundEvent MUSIC_DISC_PRETZELS_AND_CHEESE = register("backrooms:music_disc.pretzels_and_cheese"); public static final SoundEvent TONE = register("backrooms:tone"); - public static final SoundEvent LEVEL0AMBIENCE = register("backrooms:level.0.ambience"); public static final SoundEvent GULP = register("backrooms:gulp"); - public static final SoundEvent BUZZ = register("backrooms:buzz"); public static final SoundEvent TEAR = register("backrooms:tear"); + public static final SoundEvent VENT = register("backrooms:vent"); + public static final SoundEvent SIZZLE = register("backrooms:sizzle"); + public static final SoundEvent HUMM_BUZZ_AROUND = register("backrooms:humm_buzz_around"); + public static final SoundEvent HUMM_BUZZ = register("backrooms:humm_buzz"); private static SoundEvent register(String id) { return (SoundEvent) Registry.register(Registry.SOUND_EVENT, (String) id, new SoundEvent(new Identifier(id))); diff --git a/src/main/java/net/ludocrypt/backrooms/misc/BuzzHandler.java b/src/main/java/net/ludocrypt/backrooms/misc/BuzzHandler.java new file mode 100644 index 0000000..69bb1a7 --- /dev/null +++ b/src/main/java/net/ludocrypt/backrooms/misc/BuzzHandler.java @@ -0,0 +1,79 @@ +package net.ludocrypt.backrooms.misc; + +import java.util.Random; + +import net.ludocrypt.backrooms.Backrooms; +import net.ludocrypt.backrooms.blocks.Light; +import net.ludocrypt.backrooms.config.BackroomsConfig; +import net.ludocrypt.backrooms.dimension.BDimension; +import net.ludocrypt.backrooms.mixin.WorldAccessor; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.Camera; +import net.minecraft.client.render.WorldRenderer; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.sound.SoundCategory; +import net.minecraft.sound.SoundEvent; +import net.minecraft.util.math.BlockPos; + +public class BuzzHandler { + + public static void buzzCheckingAndRunning(Camera cam, MinecraftClient client, WorldRenderer worldRenderer, + ClientWorld world) { + int rainTime = ((WorldAccessor) worldRenderer).rainSoundTime() == 0 ? 1 + : ((WorldAccessor) worldRenderer).rainSoundTime(); + long ticks = ((WorldAccessor) worldRenderer).ticks(); + BlockPos playerPos = cam.getBlockPos(); + int radius = BackroomsConfig.getInstance().SearchRange; + Random random = new Random(ticks * 312987231L); + + int numOfLight = 0; + BlockPos posOfLight = null; + int numOfVent = 0; + BlockPos posOfVent = null; + for (double x = playerPos.getX() - radius; x <= playerPos.getX() + radius; x++) { + for (double y = playerPos.getY() - radius; y <= playerPos.getY() + radius; y++) { + for (double z = playerPos.getZ() - radius; z <= playerPos.getZ() + radius; z++) { + BlockPos pos = new BlockPos(x, y, z); + if (world.getBlockState(pos) == Backrooms.LIGHT.getDefaultState().with(Light.ON, true)) { + numOfLight = numOfLight + 1; + if (numOfLight == 1) { + posOfLight = pos; + } + } + if (world.getBlockState(pos).getBlock() == Backrooms.VENT) { + numOfVent = numOfVent + 1; + if (numOfVent == 1) { + posOfVent = pos; + } + } + } + } + } + if (random.nextInt(3) < rainTime++ && !client.isPaused()) { + rainTime = 0; + SoundEvent buzz = BackroomsSoundEvents.HUMM_BUZZ; + if (client.player.isSubmergedInWater()) { + buzz = BackroomsSoundEvents.HUMM_BUZZ_AROUND; + } else { + buzz = BackroomsSoundEvents.HUMM_BUZZ; + } + if (numOfLight > 1) { + world.playSound(cam.getBlockPos(), buzz, SoundCategory.AMBIENT, 0.1F, 1.0F, false); + } else if (numOfLight == 1 && posOfLight != null) { + world.playSound(posOfLight, buzz, SoundCategory.AMBIENT, 0.1F, 1.0F, false); + } + if (numOfVent > 1) { + world.playSound(cam.getBlockPos(), BackroomsSoundEvents.VENT, SoundCategory.AMBIENT, 0.25F, 1.0F, + false); + } else if (numOfVent == 1 && posOfVent != null) { + world.playSound(posOfVent, BackroomsSoundEvents.VENT, SoundCategory.AMBIENT, 0.25F, 1.0F, false); + } + if ((world.getRegistryKey() == BDimension.LEVEL0WORLD || world.getRegistryKey() == BDimension.LEVEL1WORLD) + && numOfLight == 0) { + world.playSound(cam.getBlockPos(), BackroomsSoundEvents.HUMM_BUZZ_AROUND, SoundCategory.AMBIENT, 0.05F, + 0.8F, false); + } + } + } + +} diff --git a/src/main/java/net/ludocrypt/backrooms/misc/PreInitialize.java b/src/main/java/net/ludocrypt/backrooms/misc/PreInitialize.java index 64d9f46..6195621 100644 --- a/src/main/java/net/ludocrypt/backrooms/misc/PreInitialize.java +++ b/src/main/java/net/ludocrypt/backrooms/misc/PreInitialize.java @@ -2,12 +2,16 @@ import com.chocohead.mm.api.ClassTinkerers; +import net.fabricmc.loader.api.FabricLoader; +import net.fabricmc.loader.api.MappingResolver; + public interface PreInitialize { static void initialize() { - ClassTinkerers.enumBuilder("net.minecraft.world.biome.Biome$Category", String.class) - .addEnum("level0", () -> new Object[] { "level0" }).addEnum("level1", () -> new Object[] { "level1" }) - .addEnum("level2", () -> new Object[] { "level2" }).addEnum("level3", () -> new Object[] { "level3" }) - .build(); + MappingResolver remapper = FabricLoader.getInstance().getMappingResolver(); + String biomeCategory = remapper.mapClassName("intermediary", "net.minecraft.class_1959$class_1961"); + ClassTinkerers.enumBuilder(biomeCategory, String.class).addEnum("level0", () -> new Object[] { "level0" }) + .addEnum("level1", () -> new Object[] { "level1" }).addEnum("level2", () -> new Object[] { "level2" }) + .addEnum("level3", () -> new Object[] { "level3" }).build(); } } diff --git a/src/main/java/net/ludocrypt/backrooms/mixin/WorldAccessor.java b/src/main/java/net/ludocrypt/backrooms/mixin/WorldAccessor.java new file mode 100644 index 0000000..0d7e97d --- /dev/null +++ b/src/main/java/net/ludocrypt/backrooms/mixin/WorldAccessor.java @@ -0,0 +1,18 @@ +package net.ludocrypt.backrooms.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; + +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +import net.minecraft.client.render.WorldRenderer; + +@Environment(EnvType.CLIENT) +@Mixin(WorldRenderer.class) +public interface WorldAccessor { + @Accessor("field_20793") + public int rainSoundTime(); + + @Accessor("ticks") + public int ticks(); +} diff --git a/src/main/java/net/ludocrypt/imagereader/Layout.java b/src/main/java/net/ludocrypt/imagereader/Layout.java index f8cc9ee..dbe14f2 100644 --- a/src/main/java/net/ludocrypt/imagereader/Layout.java +++ b/src/main/java/net/ludocrypt/imagereader/Layout.java @@ -12,18 +12,15 @@ public class Layout { - public static Integer[][] getLayout(String room, int blackBlock, int whiteBlock, @Nullable int red, - @Nullable int red2, @Nullable int green, @Nullable int green2, @Nullable int blue, @Nullable int blue2, - @Nullable int purple, @Nullable int purple2) { + public static Integer[][] getLayout(String room, int blackBlock, int whiteBlock, Layout layout) { BufferedImage image; try { - image = ImageIO.read(room.getClass().getResourceAsStream("/data/backrooms/layouts/" + room + ".png")); + image = ImageIO.read(layout.getClass().getResourceAsStream("/data/backrooms/layouts/" + room + ".png")); if (image.getHeight() != 16 && image.getWidth() != 16) { return null; } else { - return Layout.compileList(image, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, purple, - purple2); + return Layout.compileList(image, blackBlock, whiteBlock); } } catch (IOException e) { e.printStackTrace(); @@ -32,9 +29,7 @@ public static Integer[][] getLayout(String room, int blackBlock, int whiteBlock, } - private static Integer[][] compileList(BufferedImage image, int blackBlock, int whiteBlock, @Nullable int red, - @Nullable int red2, @Nullable int green, @Nullable int green2, @Nullable int blue, @Nullable int blue2, - @Nullable int purple, @Nullable int purple2) { + private static Integer[][] compileList(BufferedImage image, int blackBlock, int whiteBlock) { List intList1 = new ArrayList(); List intList2 = new ArrayList(); List intList3 = new ArrayList(); @@ -55,53 +50,37 @@ private static Integer[][] compileList(BufferedImage image, int blackBlock, int for (int x = 0; x < image.getWidth(); x++) { Color c = new Color(image.getRGB(x, y)); if (y == 0) { - Layout.colorChecker(c, intList1, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList1, blackBlock, whiteBlock); } else if (y == 1) { - Layout.colorChecker(c, intList2, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList2, blackBlock, whiteBlock); } else if (y == 2) { - Layout.colorChecker(c, intList3, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList3, blackBlock, whiteBlock); } else if (y == 3) { - Layout.colorChecker(c, intList4, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList4, blackBlock, whiteBlock); } else if (y == 4) { - Layout.colorChecker(c, intList5, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList5, blackBlock, whiteBlock); } else if (y == 5) { - Layout.colorChecker(c, intList6, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList6, blackBlock, whiteBlock); } else if (y == 6) { - Layout.colorChecker(c, intList7, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList7, blackBlock, whiteBlock); } else if (y == 7) { - Layout.colorChecker(c, intList8, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList8, blackBlock, whiteBlock); } else if (y == 8) { - Layout.colorChecker(c, intList9, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList9, blackBlock, whiteBlock); } else if (y == 9) { - Layout.colorChecker(c, intList10, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList10, blackBlock, whiteBlock); } else if (y == 10) { - Layout.colorChecker(c, intList11, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList11, blackBlock, whiteBlock); } else if (y == 11) { - Layout.colorChecker(c, intList12, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList12, blackBlock, whiteBlock); } else if (y == 12) { - Layout.colorChecker(c, intList13, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList13, blackBlock, whiteBlock); } else if (y == 13) { - Layout.colorChecker(c, intList14, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList14, blackBlock, whiteBlock); } else if (y == 14) { - Layout.colorChecker(c, intList15, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList15, blackBlock, whiteBlock); } else if (y == 15) { - Layout.colorChecker(c, intList16, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, - purple, purple2); + Layout.colorChecker(c, intList16, blackBlock, whiteBlock); } } } @@ -174,19 +153,200 @@ private static Integer[][] compileList(BufferedImage image, int blackBlock, int return layout; } - public static List listLayouts(int max, String room, int blackBlock, int whiteBlock, @Nullable int red, + public static List listLayouts(int max, String room, int blackBlock, int whiteBlock, Layout layout) { + List intListList = new ArrayList(); + for (int m = 0; m <= max; m++) { + Integer[][] intList = Layout.getLayout(room + '_' + m, blackBlock, whiteBlock, layout); + intListList.add(intList); + } + return intListList; + } + + private static void colorChecker(Color c, List list, int black, int white) { + if (c.getRed() == 0 && c.getGreen() == 0 && c.getBlue() == 0) { + list.add(black); + } else { + list.add(white); + } + } + + // Colored + + public static Integer[][] getColoredLayout(String room, int blackBlock, int whiteBlock, @Nullable int red, @Nullable int red2, @Nullable int green, @Nullable int green2, @Nullable int blue, @Nullable int blue2, - @Nullable int purple, @Nullable int purple2) { + @Nullable int purple, @Nullable int purple2, Layout layout) { + + BufferedImage image; + try { + image = ImageIO.read(layout.getClass().getResourceAsStream("/data/backrooms/layouts/" + room + ".png")); + if (image.getHeight() != 16 && image.getWidth() != 16) { + return null; + } else { + return Layout.compileColoredList(image, blackBlock, whiteBlock, red, red2, green, green2, blue, blue2, + purple, purple2); + } + } catch (IOException e) { + e.printStackTrace(); + return null; + } + + } + + private static Integer[][] compileColoredList(BufferedImage image, int blackBlock, int whiteBlock, + @Nullable int red, @Nullable int red2, @Nullable int green, @Nullable int green2, @Nullable int blue, + @Nullable int blue2, @Nullable int purple, @Nullable int purple2) { + List intList1 = new ArrayList(); + List intList2 = new ArrayList(); + List intList3 = new ArrayList(); + List intList4 = new ArrayList(); + List intList5 = new ArrayList(); + List intList6 = new ArrayList(); + List intList7 = new ArrayList(); + List intList8 = new ArrayList(); + List intList9 = new ArrayList(); + List intList10 = new ArrayList(); + List intList11 = new ArrayList(); + List intList12 = new ArrayList(); + List intList13 = new ArrayList(); + List intList14 = new ArrayList(); + List intList15 = new ArrayList(); + List intList16 = new ArrayList(); + for (int y = 0; y < image.getHeight(); y++) { + for (int x = 0; x < image.getWidth(); x++) { + Color c = new Color(image.getRGB(x, y)); + if (y == 0) { + Layout.coloredcolorChecker(c, intList1, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 1) { + Layout.coloredcolorChecker(c, intList2, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 2) { + Layout.coloredcolorChecker(c, intList3, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 3) { + Layout.coloredcolorChecker(c, intList4, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 4) { + Layout.coloredcolorChecker(c, intList5, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 5) { + Layout.coloredcolorChecker(c, intList6, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 6) { + Layout.coloredcolorChecker(c, intList7, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 7) { + Layout.coloredcolorChecker(c, intList8, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 8) { + Layout.coloredcolorChecker(c, intList9, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 9) { + Layout.coloredcolorChecker(c, intList10, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 10) { + Layout.coloredcolorChecker(c, intList11, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 11) { + Layout.coloredcolorChecker(c, intList12, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 12) { + Layout.coloredcolorChecker(c, intList13, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 13) { + Layout.coloredcolorChecker(c, intList14, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 14) { + Layout.coloredcolorChecker(c, intList15, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } else if (y == 15) { + Layout.coloredcolorChecker(c, intList16, blackBlock, whiteBlock, red, red2, green, green2, blue, + blue2, purple, purple2); + } + } + } + Integer[][] layout = { + { intList1.get(1 - 1), intList1.get(2 - 1), intList1.get(3 - 1), intList1.get(4 - 1), + intList1.get(5 - 1), intList1.get(6 - 1), intList1.get(7 - 1), intList1.get(8 - 1), + intList1.get(9 - 1), intList1.get(10 - 1), intList1.get(11 - 1), intList1.get(12 - 1), + intList1.get(13 - 1), intList1.get(14 - 1), intList1.get(15 - 1), intList1.get(16 - 1) }, + { intList2.get(1 - 1), intList2.get(2 - 1), intList2.get(3 - 1), intList2.get(4 - 1), + intList2.get(5 - 1), intList2.get(6 - 1), intList2.get(7 - 1), intList2.get(8 - 1), + intList2.get(9 - 1), intList2.get(10 - 1), intList2.get(11 - 1), intList2.get(12 - 1), + intList2.get(13 - 1), intList2.get(14 - 1), intList2.get(15 - 1), intList2.get(16 - 1) }, + { intList3.get(1 - 1), intList3.get(2 - 1), intList3.get(3 - 1), intList3.get(4 - 1), + intList3.get(5 - 1), intList3.get(6 - 1), intList3.get(7 - 1), intList3.get(8 - 1), + intList3.get(9 - 1), intList3.get(10 - 1), intList3.get(11 - 1), intList3.get(12 - 1), + intList3.get(13 - 1), intList3.get(14 - 1), intList3.get(15 - 1), intList3.get(16 - 1) }, + { intList4.get(1 - 1), intList4.get(2 - 1), intList4.get(3 - 1), intList4.get(4 - 1), + intList4.get(5 - 1), intList4.get(6 - 1), intList4.get(7 - 1), intList4.get(8 - 1), + intList4.get(9 - 1), intList4.get(10 - 1), intList4.get(11 - 1), intList4.get(12 - 1), + intList4.get(13 - 1), intList4.get(14 - 1), intList4.get(15 - 1), intList4.get(16 - 1) }, + { intList5.get(1 - 1), intList5.get(2 - 1), intList5.get(3 - 1), intList5.get(4 - 1), + intList5.get(5 - 1), intList5.get(6 - 1), intList5.get(7 - 1), intList5.get(8 - 1), + intList5.get(9 - 1), intList5.get(10 - 1), intList5.get(11 - 1), intList5.get(12 - 1), + intList5.get(13 - 1), intList5.get(14 - 1), intList5.get(15 - 1), intList5.get(16 - 1) }, + { intList6.get(1 - 1), intList6.get(2 - 1), intList6.get(3 - 1), intList6.get(4 - 1), + intList6.get(5 - 1), intList6.get(6 - 1), intList6.get(7 - 1), intList6.get(8 - 1), + intList6.get(9 - 1), intList6.get(10 - 1), intList6.get(11 - 1), intList6.get(12 - 1), + intList6.get(13 - 1), intList6.get(14 - 1), intList6.get(15 - 1), intList6.get(16 - 1) }, + { intList7.get(1 - 1), intList7.get(2 - 1), intList7.get(3 - 1), intList7.get(4 - 1), + intList7.get(5 - 1), intList7.get(6 - 1), intList7.get(7 - 1), intList7.get(8 - 1), + intList7.get(9 - 1), intList7.get(10 - 1), intList7.get(11 - 1), intList7.get(12 - 1), + intList7.get(13 - 1), intList7.get(14 - 1), intList7.get(15 - 1), intList7.get(16 - 1) }, + { intList8.get(1 - 1), intList8.get(2 - 1), intList8.get(3 - 1), intList8.get(4 - 1), + intList8.get(5 - 1), intList8.get(6 - 1), intList8.get(7 - 1), intList8.get(8 - 1), + intList8.get(9 - 1), intList8.get(10 - 1), intList8.get(11 - 1), intList8.get(12 - 1), + intList8.get(13 - 1), intList8.get(14 - 1), intList8.get(15 - 1), intList8.get(16 - 1) }, + { intList9.get(1 - 1), intList9.get(2 - 1), intList9.get(3 - 1), intList9.get(4 - 1), + intList9.get(5 - 1), intList9.get(6 - 1), intList9.get(7 - 1), intList9.get(8 - 1), + intList9.get(9 - 1), intList9.get(10 - 1), intList9.get(11 - 1), intList9.get(12 - 1), + intList9.get(13 - 1), intList9.get(14 - 1), intList9.get(15 - 1), intList9.get(16 - 1) }, + { intList10.get(1 - 1), intList10.get(2 - 1), intList10.get(3 - 1), intList10.get(4 - 1), + intList10.get(5 - 1), intList10.get(6 - 1), intList10.get(7 - 1), intList10.get(8 - 1), + intList10.get(9 - 1), intList10.get(10 - 1), intList10.get(11 - 1), intList10.get(12 - 1), + intList10.get(13 - 1), intList10.get(14 - 1), intList10.get(15 - 1), intList10.get(16 - 1) }, + { intList11.get(1 - 1), intList11.get(2 - 1), intList11.get(3 - 1), intList11.get(4 - 1), + intList11.get(5 - 1), intList11.get(6 - 1), intList11.get(7 - 1), intList11.get(8 - 1), + intList11.get(9 - 1), intList11.get(10 - 1), intList11.get(11 - 1), intList11.get(12 - 1), + intList11.get(13 - 1), intList11.get(14 - 1), intList11.get(15 - 1), intList11.get(16 - 1) }, + { intList12.get(1 - 1), intList12.get(2 - 1), intList12.get(3 - 1), intList12.get(4 - 1), + intList12.get(5 - 1), intList12.get(6 - 1), intList12.get(7 - 1), intList12.get(8 - 1), + intList12.get(9 - 1), intList12.get(10 - 1), intList12.get(11 - 1), intList12.get(12 - 1), + intList12.get(13 - 1), intList12.get(14 - 1), intList12.get(15 - 1), intList12.get(16 - 1) }, + { intList13.get(1 - 1), intList13.get(2 - 1), intList13.get(3 - 1), intList13.get(4 - 1), + intList13.get(5 - 1), intList13.get(6 - 1), intList13.get(7 - 1), intList13.get(8 - 1), + intList13.get(9 - 1), intList13.get(10 - 1), intList13.get(11 - 1), intList13.get(12 - 1), + intList13.get(13 - 1), intList13.get(14 - 1), intList13.get(15 - 1), intList13.get(16 - 1) }, + { intList14.get(1 - 1), intList14.get(2 - 1), intList14.get(3 - 1), intList14.get(4 - 1), + intList14.get(5 - 1), intList14.get(6 - 1), intList14.get(7 - 1), intList14.get(8 - 1), + intList14.get(9 - 1), intList14.get(10 - 1), intList14.get(11 - 1), intList14.get(12 - 1), + intList14.get(13 - 1), intList14.get(14 - 1), intList14.get(15 - 1), intList14.get(16 - 1) }, + { intList15.get(1 - 1), intList15.get(2 - 1), intList15.get(3 - 1), intList15.get(4 - 1), + intList15.get(5 - 1), intList15.get(6 - 1), intList15.get(7 - 1), intList15.get(8 - 1), + intList15.get(9 - 1), intList15.get(10 - 1), intList15.get(11 - 1), intList15.get(12 - 1), + intList15.get(13 - 1), intList15.get(14 - 1), intList15.get(15 - 1), intList15.get(16 - 1) }, + { intList16.get(1 - 1), intList16.get(2 - 1), intList16.get(3 - 1), intList16.get(4 - 1), + intList16.get(5 - 1), intList16.get(6 - 1), intList16.get(7 - 1), intList16.get(8 - 1), + intList16.get(9 - 1), intList16.get(10 - 1), intList16.get(11 - 1), intList16.get(12 - 1), + intList16.get(13 - 1), intList16.get(14 - 1), intList16.get(15 - 1), intList16.get(16 - 1) } }; + + return layout; + } + + public static List listColoredLayouts(int max, String room, int blackBlock, int whiteBlock, + @Nullable int red, @Nullable int red2, @Nullable int green, @Nullable int green2, @Nullable int blue, + @Nullable int blue2, @Nullable int purple, @Nullable int purple2, Layout layout) { List intListList = new ArrayList(); for (int m = 0; m <= max; m++) { - Integer[][] intList = Layout.getLayout(room + '_' + m, blackBlock, whiteBlock, red, red2, green, green2, - blue, blue2, purple, purple2); + Integer[][] intList = Layout.getColoredLayout(room + '_' + m, blackBlock, whiteBlock, red, red2, green, + green2, blue, blue2, purple, purple2, layout); intListList.add(intList); } return intListList; } - private static void colorChecker(Color c, List list, int black, int white, @Nullable int red, + private static void coloredcolorChecker(Color c, List list, int black, int white, @Nullable int red, @Nullable int red2, @Nullable int green, @Nullable int green2, @Nullable int blue, @Nullable int blue2, @Nullable int purple, @Nullable int purple2) { if (c.getRed() == 0 && c.getGreen() == 0 && c.getBlue() == 255) { diff --git a/src/main/resources/assets/backrooms/lang/en_us.json b/src/main/resources/assets/backrooms/lang/en_us.json index 7d43e79..db73912 100644 --- a/src/main/resources/assets/backrooms/lang/en_us.json +++ b/src/main/resources/assets/backrooms/lang/en_us.json @@ -136,12 +136,14 @@ "text.autoconfig.backrooms.title": "Backrooms Configurations", "text.autoconfig.backrooms.option.Level0DoorChance": "Chance for door to appear in level 0", "text.autoconfig.backrooms.option.Level1DoorChance": "Chance for door to appear in level 1", + "text.autoconfig.backrooms.option.Level3DoorChance": "Chance for door to appear in level 3", "text.autoconfig.backrooms.option.Level0LayerCount": "How many Layers in level 0", "text.autoconfig.backrooms.option.Level1LayerCount": "How many Layers in level 1", "text.autoconfig.backrooms.option.VBDoor": "Chance for the void block to appear in a door", "text.autoconfig.backrooms.option.EnderPearlChance": "Chance for an enderpearl", "text.autoconfig.backrooms.option.SuffocationChance": "Chance for suffocation", "text.autoconfig.backrooms.option.ChestSpawnChance": "Chance for a chest to spawn", + "text.autoconfig.backrooms.option.SearchRange": "Search Range For Noise Making Blocks", "text.autoconfig.backrooms.option.ForceLevel0": "Forces title screen to stay as Level 0", "text.autoconfig.backrooms.option.ForceLevel1": "Forces title screen to stay as Level 1", "text.autoconfig.backrooms.option.ForceLevel2": "Forces title screen to stay as Level 2", diff --git a/src/main/resources/assets/backrooms/sounds.json b/src/main/resources/assets/backrooms/sounds.json index 5cc3b0e..e701dcb 100644 --- a/src/main/resources/assets/backrooms/sounds.json +++ b/src/main/resources/assets/backrooms/sounds.json @@ -248,81 +248,80 @@ } ] }, - "buzz": { + "humm_buzz": { "sounds": [ { - "name": "backrooms:buzz" - } - ] - }, - "gulp": { - "sounds": [ + "name": "backrooms:level_noise/buzz1" + }, { - "name": "backrooms:gulp/gulp1" + "name": "backrooms:level_noise/buzz2" }, { - "name": "backrooms:gulp/gulp2" + "name": "backrooms:level_noise/buzz3" }, { - "name": "backrooms:gulp/gulp3" + "name": "backrooms:level_noise/buzz4" } ] }, - "level.0.ambience": { + "humm_buzz_around": { "sounds": [ { - "name": "backrooms:ambient/breath1" + "name": "backrooms:level_noise/buzz_around1" }, { - "name": "backrooms:ambient/breath2" + "name": "backrooms:level_noise/buzz_around2" }, { - "name": "backrooms:ambient/breath3" + "name": "backrooms:level_noise/buzz_around3" }, { - "name": "backrooms:ambient/breath4" - }, - { - "name": "backrooms:ambient/harp1" - }, - { - "name": "backrooms:ambient/harp2" - }, - { - "name": "backrooms:ambient/harp3" - }, + "name": "backrooms:level_noise/buzz_around4" + } + ] + }, + "vent": { + "sounds": [ { - "name": "backrooms:ambient/knock1" + "name": "backrooms:level_noise/vent1" }, { - "name": "backrooms:ambient/knock2" + "name": "backrooms:level_noise/vent2" }, { - "name": "backrooms:ambient/knock3" + "name": "backrooms:level_noise/vent3" }, { - "name": "backrooms:ambient/synth1" - }, + "name": "backrooms:level_noise/vent4" + } + ] + }, + "sizzle": { + "sounds": [ { - "name": "backrooms:ambient/synth2" + "name": "backrooms:level_noise/sizzle1" }, { - "name": "backrooms:ambient/synth3" + "name": "backrooms:level_noise/sizzle2" }, { - "name": "backrooms:ambient/tone1" + "name": "backrooms:level_noise/sizzle3" }, { - "name": "backrooms:ambient/tone2" - }, + "name": "backrooms:level_noise/sizzle4" + } + ] + }, + "gulp": { + "sounds": [ { - "name": "backrooms:ambient/tone3" + "name": "backrooms:gulp/gulp1" }, { - "name": "backrooms:ambient/tone4" + "name": "backrooms:gulp/gulp2" }, { - "name": "backrooms:ambient/whistle1" + "name": "backrooms:gulp/gulp3" } ] } diff --git a/src/main/resources/backrooms.mixins.json b/src/main/resources/backrooms.mixins.json index 8e51f94..68efe34 100644 --- a/src/main/resources/backrooms.mixins.json +++ b/src/main/resources/backrooms.mixins.json @@ -10,7 +10,8 @@ "client": [ "BuiltinModelItemRendererMixin", "MusicMixin", - "TitleScreenMixin" + "TitleScreenMixin", + "WorldAccessor" ], "injectors": { "defaultRequire": 1 diff --git a/src/main/resources/data/backrooms/advancements/dottedredrooms.json b/src/main/resources/data/backrooms/advancements/dottedredrooms.json index 3552a5d..c3834b5 100644 --- a/src/main/resources/data/backrooms/advancements/dottedredrooms.json +++ b/src/main/resources/data/backrooms/advancements/dottedredrooms.json @@ -15,13 +15,18 @@ "hidden": false }, "criteria": { - "level0": { + "level0dottedred": { "trigger": "minecraft:location", "conditions": { "biome": "backrooms:level0dottedred" } } }, + "requirements": [ + [ + "level0dottedred" + ] + ], "rewards": { "experience": 10 }, diff --git a/src/main/resources/data/backrooms/advancements/dottedrooms.json b/src/main/resources/data/backrooms/advancements/dottedrooms.json index b6f53ba..26b097d 100644 --- a/src/main/resources/data/backrooms/advancements/dottedrooms.json +++ b/src/main/resources/data/backrooms/advancements/dottedrooms.json @@ -15,13 +15,18 @@ "hidden": false }, "criteria": { - "level0": { + "level0dotted": { "trigger": "minecraft:location", "conditions": { "biome": "backrooms:level0dotted" } } }, + "requirements": [ + [ + "level0dotted" + ] + ], "rewards": { "experience": 10 }, diff --git a/src/main/resources/data/backrooms/advancements/level1off.json b/src/main/resources/data/backrooms/advancements/level1off.json index 49f3743..4002564 100644 --- a/src/main/resources/data/backrooms/advancements/level1off.json +++ b/src/main/resources/data/backrooms/advancements/level1off.json @@ -15,7 +15,7 @@ "hidden": false }, "criteria": { - "level0": { + "level1off": { "trigger": "minecraft:location", "conditions": { "biome": "backrooms:level1off", @@ -28,6 +28,11 @@ } } }, + "requirements": [ + [ + "level1off" + ] + ], "rewards": { "experience": 10 }, diff --git a/src/main/resources/data/backrooms/advancements/level2long.json b/src/main/resources/data/backrooms/advancements/level2long.json index 3db2736..6a491bc 100644 --- a/src/main/resources/data/backrooms/advancements/level2long.json +++ b/src/main/resources/data/backrooms/advancements/level2long.json @@ -15,13 +15,18 @@ "hidden": false }, "criteria": { - "level0": { + "level2long": { "trigger": "minecraft:location", "conditions": { "biome": "backrooms:level2long" } } }, + "requirements": [ + [ + "level2long" + ] + ], "rewards": { "experience": 10 }, diff --git a/src/main/resources/data/backrooms/advancements/level2messy.json b/src/main/resources/data/backrooms/advancements/level2messy.json index 2792515..43f6a42 100644 --- a/src/main/resources/data/backrooms/advancements/level2messy.json +++ b/src/main/resources/data/backrooms/advancements/level2messy.json @@ -15,13 +15,18 @@ "hidden": false }, "criteria": { - "level0": { + "level2messy": { "trigger": "minecraft:location", "conditions": { "biome": "backrooms:level2messy" } } }, + "requirements": [ + [ + "level2messy" + ] + ], "rewards": { "experience": 10 }, diff --git a/src/main/resources/data/backrooms/advancements/redrooms.json b/src/main/resources/data/backrooms/advancements/redrooms.json index f2cd910..f221014 100644 --- a/src/main/resources/data/backrooms/advancements/redrooms.json +++ b/src/main/resources/data/backrooms/advancements/redrooms.json @@ -15,13 +15,18 @@ "hidden": false }, "criteria": { - "level0": { + "level0red": { "trigger": "minecraft:location", "conditions": { "biome": "backrooms:level0red" } } }, + "requirements": [ + [ + "level0red" + ] + ], "rewards": { "experience": 10 }, diff --git a/src/main/resources/data/backrooms/dimension/level_0.json b/src/main/resources/data/backrooms/dimension/level_0.json index 576aeee..9b72b0c 100644 --- a/src/main/resources/data/backrooms/dimension/level_0.json +++ b/src/main/resources/data/backrooms/dimension/level_0.json @@ -34,6 +34,286 @@ "humidity": 0.0 }, "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.0, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.0, + "humidity": 0.0 + }, + "biome": "backrooms:level0decrepit" + }, + { + "parameters": { + "altitude": 0.1, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.1, + "humidity": 0.1 + }, + "biome": "backrooms:level0decrepit" + }, + { + "parameters": { + "altitude": 0.2, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.2, + "humidity": 0.2 + }, + "biome": "backrooms:level0decrepit" + }, + { + "parameters": { + "altitude": 0.5, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.5, + "humidity": 0.5 + }, + "biome": "backrooms:level0decrepit" + }, + { + "parameters": { + "altitude": 0.5, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.5, + "humidity": 0.5 + }, + "biome": "backrooms:level0dotted" + }, + { + "parameters": { + "altitude": 0.5, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.5, + "humidity": 0.5 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.0, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.5, + "humidity": 0.5 + }, + "biome": "backrooms:level0red" + }, + { + "parameters": { + "altitude": 0.1, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.4, + "humidity": 0.5 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.1, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.4, + "humidity": 0.3 + }, + "biome": "backrooms:level0dotted" + }, + { + "parameters": { + "altitude": 0.2, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.4, + "humidity": 0.5 + }, + "biome": "backrooms:level0dotted" + }, + { + "parameters": { + "altitude": 0.2, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.5, + "humidity": 0.5 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.1, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.3, + "humidity": 0.4 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.6, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.2, + "humidity": 0.5 + }, + "biome": "backrooms:level0dotted" + }, + { + "parameters": { + "altitude": 0.2, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.5, + "humidity": 0.4 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.1, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.5, + "humidity": 0.4 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.0, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.4, + "humidity": 0.5 + }, + "biome": "backrooms:level0dotted" + }, + { + "parameters": { + "altitude": 0.0, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.2, + "humidity": 0.3 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.1, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.4, + "humidity": 0.6 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.0, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 1.5, + "humidity": 0.0 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.0, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 1.5, + "humidity": 0.0 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.6, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 1.0, + "humidity": 0.4 + }, + "biome": "backrooms:level0dottedred" + }, + { + "parameters": { + "altitude": 0.6, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 1.0, + "humidity": 0.4 + }, + "biome": "backrooms:level0dotted" + }, + { + "parameters": { + "altitude": 0.6, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 1.0, + "humidity": 0.4 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.6, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 1.0, + "humidity": 0.4 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.6, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 1.0, + "humidity": 0.4 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.6, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 1.0, + "humidity": 0.4 + }, + "biome": "backrooms:level0dotted" + }, + { + "parameters": { + "altitude": 0.6, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 1.0, + "humidity": 0.4 + }, + "biome": "backrooms:level0" + }, + { + "parameters": { + "altitude": 0.0, + "weirdness": 0.0, + "offset": 0.0, + "temperature": 0.5, + "humidity": 0.0 + }, + "biome": "backrooms:level0" } ], "temperature_noise": { diff --git a/src/main/resources/data/backrooms/layouts/allcolors.png b/src/main/resources/data/backrooms/layouts/guide.png similarity index 100% rename from src/main/resources/data/backrooms/layouts/allcolors.png rename to src/main/resources/data/backrooms/layouts/guide.png diff --git a/src/main/resources/data/backrooms/layouts/level01_0.png b/src/main/resources/data/backrooms/layouts/level01_0.png new file mode 100644 index 0000000..2d47998 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_0.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_1.png b/src/main/resources/data/backrooms/layouts/level01_1.png new file mode 100644 index 0000000..ca50944 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_1.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_10.png b/src/main/resources/data/backrooms/layouts/level01_10.png new file mode 100644 index 0000000..3a24866 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_10.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_11.png b/src/main/resources/data/backrooms/layouts/level01_11.png new file mode 100644 index 0000000..2038b70 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_11.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_12.png b/src/main/resources/data/backrooms/layouts/level01_12.png new file mode 100644 index 0000000..e9be4f3 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_12.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_13.png b/src/main/resources/data/backrooms/layouts/level01_13.png new file mode 100644 index 0000000..759c06b Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_13.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_14.png b/src/main/resources/data/backrooms/layouts/level01_14.png new file mode 100644 index 0000000..85b7362 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_14.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_15.png b/src/main/resources/data/backrooms/layouts/level01_15.png new file mode 100644 index 0000000..ae5d8db Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_15.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_16.png b/src/main/resources/data/backrooms/layouts/level01_16.png new file mode 100644 index 0000000..84972aa Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_16.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_17.png b/src/main/resources/data/backrooms/layouts/level01_17.png new file mode 100644 index 0000000..a770c4e Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_17.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_18.png b/src/main/resources/data/backrooms/layouts/level01_18.png new file mode 100644 index 0000000..55bfbf4 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_18.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_19.png b/src/main/resources/data/backrooms/layouts/level01_19.png new file mode 100644 index 0000000..db04d72 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_19.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_2.png b/src/main/resources/data/backrooms/layouts/level01_2.png new file mode 100644 index 0000000..4e36183 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_2.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_20.png b/src/main/resources/data/backrooms/layouts/level01_20.png new file mode 100644 index 0000000..4409b22 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_20.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_21.png b/src/main/resources/data/backrooms/layouts/level01_21.png new file mode 100644 index 0000000..9881e3f Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_21.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_22.png b/src/main/resources/data/backrooms/layouts/level01_22.png new file mode 100644 index 0000000..c248029 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_22.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_23.png b/src/main/resources/data/backrooms/layouts/level01_23.png new file mode 100644 index 0000000..9183c4d Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_23.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_24.png b/src/main/resources/data/backrooms/layouts/level01_24.png new file mode 100644 index 0000000..b4a0191 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_24.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_25.png b/src/main/resources/data/backrooms/layouts/level01_25.png new file mode 100644 index 0000000..bbdfe5d Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_25.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_26.png b/src/main/resources/data/backrooms/layouts/level01_26.png new file mode 100644 index 0000000..0589065 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_26.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_27.png b/src/main/resources/data/backrooms/layouts/level01_27.png new file mode 100644 index 0000000..84891cc Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_27.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_3.png b/src/main/resources/data/backrooms/layouts/level01_3.png new file mode 100644 index 0000000..77bbaee Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_3.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_4.png b/src/main/resources/data/backrooms/layouts/level01_4.png new file mode 100644 index 0000000..c5c3e19 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_4.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_5.png b/src/main/resources/data/backrooms/layouts/level01_5.png new file mode 100644 index 0000000..63c31b7 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_5.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_6.png b/src/main/resources/data/backrooms/layouts/level01_6.png new file mode 100644 index 0000000..a82dcdf Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_6.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_7.png b/src/main/resources/data/backrooms/layouts/level01_7.png new file mode 100644 index 0000000..ec8b5d9 Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_7.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_8.png b/src/main/resources/data/backrooms/layouts/level01_8.png new file mode 100644 index 0000000..3d9c5bf Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_8.png differ diff --git a/src/main/resources/data/backrooms/layouts/level01_9.png b/src/main/resources/data/backrooms/layouts/level01_9.png new file mode 100644 index 0000000..adfb08e Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/level01_9.png differ diff --git a/src/main/resources/data/backrooms/layouts/level0_0.png b/src/main/resources/data/backrooms/layouts/level0_0.png deleted file mode 100644 index 37bdcbc..0000000 Binary files a/src/main/resources/data/backrooms/layouts/level0_0.png and /dev/null differ diff --git a/src/main/resources/data/backrooms/layouts/level0_1.png b/src/main/resources/data/backrooms/layouts/level0_1.png deleted file mode 100644 index f2ed75b..0000000 Binary files a/src/main/resources/data/backrooms/layouts/level0_1.png and /dev/null differ diff --git a/src/main/resources/data/backrooms/layouts/level0_2.png b/src/main/resources/data/backrooms/layouts/level0_2.png deleted file mode 100644 index 73b49f2..0000000 Binary files a/src/main/resources/data/backrooms/layouts/level0_2.png and /dev/null differ diff --git a/src/main/resources/data/backrooms/layouts/level0_3.png b/src/main/resources/data/backrooms/layouts/level0_3.png deleted file mode 100644 index af86ec8..0000000 Binary files a/src/main/resources/data/backrooms/layouts/level0_3.png and /dev/null differ diff --git a/src/main/resources/data/backrooms/layouts/level0_4.png b/src/main/resources/data/backrooms/layouts/level0_4.png deleted file mode 100644 index cd9bb8c..0000000 Binary files a/src/main/resources/data/backrooms/layouts/level0_4.png and /dev/null differ diff --git a/src/main/resources/data/backrooms/layouts/roof.png b/src/main/resources/data/backrooms/layouts/roof.png index 701f4aa..e05bb52 100644 Binary files a/src/main/resources/data/backrooms/layouts/roof.png and b/src/main/resources/data/backrooms/layouts/roof.png differ diff --git a/src/main/resources/data/backrooms/layouts/whiteblock.png b/src/main/resources/data/backrooms/layouts/whiteblock.png new file mode 100644 index 0000000..12e3f0c Binary files /dev/null and b/src/main/resources/data/backrooms/layouts/whiteblock.png differ diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f205f76..8d9f6c1 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "backrooms", - "version": "1.2.2", + "version": "$version", "name": "The Backrooms", "description": "The backrooms, endless mono yellow rooms to traverse.", "authors": [