From 72c0c2f2ac9223c9cf22d9fa8dcaffa4fdbeaac1 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sat, 24 Sep 2022 18:52:46 -0700 Subject: [PATCH 01/30] LargeOfficeCorner, two more structure wands i would like to reiterate: bob i could kiss you --- src/main/java/com/hbm/items/ModItems.java | 6 + .../hbm/items/tool/ItemStructurePattern.java | 10 +- .../items/tool/ItemStructureRandomized.java | 47 ++++ .../hbm/items/tool/ItemStructureRandomly.java | 51 ++++ .../hbm/items/tool/ItemStructureSingle.java | 10 +- .../hbm/items/tool/ItemStructureSolid.java | 15 +- .../com/hbm/items/tool/ItemStructureTool.java | 34 ++- src/main/java/com/hbm/lib/HbmWorld.java | 1 + .../hbm/world/worldgen/MapGenNTMFeatures.java | 9 +- .../worldgen/components/OfficeFeatures.java | 224 ++++++++++++++++++ .../textures/items/structure_randomized.png | Bin 0 -> 224 bytes .../hbm/textures/items/structure_randomly.png | Bin 0 -> 225 bytes 12 files changed, 391 insertions(+), 16 deletions(-) create mode 100644 src/main/java/com/hbm/items/tool/ItemStructureRandomized.java create mode 100644 src/main/java/com/hbm/items/tool/ItemStructureRandomly.java create mode 100644 src/main/resources/assets/hbm/textures/items/structure_randomized.png create mode 100644 src/main/resources/assets/hbm/textures/items/structure_randomly.png diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index b0b5c08ac..0be9a8f18 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -2321,6 +2321,8 @@ public class ModItems { public static Item structure_single; public static Item structure_solid; public static Item structure_pattern; + public static Item structure_randomized; + public static Item structure_randomly; public static Item rod_of_discord; @@ -4749,6 +4751,8 @@ public class ModItems { structure_single = new ItemStructureSingle().setUnlocalizedName("structure_single").setMaxStackSize(1).setCreativeTab(null).setFull3D().setTextureName(RefStrings.MODID + ":structure_single"); structure_solid = new ItemStructureSolid().setUnlocalizedName("structure_solid").setMaxStackSize(1).setCreativeTab(null).setFull3D().setTextureName(RefStrings.MODID + ":structure_solid"); structure_pattern = new ItemStructurePattern().setUnlocalizedName("structure_pattern").setMaxStackSize(1).setCreativeTab(null).setFull3D().setTextureName(RefStrings.MODID + ":structure_pattern"); + structure_randomized = new ItemStructureRandomized().setUnlocalizedName("structure_randomized").setMaxStackSize(1).setCreativeTab(null).setFull3D().setTextureName(RefStrings.MODID + ":structure_randomized"); + structure_randomly = new ItemStructureRandomly().setUnlocalizedName("structure_randomly").setMaxStackSize(1).setCreativeTab(null).setFull3D().setTextureName(RefStrings.MODID + ":structure_randomly"); rod_of_discord = new ItemDiscord().setUnlocalizedName("rod_of_discord").setMaxStackSize(1).setCreativeTab(MainRegistry.consumableTab).setFull3D().setTextureName(RefStrings.MODID + ":rod_of_discord"); @@ -8111,6 +8115,8 @@ public class ModItems { GameRegistry.registerItem(structure_single, structure_single.getUnlocalizedName()); GameRegistry.registerItem(structure_solid, structure_solid.getUnlocalizedName()); GameRegistry.registerItem(structure_pattern, structure_pattern.getUnlocalizedName()); + GameRegistry.registerItem(structure_randomized, structure_randomized.getUnlocalizedName()); + GameRegistry.registerItem(structure_randomly, structure_randomly.getUnlocalizedName()); GameRegistry.registerItem(rod_of_discord, rod_of_discord.getUnlocalizedName()); //GameRegistry.registerItem(analyzer, analyzer.getUnlocalizedName()); //GameRegistry.registerItem(remote, remote.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/tool/ItemStructurePattern.java b/src/main/java/com/hbm/items/tool/ItemStructurePattern.java index 9fa41ace7..f65d4c80a 100644 --- a/src/main/java/com/hbm/items/tool/ItemStructurePattern.java +++ b/src/main/java/com/hbm/items/tool/ItemStructurePattern.java @@ -29,7 +29,8 @@ public class ItemStructurePattern extends ItemStructureTool { BlockPos pos = this.getAnchor(stack); if(pos == null) return; - + + String message = ""; int savedX = stack.stackTagCompound.getInteger("x"); int savedY = stack.stackTagCompound.getInteger("y"); int savedZ = stack.stackTagCompound.getInteger("z"); @@ -47,10 +48,13 @@ public class ItemStructurePattern extends ItemStructureTool { Block b = world.getBlock(ix + pos.getX(), iy + pos.getY(), iz + pos.getZ()); int meta = world.getBlockMetadata(ix + pos.getX(), iy + pos.getY(), iz + pos.getZ()); - - System.out.println("this.placeBlockAtCurrentPosition(world, " + b.getUnlocalizedName() + ", " + meta + ", " + ix + ", " + iy + ", " + iz + ", box)"); + + message.concat("placeBlockAtCurrentPosition(world, " + b.getUnlocalizedName() + ", " + meta + ", " + ix + ", " + iy + ", " + iz + ", box);\n"); } } } + + System.out.print(message); + writeToFile(message); } } diff --git a/src/main/java/com/hbm/items/tool/ItemStructureRandomized.java b/src/main/java/com/hbm/items/tool/ItemStructureRandomized.java new file mode 100644 index 000000000..484c6451e --- /dev/null +++ b/src/main/java/com/hbm/items/tool/ItemStructureRandomized.java @@ -0,0 +1,47 @@ +package com.hbm.items.tool; + +import java.util.List; + +import com.hbm.util.fauxpointtwelve.BlockPos; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +public class ItemStructureRandomized extends ItemStructureTool { + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { + super.addInformation(stack, player, list, ext); + list.add(EnumChatFormatting.YELLOW + "Click to print a "); + list.add(EnumChatFormatting.YELLOW + "line with block selector."); + } + + @Override + protected boolean dualUse() { + return true; + } + + @Override + protected void doTheThing(ItemStack stack, World world, int x, int y, int z) { + + BlockPos pos = this.getAnchor(stack); + if(pos == null) return; + + int savedX = stack.stackTagCompound.getInteger("x"); + int savedY = stack.stackTagCompound.getInteger("y"); + int savedZ = stack.stackTagCompound.getInteger("z"); + + int minX = Math.min(savedX, x) - pos.getX(); + int minY = Math.min(savedY, y) - pos.getY(); + int minZ = Math.min(savedZ, z) - pos.getZ(); + int maxX = Math.max(savedX, x) - pos.getX(); + int maxY = Math.max(savedY, y) - pos.getY(); + int maxZ = Math.max(savedZ, z) - pos.getZ(); + + String message = "fillWithRandomizedBlocks(world, box, " + minX + ", " + minY + ", " + minZ + ", " + maxX + ", " + maxY + ", " + maxZ + ", rand, );\n"; + System.out.print(message); + writeToFile(message); + } +} diff --git a/src/main/java/com/hbm/items/tool/ItemStructureRandomly.java b/src/main/java/com/hbm/items/tool/ItemStructureRandomly.java new file mode 100644 index 000000000..e3b1626bf --- /dev/null +++ b/src/main/java/com/hbm/items/tool/ItemStructureRandomly.java @@ -0,0 +1,51 @@ +package com.hbm.items.tool; + +import java.util.List; + +import com.hbm.util.fauxpointtwelve.BlockPos; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +public class ItemStructureRandomly extends ItemStructureTool { + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { + super.addInformation(stack, player, list, ext); + list.add(EnumChatFormatting.YELLOW + "Click to print a "); + list.add(EnumChatFormatting.YELLOW + "line with the targeted block."); + } + + @Override + protected boolean dualUse() { + return true; + } + + @Override + protected void doTheThing(ItemStack stack, World world, int x, int y, int z) { + + BlockPos pos = this.getAnchor(stack); + if(pos == null) return; + + int savedX = stack.stackTagCompound.getInteger("x"); + int savedY = stack.stackTagCompound.getInteger("y"); + int savedZ = stack.stackTagCompound.getInteger("z"); + + int minX = Math.min(savedX, x) - pos.getX(); + int minY = Math.min(savedY, y) - pos.getY(); + int minZ = Math.min(savedZ, z) - pos.getZ(); + int maxX = Math.max(savedX, x) - pos.getX(); + int maxY = Math.max(savedY, y) - pos.getY(); + int maxZ = Math.max(savedZ, z) - pos.getZ(); + //Assumes the last selected block is the one that all of them are. + Block b = world.getBlock(x, y, z); + + String line = "randomlyFillWithBlocks(world, box, rand, , " + minX + ", " + minY + ", " + minZ + ", " + maxX + ", " + maxY + ", " + maxZ + ", " + b.getUnlocalizedName() + ");\n"; + System.out.print(line); + writeToFile(line); + } + +} diff --git a/src/main/java/com/hbm/items/tool/ItemStructureSingle.java b/src/main/java/com/hbm/items/tool/ItemStructureSingle.java index b35974d32..e20e10c45 100644 --- a/src/main/java/com/hbm/items/tool/ItemStructureSingle.java +++ b/src/main/java/com/hbm/items/tool/ItemStructureSingle.java @@ -26,12 +26,14 @@ public class ItemStructureSingle extends ItemStructureTool { if(pos == null) return; int ix = x - pos.getX(); - int iy = y - pos.getX(); - int iz = z - pos.getX(); + int iy = y - pos.getY(); + int iz = z - pos.getZ(); Block b = world.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); - - System.out.println("this.placeBlockAtCurrentPosition(world, " + b.getUnlocalizedName() + ", " + meta + ", " + x + ", " + y + ", " + z + ", box)"); + + String message = "placeBlockAtCurrentPosition(world, " + b.getUnlocalizedName() + ", " + meta + ", " + ix + ", " + iy + ", " + iz + ", box);\n"; + System.out.print(message); + writeToFile(message); } } diff --git a/src/main/java/com/hbm/items/tool/ItemStructureSolid.java b/src/main/java/com/hbm/items/tool/ItemStructureSolid.java index 8267f96b8..9263e71ec 100644 --- a/src/main/java/com/hbm/items/tool/ItemStructureSolid.java +++ b/src/main/java/com/hbm/items/tool/ItemStructureSolid.java @@ -4,6 +4,7 @@ import java.util.List; import com.hbm.util.fauxpointtwelve.BlockPos; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; @@ -14,7 +15,7 @@ public class ItemStructureSolid extends ItemStructureTool { @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { super.addInformation(stack, player, list, ext); - list.add(EnumChatFormatting.YELLOW + "Click to print a "); + list.add(EnumChatFormatting.YELLOW + "Click to print a or "); list.add(EnumChatFormatting.YELLOW + "line with wildcard block and metadata."); } @@ -39,7 +40,17 @@ public class ItemStructureSolid extends ItemStructureTool { int maxX = Math.max(savedX, x) - pos.getX(); int maxY = Math.max(savedY, y) - pos.getY(); int maxZ = Math.max(savedZ, z) - pos.getZ(); + //Assumes the last selected block is the one that all of them are. + Block b = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); - System.out.println("this.fillWithMetadataBlocks(world, box, " + minX + ", " + minY + ", " + minZ + ", " + maxX + ", " + maxY + ", " + maxZ + ", , , Blocks.air, 0, false)"); + String line; + if(meta > 0) + line = "fillWithMetadataBlocks(world, box, " + minX + ", " + minY + ", " + minZ + ", " + maxX + ", " + maxY + ", " + maxZ + ", " + b.getUnlocalizedName() +", " + meta +");\n"; + else + line = "fillWithBlocks(world, box, " + minX + ", " + minY + ", " + minZ + ", " + maxX + ", " + maxY + ", " + maxZ + ", " + b.getUnlocalizedName() +");\n"; + + System.out.print(line); + writeToFile(line); } } diff --git a/src/main/java/com/hbm/items/tool/ItemStructureTool.java b/src/main/java/com/hbm/items/tool/ItemStructureTool.java index c72f6a392..62e43b03c 100644 --- a/src/main/java/com/hbm/items/tool/ItemStructureTool.java +++ b/src/main/java/com/hbm/items/tool/ItemStructureTool.java @@ -1,10 +1,15 @@ package com.hbm.items.tool; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import com.hbm.blocks.ILookOverlay; import com.hbm.blocks.ModBlocks; +import com.hbm.config.GeneralConfig; +import com.hbm.main.MainRegistry; import com.hbm.util.fauxpointtwelve.BlockPos; import net.minecraft.block.Block; @@ -19,13 +24,33 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre; public abstract class ItemStructureTool extends Item implements ILookOverlay { + File file = new File(MainRegistry.configHbmDir, "structureOutput.txt"); + FileWriter writer; + + public void writeToFile(String message) { + if(!GeneralConfig.enableDebugMode) + return; + + try { + if(!file.exists()) file.createNewFile(); + if(writer == null) writer = new FileWriter(file, true); + + writer.write(message); + writer.flush(); + } catch(IOException e) { + System.out.print("ItemStructureWand encountered an IOException!"); + } + } + @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) { BlockPos anchor = this.getAnchor(stack); - if(anchor == null) { + if(anchor == null) list.add(EnumChatFormatting.RED + "No anchor set! Right click an anchor to get started."); - } + + if(GeneralConfig.enableDebugMode) + list.add(EnumChatFormatting.GREEN + "Will write to \"structureOutput.txt\" in hbmConfig."); } public static BlockPos getAnchor(ItemStack stack) { @@ -62,7 +87,7 @@ public abstract class ItemStructureTool extends Item implements ILookOverlay { return false; } - if(!this.dualUse()) { + if(!this.dualUse() && world.isRemote) { this.doTheThing(stack, world, x, y, z); } else { @@ -71,7 +96,8 @@ public abstract class ItemStructureTool extends Item implements ILookOverlay { stack.stackTagCompound.setInteger("y", y); stack.stackTagCompound.setInteger("z", z); } else { - this.doTheThing(stack, world, x, y, z); + if(world.isRemote) + this.doTheThing(stack, world, x, y, z); stack.stackTagCompound.removeTag("x"); stack.stackTagCompound.removeTag("y"); stack.stackTagCompound.removeTag("z"); diff --git a/src/main/java/com/hbm/lib/HbmWorld.java b/src/main/java/com/hbm/lib/HbmWorld.java index 4f2c9444f..fae367daf 100644 --- a/src/main/java/com/hbm/lib/HbmWorld.java +++ b/src/main/java/com/hbm/lib/HbmWorld.java @@ -48,5 +48,6 @@ public class HbmWorld { MapGenStructureIO.func_143031_a(BasicHelipad.class, "NTMBasicHelipad"); MapGenStructureIO.func_143031_a(RadioShack.class, "NTMRadioShack"); MapGenStructureIO.func_143031_a(LargeOffice.class, "NTMLargeOffice"); + MapGenStructureIO.func_143031_a(LargeOfficeCorner.class, "NTMLargeOfficeCorner"); } } diff --git a/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java b/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java index 7045891e0..5e6b70789 100644 --- a/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java @@ -109,7 +109,7 @@ public class MapGenNTMFeatures extends MapGenStructure { * Rainfall & Temperature Check */ //TODO: Do something about this so it's nice-looking and easily readable. Plus, test compatibility against mods like BoP - if(rand.nextBoolean()) { //Empty Ruin Structures + if(rand.nextInt(3) == 0) { //Empty Ruin Structures switch(rand.nextInt(4)) { case 0: NTMRuin1 ruin1 = new NTMRuin1(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); @@ -141,11 +141,11 @@ public class MapGenNTMFeatures extends MapGenStructure { NTMWorkshop1 workshop1 = new NTMWorkshop1(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); this.components.add(workshop1); - } else if(biome.heightVariation <= 0.2 && biome.rainfall <= 0.5 && !(biome instanceof BiomeGenBeach) && rand.nextInt(3) == 0) { //Everything except jungles, extra-hilly areas, and beaches + } else if(biome.heightVariation <= 0.2 && biome.rainfall <= 0.5 && !(biome instanceof BiomeGenBeach) && rand.nextInt(5) == 0) { //Everything except jungles, extra-hilly areas, and beaches MilitaryBaseFeatures.smallHelipad(components, chunkX, posY, chunkZ, rand); //agggggggg } else { //Everything else - switch(rand.nextInt(3)) { + switch(rand.nextInt(4)) { case 0: NTMLab2 lab2 = new NTMLab2(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); this.components.add(lab2); break; @@ -155,6 +155,9 @@ public class MapGenNTMFeatures extends MapGenStructure { case 2: LargeOffice office = new LargeOffice(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); this.components.add(office); break; + case 3: + LargeOfficeCorner officeCorner = new LargeOfficeCorner(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); + this.components.add(officeCorner); break; } } diff --git a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java index ebcdeb079..b0244cf84 100644 --- a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java @@ -217,4 +217,228 @@ public class OfficeFeatures { } + //bob i could kiss you + public static class LargeOfficeCorner extends Feature { + + private static ConcreteBricks ConcreteBricks = new ConcreteBricks(); + + public LargeOfficeCorner() { + super(); + } + + public LargeOfficeCorner(Random rand, int minX, int minY, int minZ) { + super(rand, minX, minY, minZ, 11, 15, 14); + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + + if(!this.setAverageHeight(world, box, this.boundingBox.minY)) { + return true; + } + + this.boundingBox.offset(0, -1, 0); + + int pillarMetaWE = getPillarMeta(4); + int pillarMetaNS = getPillarMeta(8); + + placeFoundationUnderneath(world, Blocks.stonebrick, 0, 4, 0, 11, 2, -1, box); + placeFoundationUnderneath(world, Blocks.stonebrick, 0, 1, 3, 11, 13, -1, box); + placeFoundationUnderneath(world, Blocks.stonebrick, 0, 0, 14, 4, 14, -1, box); + placeFoundationUnderneath(world, Blocks.stonebrick, 0, 0, 10, 0, 13, -1, box); + + fillWithAir(world, box, 1, 1, 11, 3, 12, 13); + fillWithAir(world, box, 4, 1, 4, 10, 12, 12); + fillWithAir(world, box, 2, 1, 4, 3, 12, 10); + fillWithAir(world, box, 5, 1, 1, 10, 12, 2); + fillWithAir(world, box, 5, 13, 1, 8, 14, 2); + + //Back Wall + fillWithBlocks(world, box, 1, 0, 3, 5, 0, 3, ModBlocks.concrete_pillar); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMetaWE, 6, 0, 3, box); + fillWithBlocks(world, box, 7, 0, 3, 10, 0, 3, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 4, 0, 0, 4, 0, 2, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 5, 0, 0, 11, 0, 0, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 11, 1, 0, 11, 12, 0, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 1, 1, 3, 1, 12, 3, ModBlocks.concrete_pillar); + fillWithRandomizedBlocks(world, box, 4, 1, 0, 10, 12, 0, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 13, 0, 9, 13, 0, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 14, 0, 8, 14, 0, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 15, 0, 7, 15, 0, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 2, 1, 3, 5, 2, 3, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 7, 1, 3, 10, 2, 3, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 2, 3, 3, 10, 7, 3, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 2, 8, 3, 9, 10, 3, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 2, 11, 3, 10, 12, 3, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 13, 3, 4, 14, 3, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 6, 13, 3, 9, 13, 3, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 6, 14, 3, 8, 14, 3, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 15, 3, 7, 15, 3, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 1, 1, 4, 15, 2, rand, ConcreteBricks); + //Right Wall + fillWithBlocks(world, box, 11, 0, 1, 11, 0, 12, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 11, 0, 13, 11, 12, 13, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 11, 1, 3, 11, 7, 3, ModBlocks.concrete_pillar); + fillWithMetadataBlocks(world, box, 11, 4, 1, 11, 4, 2, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithMetadataBlocks(world, box, 11, 8, 1, 11, 8, 12, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 11, 9, 3, 11, 11, 3, ModBlocks.concrete_pillar); + fillWithMetadataBlocks(world, box, 11, 12, 1, 11, 12, 12, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithRandomizedBlocks(world, box, 11, 9, 1, 11, 11, 2, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 11, 5, 1, 11, 7, 2, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 11, 1, 1, 11, 3, 2, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 11, 1, 4, 11, 7, 12, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 11, 9, 4, 11, 9, 12, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 11, 10, 4, 11, 10, 4, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 11, 10, 8, 11, 10, 8, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 11, 10, 12, 11, 10, 12, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 11, 11, 4, 11, 11, 12, rand, ConcreteBricks); + //Front Wall + fillWithBlocks(world, box, 4, 0, 13, 10, 0, 13, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 4, 0, 14, 4, 12, 14, ModBlocks.concrete_pillar); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, 0, 3, 0, 14, box); + fillWithMetadataBlocks(world, box, 1, 0, 14, 2, 0, 14, ModBlocks.concrete_pillar, pillarMetaWE); + fillWithBlocks(world, box, 0, 0, 14, 0, 12, 14, ModBlocks.concrete_pillar); + fillWithRandomizedBlocks(world, box, 4, 1, 13, 10, 1, 13, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 10, 2, 13, 10, 3, 13, rand, ConcreteBricks); + fillWithBlocks(world, box, 9, 2, 13, 9, 3, 13, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 6, 2, 13, 6, 3, 13, ModBlocks.concrete_pillar); + fillWithRandomizedBlocks(world, box, 4, 2, 13, 5, 3, 13, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 4, 13, 10, 5, 13, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 10, 6, 13, 10, 7, 13, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 6, 13, 5, 7, 13, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 8, 13, 10, 9, 13, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 10, 10, 13, 10, 11, 13, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 10, 13, 5, 11, 13, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 12, 13, 10, 12, 13, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 3, 1, 14, 3, 2, 14, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 1, 3, 14, 3, 5, 14, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 1, 8, 14, 3, 9, 14, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 1, 12, 14, 3, 12, 14, rand, ConcreteBricks); + //Left Wall + fillWithMetadataBlocks(world, box, 0, 0, 12, 0, 0, 13, ModBlocks.concrete_pillar, pillarMetaNS); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, 0, 0, 0, 11, box); + fillWithBlocks(world, box, 0, 0, 10, 0, 12, 10, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 1, 0, 4, 1, 0, 10, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 1, 0, 3, 1, 12, 3, ModBlocks.concrete_pillar); + fillWithRandomizedBlocks(world, box, 0, 1, 11, 0, 2, 11, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 0, 3, 11, 0, 5, 13, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 0, 8, 11, 0, 9, 13, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 0, 12, 11, 0, 12, 13, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 1, 1, 4, 1, 1, 10, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 1, 2, 9, 1, 3, 10, rand, ConcreteBricks); + fillWithBlocks(world, box, 1, 2, 8, 1, 3, 8, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 1, 2, 5, 1, 3, 5, ModBlocks.concrete_pillar); + fillWithRandomizedBlocks(world, box, 1, 2, 4, 1, 3, 4, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 1, 4, 4, 1, 5, 10, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 1, 6, 9, 1, 7, 10, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 1, 6, 4, 1, 7, 4, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 1, 8, 4, 1, 9, 10, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 1, 10, 9, 1, 11, 10, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 1, 10, 4, 1, 11, 4, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 1, 12, 4, 1, 12, 10, rand, ConcreteBricks); + + //Floor 1 + fillWithMetadataBlocks(world, box, 5, 0, 1, 10, 0, 2, ModBlocks.concrete_pillar, pillarMetaWE); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMetaWE, 6, 0, 3, box); + fillWithMetadataBlocks(world, box, 2, 0, 4, 10, 0, 10, Blocks.planks, 1); + fillWithMetadataBlocks(world, box, 3, 0, 11, 10, 0, 11, Blocks.planks, 1); + fillWithMetadataBlocks(world, box, 4, 0, 12, 10, 0, 12, Blocks.planks, 1); + fillWithMetadataBlocks(world, box, 1, 0, 11, 2, 0, 13, Blocks.wool, 7); //Grey + fillWithMetadataBlocks(world, box, 3, 0, 12, 3, 0, 13, Blocks.wool, 7); + //Floor 2 + fillWithMetadataBlocks(world, box, 5, 4, 1, 5, 4, 3, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithMetadataBlocks(world, box, 2, 4, 4, 10, 4, 12, Blocks.planks, 1); + fillWithMetadataBlocks(world, box, 1, 4, 11, 1, 4, 13, Blocks.planks, 1); + fillWithMetadataBlocks(world, box, 2, 4, 13, 3, 4, 13, Blocks.planks, 1); + //Floor 3 + fillWithMetadataBlocks(world, box, 10, 8, 1, 10, 8, 3, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithMetadataBlocks(world, box, 2, 8, 4, 10, 8, 12, Blocks.planks, 1); + fillWithMetadataBlocks(world, box, 1, 8, 11, 1, 8, 13, Blocks.planks, 1); + fillWithMetadataBlocks(world, box, 2, 8, 13, 3, 8, 13, Blocks.planks, 1); + //Ceiling + fillWithMetadataBlocks(world, box, 5, 12, 1, 5, 12, 2, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 10, 12, 1, 10, 12, 2, ModBlocks.asphalt); + fillWithBlocks(world, box, 9, 13, 1, 9, 13, 2, ModBlocks.asphalt); + fillWithBlocks(world, box, 8, 14, 1, 8, 14, 2, ModBlocks.asphalt); + fillWithBlocks(world, box, 5, 15, 1, 7, 15, 2, ModBlocks.asphalt); + fillWithBlocks(world, box, 2, 12, 4, 10, 12, 12, ModBlocks.brick_light); + fillWithBlocks(world, box, 1, 12, 11, 1, 12, 13, ModBlocks.brick_light); + fillWithBlocks(world, box, 2, 12, 13, 3, 12, 13, ModBlocks.brick_light); + //Staircase + int EastStairMeta = getStairMeta(1); + int WestStairMeta = getStairMeta(0); + int EastStairMetaUD = EastStairMeta | 4; + int WestStairMetaUD = WestStairMeta | 4; + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 9, 1, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 8, 1, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 8, 2, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 7, 2, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 7, 3, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 6, 3, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 6, 4, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMetaUD, 6, 4, 2, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 6, 5, 2, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMetaUD, 7, 5, 2, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 7, 6, 2, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMetaUD, 8, 6, 2, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 8, 7, 2, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMetaUD, 9, 7, 2, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 9, 8, 2, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 9, 8, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 9, 9, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 8, 9, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 8, 10, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 7, 10, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 7, 11, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMetaUD, 6, 11, 1, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 6, 12, 1, box); + + //Decoration already? holy fuck it's been like 20 minutes + //Windows + randomlyFillWithBlocks(world, box, rand, 0.75F, 11, 10, 5, 11, 10, 7, Blocks.glass_pane); + randomlyFillWithBlocks(world, box, rand, 0.75F, 11, 10, 9, 11, 10, 11, Blocks.glass_pane); + randomlyFillWithBlocks(world, box, rand, 0.75F, 7, 2, 13, 8, 3, 13, Blocks.glass_pane); + randomlyFillWithBlocks(world, box, rand, 0.75F, 6, 6, 13, 9, 7, 13, Blocks.glass_pane); + randomlyFillWithBlocks(world, box, rand, 0.75F, 6, 10, 13, 9, 11, 13, Blocks.glass_pane); + randomlyFillWithBlocks(world, box, rand, 0.75F, 1, 6, 14, 3, 7, 14, Blocks.glass_pane); + randomlyFillWithBlocks(world, box, rand, 0.75F, 1, 10, 14, 3, 11, 14, Blocks.glass_pane); + randomlyFillWithBlocks(world, box, rand, 0.75F, 0, 6, 11, 0, 7, 13, Blocks.glass_pane); + randomlyFillWithBlocks(world, box, rand, 0.75F, 0, 10, 11, 0, 11, 13, Blocks.glass_pane); + randomlyFillWithBlocks(world, box, rand, 0.75F, 1, 2, 6, 1, 3, 7, Blocks.glass_pane); + randomlyFillWithBlocks(world, box, rand, 0.75F, 1, 6, 5, 1, 7, 8, Blocks.glass_pane); + randomlyFillWithBlocks(world, box, rand, 0.75F, 1, 10, 5, 1, 11, 8, Blocks.glass_pane); + //Trim + randomlyFillWithBlocks(world, box, rand, 0.85F, 10, 13, 0, 10, 13, 0, Blocks.stone_slab); + randomlyFillWithBlocks(world, box, rand, 0.85F, 11, 13, 0, 11, 13, 13, Blocks.stone_slab); + randomlyFillWithBlocks(world, box, rand, 0.85F, 4, 13, 13, 10, 13, 13, Blocks.stone_slab); + randomlyFillWithBlocks(world, box, rand, 0.85F, 0, 13, 14, 4, 13, 14, Blocks.stone_slab); + randomlyFillWithBlocks(world, box, rand, 0.85F, 0, 13, 10, 0, 13, 13, Blocks.stone_slab); + randomlyFillWithBlocks(world, box, rand, 0.85F, 1, 13, 3, 1, 13, 10, Blocks.stone_slab); + randomlyFillWithBlocks(world, box, rand, 0.85F, 2, 13, 3, 3, 13, 3, Blocks.stone_slab); + //Interior Walls + fillWithRandomizedBlocks(world, box, 4, 5, 12, 4, 6, 12, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 5, 10, 4, 6, 10, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 7, 10, 4, 7, 12, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 2, 5, 10, 3, 7, 10, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 4, 9, 10, 4, 11, 12, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 2, 11, 10, 3, 11, 10, rand, ConcreteBricks); + fillWithRandomizedBlocks(world, box, 2, 9, 10, 2, 10, 10, rand, ConcreteBricks); + //Doors + placeDoor(world, box, Blocks.wooden_door, 3, 1, 1, 14); + placeDoor(world, box, Blocks.wooden_door, 3, 2, 1, 14); + placeDoor(world, box, Blocks.wooden_door, 0, 0, 1, 12); + placeDoor(world, box, Blocks.wooden_door, 0, 0, 1, 13); + placeDoor(world, box, ModBlocks.door_office, 0, 6, 1, 3); + placeDoor(world, box, ModBlocks.door_office, 0, 5, 5, 3); + placeDoor(world, box, ModBlocks.door_office, 2, 4, 5, 11); + placeDoor(world, box, ModBlocks.door_office, 0, 10, 9, 3); + placeDoor(world, box, ModBlocks.door_office, 1, 3, 9, 10); + placeDoor(world, box, ModBlocks.door_metal, 0, 5, 13, 3); + //Furniture + + return false; + } + } + + } diff --git a/src/main/resources/assets/hbm/textures/items/structure_randomized.png b/src/main/resources/assets/hbm/textures/items/structure_randomized.png new file mode 100644 index 0000000000000000000000000000000000000000..ad04cb3904cb3522f174d0a684575aef04b2ded3 GIT binary patch literal 224 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0G|-o|2Kdv5Rkvpp#-FuOM?7@|Nm#Weu@{UmVvXtBeIx*f$uN~Gak=h zkpdJ9^mK6y(Fl(1#evr|0p8%ho|^)^`;7&j>K~hdP&(0}W^JboFyt I=akR{08W-de*gdg literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/items/structure_randomly.png b/src/main/resources/assets/hbm/textures/items/structure_randomly.png new file mode 100644 index 0000000000000000000000000000000000000000..15c8ebcebb72ee900db995f44cfaf1003312d34e GIT binary patch literal 225 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}c0G|-o|2Kdv5Rkvpp#-FuOM?7@|Nm#Weu@{UmVvXtBeIx*f$tCqGm2_> zH2?*JJY5_^G=gLMP6{$8a4<9f70=~!llgox*3zZkkvWvvN|Q_3OFyIN*9j95R_?94 zl9<$tg$lWPPb*JTmfQAV)@h+T+k7Vezq2IC;bTwC Date: Sun, 25 Sep 2022 21:34:44 -0700 Subject: [PATCH 02/30] BlockDecoContainer, filing cabinet --- src/main/java/com/hbm/blocks/ModBlocks.java | 10 +- .../blocks/generic/BlockDecoContainer.java | 106 ++++ .../hbm/blocks/generic/BlockDecoModel.java | 53 +- .../container/ContainerFileCabinet.java | 76 +++ .../com/hbm/inventory/gui/GUIFileCabinet.java | 42 ++ .../inventory/recipes/anvil/AnvilRecipes.java | 10 + src/main/java/com/hbm/main/ClientProxy.java | 2 + .../java/com/hbm/main/ResourceManager.java | 6 + .../render/block/RenderBlockDecoModel.java | 3 +- .../render/tileentity/RenderFileCabinet.java | 80 +++ .../java/com/hbm/tileentity/TileMappings.java | 2 + .../storage/TileEntityFileCabinet.java | 145 +++++ src/main/resources/assets/hbm/lang/en_US.lang | 2 + .../assets/hbm/models/file_cabinet.obj | 530 ++++++++++++++++++ ...{deco_computer_0.png => deco_computer.png} | Bin .../textures/gui/storage/gui_file_cabinet.png | Bin 0 -> 850 bytes .../hbm/textures/models/file_cabinet.png | Bin 0 -> 5292 bytes 17 files changed, 1062 insertions(+), 5 deletions(-) create mode 100644 src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java create mode 100644 src/main/java/com/hbm/inventory/container/ContainerFileCabinet.java create mode 100644 src/main/java/com/hbm/inventory/gui/GUIFileCabinet.java create mode 100644 src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java create mode 100644 src/main/java/com/hbm/tileentity/machine/storage/TileEntityFileCabinet.java create mode 100644 src/main/resources/assets/hbm/models/file_cabinet.obj rename src/main/resources/assets/hbm/textures/blocks/{deco_computer_0.png => deco_computer.png} (100%) create mode 100644 src/main/resources/assets/hbm/textures/gui/storage/gui_file_cabinet.png create mode 100644 src/main/resources/assets/hbm/textures/models/file_cabinet.png diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 87480424e..cbddf79bc 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -20,6 +20,7 @@ import com.hbm.lib.ModDamageSource; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.tileentity.DoorDecl; +import com.hbm.tileentity.machine.storage.TileEntityFileCabinet; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; @@ -410,7 +411,9 @@ public class ModBlocks { public static Block brick_forgotten; public static Block deco_computer; - + + public static Block filing_cabinet; + public static Block tape_recorder; public static Block steel_poles; public static Block pole_top; @@ -1673,7 +1676,9 @@ public class ModBlocks { brick_forgotten = new BlockGeneric(Material.rock).setBlockName("brick_forgotten").setCreativeTab(MainRegistry.blockTab).setBlockUnbreakable().setResistance(1000000).setBlockTextureName(RefStrings.MODID + ":brick_forgotten"); - deco_computer = new BlockDecoModel(Material.iron, 1).setBlockName("deco_computer").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_computer"); + deco_computer = new BlockDecoModel(Material.iron, 1).setBlockBoundsTo(.160749F, 0F, 0F, .839251F, .867849F, .622184F).setBlockName("deco_computer").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_computer"); + + filing_cabinet = new BlockDecoContainer(Material.iron, 1, TileEntityFileCabinet.class).setBlockBoundsTo(.1875F, 0F, 0F, .8125F, 1F, .75F).setBlockName("filing_cabinet").setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":block_steel"); tape_recorder = new DecoTapeRecorder(Material.iron).setBlockName("tape_recorder").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder"); steel_poles = new DecoSteelPoles(Material.iron).setBlockName("steel_poles").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam"); @@ -2788,6 +2793,7 @@ public class ModBlocks { GameRegistry.registerBlock(brick_dungeon_circle, brick_dungeon_circle.getUnlocalizedName()); GameRegistry.registerBlock(brick_forgotten, brick_forgotten.getUnlocalizedName()); GameRegistry.registerBlock(deco_computer, ItemBlockMeta.class, deco_computer.getUnlocalizedName()); + GameRegistry.registerBlock(filing_cabinet, filing_cabinet.getUnlocalizedName()); GameRegistry.registerBlock(tape_recorder, tape_recorder.getUnlocalizedName()); GameRegistry.registerBlock(steel_poles, steel_poles.getUnlocalizedName()); GameRegistry.registerBlock(pole_top, pole_top.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java b/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java new file mode 100644 index 000000000..d2dafd4ea --- /dev/null +++ b/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java @@ -0,0 +1,106 @@ +package com.hbm.blocks.generic; + +import java.util.Random; + +import com.hbm.main.MainRegistry; + +import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class BlockDecoContainer extends BlockDecoModel implements ITileEntityProvider { + + Class tile; + + public BlockDecoContainer(Material mat, int types, Class tile) { + super(mat, types); + this.tile = tile; + } + + @Override + public TileEntity createNewTileEntity(World world, int metadata) { + try { + return tile.newInstance(); + } catch (Exception e) { + System.out.println("BlockDecoContainer attempted to create a TE, but couldn't. How does that even happen?"); + return null; + } + } + + @Override + public boolean onBlockEventReceived(World world, int x, int y, int z, int eventNo, int eventArg) { + super.onBlockEventReceived(world, x, y, z, eventNo, eventArg); + TileEntity tileentity = world.getTileEntity(x, y, z); + return tileentity != null ? tileentity.receiveClientEvent(eventNo, eventArg) : false; + } + + @Override + public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + + if(world.isRemote) { + return true; + } else if(!player.isSneaking()) { + + FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z); + return true; + } else { + return true; + } + } + + @Override + public int getRenderType() { + return -1; + } + + @Override + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + IInventory inventory = (IInventory) world.getTileEntity(x, y, z); + Random rand = world.rand; + + if(inventory != null) { + for(int i1 = 0; i1 < inventory.getSizeInventory(); ++i1) { + ItemStack itemstack = inventory.getStackInSlot(i1); + + if (itemstack != null) { + float f = rand.nextFloat() * 0.8F + 0.1F; + float f1 = rand.nextFloat() * 0.8F + 0.1F; + float f2 = rand.nextFloat() * 0.8F + 0.1F; + + while(itemstack.stackSize > 0) { + int j1 = rand.nextInt(21) + 10; + + if (j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } + + itemstack.stackSize -= j1; + EntityItem entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + + if(itemstack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + + float f3 = 0.05F; + entityitem.motionX = (float) rand.nextGaussian() * f3; + entityitem.motionY = (float) rand.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) rand.nextGaussian() * f3; + world.spawnEntityInWorld(entityitem); + } + } + } + + world.func_147453_f(x, y, z, block); + } + + super.breakBlock(world, x, y, z, block, meta); + } + } +} diff --git a/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java b/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java index d62ae2d39..6b836510d 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java +++ b/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java @@ -14,8 +14,10 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockDecoModel extends Block { @@ -57,7 +59,10 @@ public class BlockDecoModel extends Block { @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { - return this.icons[(meta >> 2) % this.icons.length]; + if(subTypes > 1) + return this.icons[(meta >> 2) % this.icons.length]; + + return this.blockIcon; } public static int renderID = RenderingRegistry.getNextAvailableRenderId(); @@ -99,4 +104,48 @@ public class BlockDecoModel extends Block { world.setBlockMetadataWithNotify(x, y, z, meta, 2); } -} + + //These are separate because they have to be constant + private float mnX = 0.0F; //min + private float mnY = 0.0F; + private float mnZ = 0.0F; + private float mxX = 1.0F; //max + private float mxY = 1.0F; + private float mxZ = 1.0F; + + public BlockDecoModel setBlockBoundsTo(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) { + mnX = minX; + mnY = minY; + mnZ = minZ; + mxX = maxX; + mxY = maxY; + mxZ = maxZ; + + return this; + } + + @Override + public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { + switch(world.getBlockMetadata(x, y, z) & 3) { + case 0://North + this.setBlockBounds(1 - mxX, mnY, 1 - mxZ, 1 - mnX, mxY, 1 - mnZ); + break; + case 1://South + this.setBlockBounds(mnX, mnY, mnZ, mxX, mxY, mxZ); + break; + case 2://West + this.setBlockBounds(1 - mxZ, mnY, mnX, 1 - mnZ, mxY, mxX); + break; + case 3://East + this.setBlockBounds(mnZ, mnY, 1 - mxX, mxZ, mxY, 1 - mnX); + break; + } + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { + this.setBlockBoundsBasedOnState(world, x, y, z); + return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); + } + +} \ No newline at end of file diff --git a/src/main/java/com/hbm/inventory/container/ContainerFileCabinet.java b/src/main/java/com/hbm/inventory/container/ContainerFileCabinet.java new file mode 100644 index 000000000..764d4226e --- /dev/null +++ b/src/main/java/com/hbm/inventory/container/ContainerFileCabinet.java @@ -0,0 +1,76 @@ +package com.hbm.inventory.container; + +import com.hbm.tileentity.machine.storage.TileEntityFileCabinet; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerFileCabinet extends Container { + + protected TileEntityFileCabinet cabinet; + + public ContainerFileCabinet(InventoryPlayer invPlayer, TileEntityFileCabinet tile) { + this.cabinet = tile; + this.cabinet.openInventory(); + + for(int i = 0; i < 2; i++) { + for(int j = 0; j < 4; j++) { + this.addSlotToContainer(new Slot(tile, j + i * 4, 53 + j * 18, 18 + i * 36)); + } + } + + for(int i = 0; i < 3; i++) { + for(int j = 0; j < 9; j++) { + this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 88 + i * 18)); + } + } + + for(int i = 0; i < 9; i++) { + this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 146)); + } + } + + @Override + public ItemStack transferStackInSlot(EntityPlayer player, int index) { + ItemStack returnStack = null; + Slot slot = (Slot) this.inventorySlots.get(index); + + if(slot != null && slot.getHasStack()) { + ItemStack originalStack = slot.getStack(); + returnStack = originalStack.copy(); + + if(index <= 7) { + if(!this.mergeItemStack(originalStack, 8, this.inventorySlots.size(), true)) { + return null; + } + + slot.onSlotChange(originalStack, returnStack); + + } else if(!this.mergeItemStack(originalStack, 0, 8, false)) { + return null; + } + + if(originalStack.stackSize == 0) { + slot.putStack((ItemStack) null); + } else { + slot.onSlotChanged(); + } + } + + return returnStack; + } + + @Override + public boolean canInteractWith(EntityPlayer player) { + return cabinet.isUseableByPlayer(player); + } + + @Override + public void onContainerClosed(EntityPlayer player) { + super.onContainerClosed(player); + this.cabinet.closeInventory(); + } +} diff --git a/src/main/java/com/hbm/inventory/gui/GUIFileCabinet.java b/src/main/java/com/hbm/inventory/gui/GUIFileCabinet.java new file mode 100644 index 000000000..41d83fb6e --- /dev/null +++ b/src/main/java/com/hbm/inventory/gui/GUIFileCabinet.java @@ -0,0 +1,42 @@ +package com.hbm.inventory.gui; + +import org.lwjgl.opengl.GL11; + +import com.hbm.inventory.container.ContainerFileCabinet; +import com.hbm.lib.RefStrings; +import com.hbm.tileentity.machine.storage.TileEntityFileCabinet; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +public class GUIFileCabinet extends GuiContainer { + + private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/storage/gui_file_cabinet.png"); + private TileEntityFileCabinet cabinet; + + public GUIFileCabinet(InventoryPlayer invPlayer, TileEntityFileCabinet tile) { + super(new ContainerFileCabinet(invPlayer, tile)); + cabinet = tile; + + this.xSize = 176; + this.ySize = 170; + } + + @Override + protected void drawGuiContainerForegroundLayer(int i, int j) { + String name = this.cabinet.hasCustomInventoryName() ? this.cabinet.getInventoryName() : I18n.format(this.cabinet.getInventoryName()); + + this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); + this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); + } + + @Override + protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); + } +} diff --git a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java index c409e2f84..caad579ec 100644 --- a/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/anvil/AnvilRecipes.java @@ -591,6 +591,16 @@ public class AnvilRecipes { } ).setTier(2)); + constructionRecipes.add(new AnvilConstructionRecipe( + new ComparableStack(ModBlocks.filing_cabinet), + new AnvilOutput[] { + new AnvilOutput(new ItemStack(ModItems.plate_steel, 2)), + new AnvilOutput(new ItemStack(ModItems.plate_steel, 2), 0.5F), + new AnvilOutput(new ItemStack(ModItems.plate_polymer, 2), 0.25F), + new AnvilOutput(new ItemStack(ModItems.scrap, 1)) + + } + ).setTier(1)); constructionRecipes.add(new AnvilConstructionRecipe( new ComparableStack(ModItems.circuit_raw), diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index fa3edc51d..e64cc42dd 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -286,6 +286,8 @@ public class ClientProxy extends ServerProxy { ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySubstation.class, new RenderSubstation()); //chargers ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCharger.class, new RenderCharger()); + //DecoContainer + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFileCabinet.class, new RenderFileCabinet()); //multiblocks ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStructureMarker.class, new RenderStructureMaker()); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMultiblock.class, new RenderMultiblock()); diff --git a/src/main/java/com/hbm/main/ResourceManager.java b/src/main/java/com/hbm/main/ResourceManager.java index 26e6ee247..557493c5d 100644 --- a/src/main/java/com/hbm/main/ResourceManager.java +++ b/src/main/java/com/hbm/main/ResourceManager.java @@ -319,6 +319,9 @@ public class ResourceManager { //Belt public static final IModelCustom charger = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/blocks/charger.obj")); + //DecoContainer (File Cabinet for now) + public static final IModelCustom file_cabinet = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/file_cabinet.obj")); + ////Textures TEs public static final ResourceLocation universal = new ResourceLocation(RefStrings.MODID, "textures/models/TheGadget3_.png"); @@ -655,6 +658,9 @@ public class ResourceManager { //Charger public static final ResourceLocation charger_tex = new ResourceLocation(RefStrings.MODID, "textures/models/machines/charger.png"); + //DecoContainer + public static final ResourceLocation file_cabinet_tex = new ResourceLocation(RefStrings.MODID, "textures/models/file_cabinet.png"); + ////Obj Items //Shimmer Sledge diff --git a/src/main/java/com/hbm/render/block/RenderBlockDecoModel.java b/src/main/java/com/hbm/render/block/RenderBlockDecoModel.java index 769c53838..660cf8f13 100644 --- a/src/main/java/com/hbm/render/block/RenderBlockDecoModel.java +++ b/src/main/java/com/hbm/render/block/RenderBlockDecoModel.java @@ -35,7 +35,8 @@ public class RenderBlockDecoModel implements ISimpleBlockRenderingHandler { iicon = renderer.overrideBlockTexture; } - GL11.glRotated(-15, 0, 1, 0); + GL11.glTranslated(0, 0.1D, 0); + GL11.glScaled(1.2D, 1.2D, 1.2D); tessellator.startDrawingQuads(); ObjUtil.renderWithIcon((WavefrontObject) model, iicon, tessellator, modelId, false); diff --git a/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java b/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java new file mode 100644 index 000000000..156562a15 --- /dev/null +++ b/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java @@ -0,0 +1,80 @@ +package com.hbm.render.tileentity; + +import org.lwjgl.opengl.GL11; + +import com.hbm.blocks.ModBlocks; +import com.hbm.main.ResourceManager; +import com.hbm.render.item.ItemRenderBase; +import com.hbm.tileentity.machine.storage.TileEntityFileCabinet; + +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.client.IItemRenderer; + +public class RenderFileCabinet extends TileEntitySpecialRenderer implements IItemRendererProvider { + + @Override + public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) { + + GL11.glPushMatrix(); + GL11.glTranslated(x + 0.5, y, z + 0.5); + GL11.glEnable(GL11.GL_LIGHTING); + GL11.glEnable(GL11.GL_CULL_FACE); + + switch(tile.getBlockMetadata() & 3) { //rotation + case 0: + GL11.glRotatef(180, 0F, 1F, 0F); + break; + case 1: + GL11.glRotatef(0, 0F, 1F, 0F); + break; + case 2: + GL11.glRotatef(270, 0F, 1F, 0F); + break; + case 3: + GL11.glRotatef(90, 0F, 1F, 0F); + break; + } + + TileEntityFileCabinet cabinet = (TileEntityFileCabinet) tile; + + bindTexture(ResourceManager.file_cabinet_tex); + ResourceManager.file_cabinet.renderPart("Cabinet"); + + GL11.glPushMatrix(); + float lower = cabinet.prevLowerExtent + (cabinet.lowerExtent - cabinet.prevLowerExtent) * interp; + GL11.glTranslated(0F, 0F, 0.6875F * lower); + ResourceManager.file_cabinet.renderPart("LowerDrawer"); + GL11.glPopMatrix(); + + GL11.glPushMatrix(); + float upper = cabinet.prevUpperExtent + (cabinet.upperExtent - cabinet.prevUpperExtent) * interp; + GL11.glTranslated(0F, 0F, 0.6875F * upper); + ResourceManager.file_cabinet.renderPart("UpperDrawer"); + GL11.glPopMatrix(); + + GL11.glPopMatrix(); + } + + @Override + public Item getItemForRenderer() { + return Item.getItemFromBlock(ModBlocks.filing_cabinet); + } + + @Override + public IItemRenderer getRenderer() { + return new ItemRenderBase() { + public void renderInventory() { + GL11.glTranslated(-1D, 0.5D, -1D); + GL11.glRotatef(180F, 0, 1F, 0); + GL11.glScalef(4F, 4F, 4F); + } + public void renderCommon() { + GL11.glTranslated(0, -1.25D, 0); + GL11.glScaled(2.75D, 2.75D, 2.75D); + bindTexture(ResourceManager.file_cabinet_tex); + ResourceManager.file_cabinet.renderAll(); + }}; + } +} diff --git a/src/main/java/com/hbm/tileentity/TileMappings.java b/src/main/java/com/hbm/tileentity/TileMappings.java index 5c2f87d3a..9809fbf68 100644 --- a/src/main/java/com/hbm/tileentity/TileMappings.java +++ b/src/main/java/com/hbm/tileentity/TileMappings.java @@ -185,6 +185,8 @@ public class TileMappings { put(TileEntityCharger.class, "tileentity_ntm_charger"); + put(TileEntityFileCabinet.class, "tileentity_file_cabinet"); + put(TileEntityProxyInventory.class, "tileentity_proxy_inventory"); put(TileEntityProxyEnergy.class, "tileentity_proxy_power"); put(TileEntityProxyCombo.class, "tileentity_proxy_combo"); diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityFileCabinet.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityFileCabinet.java new file mode 100644 index 000000000..958ad13de --- /dev/null +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityFileCabinet.java @@ -0,0 +1,145 @@ +package com.hbm.tileentity.machine.storage; + +import com.hbm.inventory.container.ContainerFileCabinet; +import com.hbm.inventory.gui.GUIFileCabinet; +import com.hbm.packet.NBTPacket; +import com.hbm.packet.PacketDispatcher; +import com.hbm.tileentity.IGUIProvider; +import com.hbm.tileentity.INBTPacketReceiver; + +import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIProvider, INBTPacketReceiver { + + private int timer = 0; + private int playersUsing = 0; + //meh, it's literally just two extra variables + public float lowerExtent = 0; //i don't know a term for how 'open' something is + public float prevLowerExtent = 0; + public float upperExtent = 0; + public float prevUpperExtent = 0; + + public TileEntityFileCabinet() { + super(8); + } + + @Override + public String getInventoryName() { + return "container.fileCabinet"; + } + + @Override + public void openInventory() { + if(!worldObj.isRemote) this.playersUsing++; + //somehow guarentee that playersUsing is synced up when this method is called, to allow for sounds upon *actually* opening/closing? + //this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 1.0F, 1.0F); + } + + @Override + public void closeInventory() { + if(!worldObj.isRemote) this.playersUsing--; + } + + @Override + public void updateEntity() { + + if(!worldObj.isRemote) { + + if(this.playersUsing > 0) { + if(timer < 10) { + timer++; + } + } else + timer = 0; + + NBTTagCompound data = new NBTTagCompound(); + data.setInteger("timer", timer); + data.setInteger("playersUsing", this.playersUsing); + PacketDispatcher.wrapper.sendToAllAround(new NBTPacket(data, xCoord, yCoord, zCoord), new TargetPoint(this.worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 25)); + } else { + this.prevLowerExtent = lowerExtent; + this.prevUpperExtent = upperExtent; + float openSpeed = 1F / 25F; + + if(this.playersUsing > 0) { + this.lowerExtent += openSpeed; + + if(timer >= 10) + this.upperExtent += openSpeed; + } else { + this.lowerExtent -= openSpeed; + this.upperExtent -= openSpeed; + } + + this.lowerExtent = MathHelper.clamp_float(lowerExtent, 0F, 0.8F); + this.upperExtent = MathHelper.clamp_float(upperExtent, 0F, 0.8F); + } + } + + @Override + public void networkUnpack(NBTTagCompound nbt) { + this.timer = nbt.getInteger("timer"); + this.playersUsing = nbt.getInteger("playersUsing"); + } + + @Override + public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { + return new ContainerFileCabinet(player.inventory, this); + } + + @Override + public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { + return new GUIFileCabinet(player.inventory, this); + } + + //No automation, it's a filing cabinet. + @Override + public boolean isItemValidForSlot(int i, ItemStack stack) { + return false; + } + + @Override + public boolean canInsertItem(int i, ItemStack itemStack, int j) { + return false; + } + + @Override + public boolean canExtractItem(int i, ItemStack itemStack, int j) { + return false; + } + + AxisAlignedBB bb = null; + + @Override + public AxisAlignedBB getRenderBoundingBox() { + + if(bb == null) { + bb = AxisAlignedBB.getBoundingBox( + xCoord - 1, + yCoord, + zCoord - 1, + xCoord + 1, + yCoord + 1, + zCoord + 1 + ); + } + + return bb; + } + + @Override + @SideOnly(Side.CLIENT) + public double getMaxRenderDistanceSquared() { + return 65536.0D; + } +} diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index d6ecaf4dd..1d7c1ca58 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -485,6 +485,7 @@ container.epress=Electric Press container.factoryAdvanced=Advanced Factory container.factoryTitanium=Basic Factory container.fluidtank=Tank +container.fileCabinet=Filing Cabinet container.forceField=Forcefield Emitter container.frackingTower=Hydraulic Fracking Tower container.furnaceIron=Iron Furnace @@ -3912,6 +3913,7 @@ tile.factory_titanium_hull.name=Factory Block tile.fallout.name=Fallout tile.fence_metal.name=Chainlink Fence tile.field_disturber.name=High Energy Field Jammer +tile.filing_cabinet.name=Filing Cabinet tile.fire_digamma.name=Lingering Digamma tile.fire_door.name=Fire Door tile.fireworks.name=Firework Battery diff --git a/src/main/resources/assets/hbm/models/file_cabinet.obj b/src/main/resources/assets/hbm/models/file_cabinet.obj new file mode 100644 index 000000000..dce12e226 --- /dev/null +++ b/src/main/resources/assets/hbm/models/file_cabinet.obj @@ -0,0 +1,530 @@ +# Blender 3.2.0 +# www.blender.org +o Cabinet +v -0.312500 0.000000 0.250000 +v -0.312500 1.000000 0.250000 +v -0.312500 0.000000 -0.500000 +v -0.312500 1.000000 -0.500000 +v 0.312500 0.000000 0.250000 +v 0.312500 1.000000 0.250000 +v 0.312500 0.000000 -0.500000 +v 0.312500 1.000000 -0.500000 +v -0.312500 0.000000 0.250000 +v -0.312500 1.000000 0.250000 +v 0.312500 1.000000 0.250000 +v 0.312500 0.000000 0.250000 +v -0.250000 0.062500 -0.437500 +v 0.250000 0.062500 -0.437500 +v 0.250000 0.937500 -0.437500 +v -0.250000 0.937500 -0.437500 +v -0.250000 0.531250 -0.437500 +v 0.250000 0.531250 -0.437500 +v 0.312500 0.500000 0.250000 +v 0.250000 0.468750 -0.437500 +v -0.250000 0.468750 -0.437500 +v -0.312500 0.500000 0.250000 +v 0.250000 0.937500 0.250000 +v -0.250000 0.937500 0.250000 +v -0.250000 0.531250 0.250000 +v 0.250000 0.531250 0.250000 +v -0.250000 0.062500 0.250000 +v 0.250000 0.062500 0.250000 +v 0.250000 0.468750 0.250000 +v -0.250000 0.468750 0.250000 +vn -1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 -1.0000 +vn 1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 1.0000 +vn -0.0000 -1.0000 -0.0000 +vn -0.0000 1.0000 -0.0000 +vt 0.750000 0.640625 +vt 1.000000 0.640625 +vt 0.234375 0.828125 +vt 0.484375 0.828125 +vt 0.750000 0.484375 +vt 1.000000 0.484375 +vt 0.890625 0.828125 +vt 0.234375 0.984375 +vt 0.078125 0.828125 +vt 0.484375 0.984375 +vt 0.640625 0.828125 +vt 0.234375 0.640625 +vt 0.484375 0.640625 +vt 0.640625 0.640625 +vt 0.890625 0.640625 +vt 0.078125 0.640625 +vt 0.890625 0.828125 +vt 0.890625 0.703125 +vt 0.765625 0.828125 +vt 1.000000 0.703125 +vt 0.656250 0.828125 +vt 0.531250 0.828125 +vt 1.000000 0.828125 +vt 0.890625 0.828125 +vt 0.890625 0.703125 +vt 0.765625 0.828125 +vt 0.875000 0.484375 +vt 1.000000 0.703125 +vt 0.656250 0.828125 +vt 0.531250 0.828125 +vt 1.000000 0.828125 +vt 0.875000 0.640625 +vt 0.984375 0.500000 +vt 0.656250 1.000000 +vt 0.984375 0.625000 +vt 0.531250 1.000000 +vt 1.000000 1.000000 +vt 0.882812 0.625000 +vt 0.875000 0.500000 +vt 0.890625 1.000000 +vt 0.882812 0.500000 +vt 0.875000 0.625000 +vt 0.765625 1.000000 +vt 0.765625 0.625000 +vt 0.890625 1.000000 +vt 0.765625 0.500000 +vt 0.765625 1.000000 +vt 0.890625 0.625000 +vt 0.867188 0.500000 +vt 0.656250 1.000000 +vt 0.890625 0.500000 +vt 0.867188 0.625000 +vt 1.000000 1.000000 +vt 0.531250 1.000000 +s 0 +f 10/13/1 3/3/1 9/12/1 +f 4/4/2 7/8/2 3/3/2 +f 8/11/3 12/15/3 7/7/3 +f 15/20/4 17/24/4 18/25/4 +f 7/9/5 9/12/5 3/3/5 +f 4/4/6 11/14/6 8/11/6 +f 27/44/4 5/5/4 28/46/4 +f 23/33/4 2/2/4 24/35/4 +f 24/35/4 22/32/4 25/38/4 +f 28/46/4 19/27/4 29/49/4 +f 23/33/4 19/27/4 6/6/4 +f 30/52/4 25/38/4 22/32/4 +f 26/42/4 30/51/4 29/48/4 +f 20/28/4 13/17/4 14/18/4 +f 27/44/4 22/32/4 1/1/4 +f 26/41/4 29/49/4 19/27/4 +f 15/21/5 24/36/5 16/22/5 +f 16/23/3 25/40/3 17/24/3 +f 18/26/1 23/34/1 15/21/1 +f 17/24/6 26/43/6 18/26/6 +f 13/17/6 28/47/6 14/19/6 +f 14/19/1 29/50/1 20/29/1 +f 21/31/3 27/45/3 13/17/3 +f 20/29/5 30/54/5 21/30/5 +f 10/13/1 4/4/1 3/3/1 +f 4/4/2 8/10/2 7/8/2 +f 8/11/3 11/14/3 12/15/3 +f 15/20/4 16/23/4 17/24/4 +f 7/9/5 12/16/5 9/12/5 +f 4/4/6 10/13/6 11/14/6 +f 27/44/4 1/1/4 5/5/4 +f 23/33/4 6/6/4 2/2/4 +f 24/35/4 2/2/4 22/32/4 +f 28/46/4 5/5/4 19/27/4 +f 23/33/4 26/41/4 19/27/4 +f 26/42/4 25/39/4 30/51/4 +f 20/28/4 21/31/4 13/17/4 +f 27/44/4 30/52/4 22/32/4 +f 15/21/5 23/34/5 24/36/5 +f 16/23/3 24/37/3 25/40/3 +f 18/26/1 26/43/1 23/34/1 +f 17/24/6 25/40/6 26/43/6 +f 13/17/6 27/45/6 28/47/6 +f 14/19/1 28/47/1 29/50/1 +f 21/31/3 30/53/3 27/45/3 +f 20/29/5 29/50/5 30/54/5 +o LowerDrawer +v -0.078125 0.171875 0.250000 +v -0.250000 0.468750 0.250000 +v -0.250000 0.062500 -0.437500 +v 0.250000 0.062500 0.250000 +v -0.046875 0.203125 0.250000 +v 0.250000 0.062500 -0.437500 +v -0.250000 0.062500 0.187500 +v -0.250000 0.468750 0.187500 +v 0.250000 0.062500 0.187500 +v 0.250000 0.468750 0.187500 +v -0.218750 0.265625 -0.406250 +v 0.250000 0.265625 -0.437500 +v -0.250000 0.265625 0.187500 +v 0.250000 0.265625 0.187500 +v -0.218750 0.265625 0.187500 +v -0.250000 0.265625 -0.437500 +v 0.218750 0.265625 -0.406250 +v 0.218750 0.265625 0.187500 +v -0.218750 0.093750 -0.406250 +v -0.218750 0.093750 0.187500 +v 0.218750 0.093750 -0.406250 +v 0.218750 0.093750 0.187500 +v -0.250000 0.062500 0.250000 +v -0.078125 0.203125 0.250000 +v 0.250000 0.468750 0.250000 +v -0.046875 0.171875 0.250000 +v 0.046875 0.171875 0.250000 +v 0.078125 0.203125 0.250000 +v 0.046875 0.203125 0.250000 +v 0.078125 0.171875 0.250000 +v 0.046875 0.171875 0.281250 +v 0.046875 0.203125 0.281250 +v 0.078125 0.203125 0.281250 +v 0.078125 0.171875 0.281250 +v -0.078125 0.171875 0.281250 +v -0.078125 0.203125 0.281250 +v -0.046875 0.203125 0.281250 +v -0.046875 0.171875 0.281250 +v -0.046875 0.203125 0.265625 +v -0.046875 0.171875 0.265625 +v 0.046875 0.203125 0.265625 +v 0.046875 0.171875 0.265625 +vn -0.0000 -1.0000 -0.0000 +vn -0.0000 1.0000 -0.0000 +vn 1.0000 -0.0000 -0.0000 +vn -1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 -1.0000 +vn -0.0000 -0.0000 1.0000 +vt 0.046875 0.984375 +vt 0.625000 0.500000 +vt 0.281250 0.390625 +vt 0.078125 0.640625 +vt 0.734375 0.625000 +vt 0.484375 0.640625 +vt 0.046875 1.000000 +vt 0.058594 0.972656 +vt 0.078125 0.515625 +vt 0.750000 0.500000 +vt 0.734375 0.484375 +vt 0.234375 0.640625 +vt 0.078125 0.796875 +vt 0.625000 0.484375 +vt 0.609375 0.500000 +vt 0.734375 0.640625 +vt 0.078125 0.359375 +vt 0.750000 0.625000 +vt 0.234375 0.515625 +vt 0.625000 0.640625 +vt 0.609375 0.625000 +vt 0.019531 0.632812 +vt 0.019531 0.648438 +vt 0.277344 0.484375 +vt 0.027344 0.515625 +vt 0.679688 0.484375 +vt 0.562500 0.500000 +vt 0.027344 0.796875 +vt 0.679688 0.640625 +vt 0.027344 0.359375 +vt 0.562500 0.625000 +vt 0.019531 0.796875 +vt 0.277344 0.109375 +vt 0.277344 0.640625 +vt 0.027344 0.640625 +vt 0.019531 0.507812 +vt 0.019531 0.523438 +vt 0.277344 0.375000 +vt 0.019531 0.359375 +vt 0.277344 0.218750 +vt 0.234375 0.484375 +vt 0.085938 0.484375 +vt 0.234375 0.640625 +vt 0.234375 0.109375 +vt 0.234375 0.375000 +vt 0.085938 0.375000 +vt 0.234375 0.218750 +vt 0.484375 0.390625 +vt 0.734375 0.500000 +vt 0.046875 0.992188 +vt 0.625000 0.625000 +vt 0.281250 0.640625 +vt 0.046875 0.976562 +vt 0.058594 0.980469 +vt 0.109375 0.976562 +vt 0.097656 0.980469 +vt 0.109375 0.992188 +vt 0.097656 0.972656 +vt 0.109375 1.000000 +vt 0.109375 0.984375 +vt 0.101562 0.976562 +vt 0.093750 0.984375 +vt 0.101562 1.000000 +vt 0.093750 0.992188 +vt 0.093750 0.968750 +vt 0.101562 0.992188 +vt 0.101562 0.984375 +vt 0.054688 0.984375 +vt 0.054688 0.992188 +vt 0.054688 1.000000 +vt 0.062500 0.992188 +vt 0.062500 0.968750 +vt 0.054688 0.976562 +vt 0.062500 0.984375 +vt 0.062500 0.972656 +vt 0.062500 0.980469 +vt 0.093750 0.972656 +vt 0.093750 0.980469 +s 0 +f 39/72/7 53/103/7 37/64/7 +f 38/69/8 55/105/8 40/75/8 +f 36/63/7 37/66/7 33/58/7 +f 44/84/8 47/90/8 48/93/8 +f 40/74/9 55/105/9 44/83/9 +f 34/59/9 44/83/9 55/105/9 +f 39/70/9 44/83/9 34/59/9 +f 53/103/10 43/80/10 37/65/10 +f 32/56/10 43/80/10 53/103/10 +f 38/68/10 43/80/10 32/56/10 +f 36/63/9 44/84/9 39/71/9 +f 42/79/11 33/58/11 46/89/11 +f 33/58/10 43/82/10 46/89/10 +f 46/89/8 47/91/8 42/79/8 +f 40/75/11 43/81/11 38/69/11 +f 41/77/8 43/82/8 45/86/8 +f 47/92/10 52/101/10 48/94/10 +f 52/100/8 49/95/8 50/96/8 +f 45/88/9 49/95/9 41/78/9 +f 48/94/11 50/98/11 45/87/11 +f 41/78/12 51/99/12 47/92/12 +f 63/120/12 61/116/12 64/121/12 +f 60/114/7 61/115/7 57/109/7 +f 58/111/9 64/121/9 60/114/9 +f 59/113/8 63/120/8 58/111/8 +f 71/131/9 57/110/9 59/112/9 +f 67/125/12 65/122/12 68/128/12 +f 31/55/10 66/123/10 54/104/10 +f 68/127/7 31/55/7 56/107/7 +f 66/123/8 35/61/8 54/104/8 +f 70/130/10 35/62/10 56/108/10 +f 70/130/12 71/131/12 69/129/12 +f 68/128/8 72/132/8 70/130/8 +f 62/118/12 68/128/12 61/116/12 +f 69/129/8 62/119/8 71/131/8 +f 34/60/12 32/57/12 53/102/12 +f 39/72/7 34/59/7 53/103/7 +f 38/69/8 32/56/8 55/105/8 +f 36/63/7 39/73/7 37/66/7 +f 44/84/8 42/79/8 47/90/8 +f 36/63/9 42/79/9 44/84/9 +f 42/79/11 36/63/11 33/58/11 +f 33/58/10 37/67/10 43/82/10 +f 46/89/8 41/76/8 47/91/8 +f 40/75/11 44/85/11 43/81/11 +f 41/77/8 46/89/8 43/82/8 +f 47/92/10 51/99/10 52/101/10 +f 52/100/8 51/99/8 49/95/8 +f 45/88/9 50/97/9 49/95/9 +f 48/94/11 52/101/11 50/98/11 +f 41/78/12 49/95/12 51/99/12 +f 63/120/12 62/118/12 61/116/12 +f 60/114/7 64/121/7 61/115/7 +f 58/111/9 63/120/9 64/121/9 +f 59/113/8 62/117/8 63/120/8 +f 71/131/9 72/132/9 57/110/9 +f 67/125/12 66/123/12 65/122/12 +f 31/55/10 65/122/10 66/123/10 +f 68/127/7 65/122/7 31/55/7 +f 66/123/8 67/124/8 35/61/8 +f 70/130/10 69/129/10 35/62/10 +f 70/130/12 72/132/12 71/131/12 +f 68/128/8 61/116/8 72/132/8 +f 62/118/12 67/125/12 68/128/12 +f 69/129/8 67/126/8 62/119/8 +f 34/60/12 55/106/12 32/57/12 +l 38 37 +l 40 39 +o UpperDrawer +v -0.078125 0.640625 0.250000 +v -0.250000 0.937500 0.250000 +v -0.250000 0.531250 -0.437500 +v 0.250000 0.531250 0.250000 +v -0.046875 0.671875 0.250000 +v 0.250000 0.531250 -0.437500 +v -0.250000 0.531250 0.187500 +v -0.250000 0.937500 0.187500 +v 0.250000 0.531250 0.187500 +v 0.250000 0.937500 0.187500 +v -0.218750 0.734375 -0.406250 +v 0.250000 0.734375 -0.437500 +v -0.250000 0.734375 0.187500 +v 0.250000 0.734375 0.187500 +v -0.218750 0.734375 0.187500 +v -0.250000 0.734375 -0.437500 +v 0.218750 0.734375 -0.406250 +v 0.218750 0.734375 0.187500 +v -0.218750 0.562500 -0.406250 +v -0.218750 0.562500 0.187500 +v 0.218750 0.562500 -0.406250 +v 0.218750 0.562500 0.187500 +v -0.250000 0.531250 0.250000 +v -0.078125 0.671875 0.250000 +v 0.250000 0.937500 0.250000 +v -0.046875 0.640625 0.250000 +v 0.046875 0.640625 0.250000 +v 0.078125 0.671875 0.250000 +v 0.046875 0.671875 0.250000 +v 0.078125 0.640625 0.250000 +v 0.046875 0.640625 0.281250 +v 0.046875 0.671875 0.281250 +v 0.078125 0.671875 0.281250 +v 0.078125 0.640625 0.281250 +v -0.078125 0.640625 0.281250 +v -0.078125 0.671875 0.281250 +v -0.046875 0.671875 0.281250 +v -0.046875 0.640625 0.281250 +v -0.046875 0.671875 0.265625 +v -0.046875 0.640625 0.265625 +v 0.046875 0.671875 0.265625 +v 0.046875 0.640625 0.265625 +vn -0.0000 -1.0000 -0.0000 +vn -0.0000 1.0000 -0.0000 +vn 1.0000 -0.0000 -0.0000 +vn -1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 -1.0000 +vn -0.0000 -0.0000 1.0000 +vt 0.046875 0.984375 +vt 0.625000 0.500000 +vt 0.281250 0.140625 +vt 0.078125 0.640625 +vt 0.734375 0.625000 +vt 0.484375 0.390625 +vt 0.046875 1.000000 +vt 0.058594 0.972656 +vt 0.078125 0.515625 +vt 0.750000 0.500000 +vt 0.734375 0.484375 +vt 0.234375 0.640625 +vt 0.078125 0.796875 +vt 0.625000 0.484375 +vt 0.609375 0.500000 +vt 0.734375 0.640625 +vt 0.078125 0.359375 +vt 0.750000 0.625000 +vt 0.234375 0.515625 +vt 0.625000 0.640625 +vt 0.609375 0.625000 +vt 0.019531 0.632812 +vt 0.019531 0.648438 +vt 0.277344 0.484375 +vt 0.027344 0.515625 +vt 0.679688 0.484375 +vt 0.562500 0.500000 +vt 0.027344 0.796875 +vt 0.679688 0.640625 +vt 0.027344 0.359375 +vt 0.562500 0.625000 +vt 0.019531 0.796875 +vt 0.277344 0.109375 +vt 0.277344 0.640625 +vt 0.027344 0.640625 +vt 0.019531 0.507812 +vt 0.019531 0.523438 +vt 0.277344 0.375000 +vt 0.019531 0.359375 +vt 0.277344 0.218750 +vt 0.234375 0.484375 +vt 0.085938 0.484375 +vt 0.234375 0.640625 +vt 0.234375 0.109375 +vt 0.234375 0.375000 +vt 0.085938 0.375000 +vt 0.234375 0.218750 +vt 0.484375 0.140625 +vt 0.734375 0.500000 +vt 0.046875 0.992188 +vt 0.625000 0.625000 +vt 0.281250 0.390625 +vt 0.046875 0.976562 +vt 0.058594 0.980469 +vt 0.109375 0.976562 +vt 0.097656 0.980469 +vt 0.109375 0.992188 +vt 0.097656 0.972656 +vt 0.109375 1.000000 +vt 0.109375 0.984375 +vt 0.101562 0.976562 +vt 0.093750 0.984375 +vt 0.101562 1.000000 +vt 0.093750 0.992188 +vt 0.093750 0.968750 +vt 0.101562 0.992188 +vt 0.101562 0.984375 +vt 0.054688 0.984375 +vt 0.054688 0.992188 +vt 0.054688 1.000000 +vt 0.062500 0.992188 +vt 0.062500 0.968750 +vt 0.054688 0.976562 +vt 0.062500 0.984375 +vt 0.062500 0.972656 +vt 0.062500 0.980469 +vt 0.093750 0.972656 +vt 0.093750 0.980469 +s 0 +f 81/150/13 95/181/13 79/142/13 +f 80/147/14 97/183/14 82/153/14 +f 78/141/13 79/144/13 75/136/13 +f 86/162/14 89/168/14 90/171/14 +f 82/152/15 97/183/15 86/161/15 +f 76/137/15 86/161/15 97/183/15 +f 81/148/15 86/161/15 76/137/15 +f 95/181/16 85/158/16 79/143/16 +f 74/134/16 85/158/16 95/181/16 +f 80/146/16 85/158/16 74/134/16 +f 78/141/15 86/162/15 81/149/15 +f 84/157/17 75/136/17 88/167/17 +f 75/136/16 85/160/16 88/167/16 +f 88/167/14 89/169/14 84/157/14 +f 82/153/17 85/159/17 80/147/17 +f 83/155/14 85/160/14 87/164/14 +f 89/170/16 94/179/16 90/172/16 +f 94/178/14 91/173/14 92/174/14 +f 87/166/15 91/173/15 83/156/15 +f 90/172/17 92/176/17 87/165/17 +f 83/156/18 93/177/18 89/170/18 +f 105/198/18 103/194/18 106/199/18 +f 102/192/13 103/193/13 99/187/13 +f 100/189/15 106/199/15 102/192/15 +f 101/191/14 105/198/14 100/189/14 +f 113/209/15 99/188/15 101/190/15 +f 109/203/18 107/200/18 110/206/18 +f 73/133/16 108/201/16 96/182/16 +f 110/205/13 73/133/13 98/185/13 +f 108/201/14 77/139/14 96/182/14 +f 112/208/16 77/140/16 98/186/16 +f 112/208/18 113/209/18 111/207/18 +f 110/206/14 114/210/14 112/208/14 +f 104/196/18 110/206/18 103/194/18 +f 111/207/14 104/197/14 113/209/14 +f 76/138/18 74/135/18 95/180/18 +f 81/150/13 76/137/13 95/181/13 +f 80/147/14 74/134/14 97/183/14 +f 78/141/13 81/151/13 79/144/13 +f 86/162/14 84/157/14 89/168/14 +f 78/141/15 84/157/15 86/162/15 +f 84/157/17 78/141/17 75/136/17 +f 75/136/16 79/145/16 85/160/16 +f 88/167/14 83/154/14 89/169/14 +f 82/153/17 86/163/17 85/159/17 +f 83/155/14 88/167/14 85/160/14 +f 89/170/16 93/177/16 94/179/16 +f 94/178/14 93/177/14 91/173/14 +f 87/166/15 92/175/15 91/173/15 +f 90/172/17 94/179/17 92/176/17 +f 83/156/18 91/173/18 93/177/18 +f 105/198/18 104/196/18 103/194/18 +f 102/192/13 106/199/13 103/193/13 +f 100/189/15 105/198/15 106/199/15 +f 101/191/14 104/195/14 105/198/14 +f 113/209/15 114/210/15 99/188/15 +f 109/203/18 108/201/18 107/200/18 +f 73/133/16 107/200/16 108/201/16 +f 110/205/13 107/200/13 73/133/13 +f 108/201/14 109/202/14 77/139/14 +f 112/208/16 111/207/16 77/140/16 +f 112/208/18 114/210/18 113/209/18 +f 110/206/14 103/194/14 114/210/14 +f 104/196/18 109/203/18 110/206/18 +f 111/207/14 109/204/14 104/197/14 +f 76/138/18 97/184/18 74/135/18 diff --git a/src/main/resources/assets/hbm/textures/blocks/deco_computer_0.png b/src/main/resources/assets/hbm/textures/blocks/deco_computer.png similarity index 100% rename from src/main/resources/assets/hbm/textures/blocks/deco_computer_0.png rename to src/main/resources/assets/hbm/textures/blocks/deco_computer.png diff --git a/src/main/resources/assets/hbm/textures/gui/storage/gui_file_cabinet.png b/src/main/resources/assets/hbm/textures/gui/storage/gui_file_cabinet.png new file mode 100644 index 0000000000000000000000000000000000000000..0674a13e3c918855dee07fc29dd8bb920b1d658e GIT binary patch literal 850 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911MRQ8&P5D>38$lZxy-8q?;Kn_c~qpu?a z!^VE@KZ&eBzG#3?h%1o3apT7H>C;0)Lp3!uGcz-RBHCFm?*l3Jk|4j}|6sr%<<0B{ z6yhxKh%9Dc;5!V$jK}j=q%bfrZT56=45^5Fd+T7{Z37Y3K+C?b|L4!Kn%C8^JF(@v zz{c{lVrD&-rw3dE4&C0D|9Z>y?Qd`A&Xr=>Hnr~mZTGzg%nuyby8HeqlRv|}eGW_< z3JmXKr!jzN|9AyPmK{t7UjJ8B{dnZ19@7D_FDK8Hi8h@7F83zmRZ48b@#yWv>P#F5 zl+%SB7#J(wZ(xv$iVdB@WubUA0D`6m%K}fY}j;-<;QooH#Ihe+qxP4 z#9>$_(C}T)n}M;8=RmHTt4-mqZiWr4y4C7G=G_5S}{9x@Ax|Z`nc}tx>BMa0xAiZ3F0?Z;Z6-a!zmkM$)g!AR@laRS4%xi#Q1#;h4 z@rK>k10Vm@gJ@lUHt@0h7El;NG{E8ptlQy!Zr)W-;{#Hh3Jzum_A)2jpLafX8Cyf` zPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!T%Z3eueF|iC$LN8-h1zDf*`Qv9Oia zkmtFTRb^okTU9PCNmE;wl_gPPRyP*Mv86g!TVq+?wRO{2pwEo6s%ndMZoO`-nk_8i z^J=BiF?SPKeS@G&|QHP zk8LI3Wlvj7=C-T~>yL)ECxZcKpn2AsA!PCwDoahes0+9Bq@LS_)y&S;6MLdMXP+;h zwLN{WnpzVvRbxwm!+}>6^>TldR)TI~v(?hhms1U1Sb+f75d~J!`y^$AGO97{_38ic(Kz1i%3-ZX;kw95hRs;&K{rO*z zWU|0yK9!Pd+mjdURufw^1wkNtMV1D#j$SCw3rT|5!gZ+F&HVdD#sYF804|g>0igG0 zp<`}yS$`Qe8dsxg;j>ae%qBKnETm}SR*n-XsgO-Fd54Zv$3o|qON}YFFXirdR}%-e zP-rfj%H~?&Z0w56TjTW|C3SliEmSs^KYXgLq*1qH+h#b++Re{dxxKxO9ECYD8 z!bbnsow^Ro6Es@1a1fzZu54Y_a`{4_)GVa+27v}?779&>Fv~Mba(RW^-_MJi8ihzL zA|+<{z7+tAV&((nS>}_3LO7R&GLcoJ&yC0?!H%*xLJ&k+ER3+mWiF9QFBAqKI0CD2 zMT0l!Q;11L?SbwmQz4yhj%zsx@WEOcAY^>q*dLCx9x<~7Fz}8>X()>1QToki*Rr+( zU{$RwSWD?#tgd+P1VXzCtRHm6+KPY8Bqy<0ITyE==W1eEM$8@QzDp%(5?!PGF7aF~ zYXV%Nk?5hJYxB93!h-sqiRcK!m8=^o?M0fjQVI=~YPrEdm-30uRjMmUgBXhy zYy|-1L$OgzL@bKESnfZ{2G)x+>xH=`igPBHe^??An2`m`F~k|qojMnIp_D|~SU~X3 zi$%8P65t}OTFS!*u`CHtShkY&sTpD^yh1^Nfu&dS49-#4;E@zXq(8>MP2idB01%>$ z1|!XMRf&ZfG?A73koCH8ZvCihy{KcEz<~tgb*v(YlIFQn%ckz?k$&HhCE>s#VF9?H z7C{0eK%occSQbo&DNoT$)q^$C=QrC1{Xh92+9ZG3P&7o5s_k4iJP#k~(aiPV} zl()yK3#KZ&ct5X#YZ?>|_Sxm0J+s)=n1#=CcCxE#Qgas5{bH%*0g9tqVdSMgGwYpc z?ex3uZpyOoiKml^>gJJkI=L*}UQEo=l;r*!)l(Z|xad^*b)w0ZV)6M(Wvf_wBIODd z94Jtz^24=>TUg%RT=P)E?nFHwW25v2gEsxig=JNK->s&$tEzIY0%_wJTnkBJed3$( zPh>;uhh57Xk!Ka!PG?}LylirQ*QP48Dj9<{u7qzPLjjn304JA1W+4#bRQ0y`b5ou#Q>PkvX(x>8E^sLaeA(<1yZSbE8WZOOSyYV)1`_pR%paor1j@EpU-u* zct)YioXbL_ty%%F9e}ZFY+`p-$i=2p&#SZf%#|;S!Y709R+@z-1JWY}=Bfhmn5Am& zm_kEYY^?aA+GjzOG6+_~_I_y5#4*Jamd6{~I)Pb;ae0f(i$CB2SQfGZgq9fbkhOny z58!^ibcOdFlZE&~Yo_z0T%Krs)C;6yz$T>i=7uAr9e}4VoRu33C8ab-g2fHRs3?uZ zx~UYCl4AIsRbZX*Y-V}4Yf+}^PnQB*rf!YJut+S1^3((^ucK_+i*MR)EYCH*FecNA z@Hjlo(-dfEKFEJ#zQlvqAS0X)>uGxSP*^zgdcA|E&y(YHfJ0lzP`c}&Wig{auJ3mNC7#r6H z1nvU>eyg>xLa|&^3d;%*;D(qefjQP*{Xw{ttHe913V{6=Kr$vE@Q(5T>R?Ie5%M(m z0tw|)t>42*=K;w}Vl>y`0PN9jlET!#(^%B9Gy%e*Iz4rKdt>$4a#?-%GE@ozLMg=; zayf50^gFdT%78u!U|DR>LMd-i#FdfKfaI2uva5?_F>X)1>mL1t^7_f+8ogi@&UgahXtvYT%I-ewqP)?Fti-n1L8 zJ?SZMrWk?{OOXba0#W*FQVWxe_x7yTTKCk$vk@{E*^!>k>cBQxkO=}=-TgqQ3qUj@ z9!E*fPDDfW6kzfIy*oI*Bz+U0&IkH-!N;eKC8T`Gmx!7%ox{JbNk^8d7T8ILcDysP zL{4@r>)S7#I{n2rT@?3#M)ASo7#xdIDpEC31W``1o{?gIB7%g(u*`-WLAEO%Ajfv{ z+|N_ocns@RXmJZ2h@-A|R>L-#U%LTj-@5>+l2`c3bfJ@#_ys^WTHsZH#T={|vdm;a zA?6v1xS!*h`rOr;4wDuD9iYv(Ubok#J}J&%ob2?wwx=*iRd%vih>QgT3ZGNu^j_Mr z*?8*PT|?z!O5uvu76r9bT3r-&C3FuV&^k3$C2X$L3b?2xFsbsm)_;>R@Ca{>bpR@3 zGdD+Hea9&5sr1fd@u9D0ByL)ly1oSRgT(>x^q>jc0#dvr-X$^V4n|hG@a98SD`ojw z@9f7-CsWl2`#ZE6s;An2q~hj8e9U&@zV`xvG0;Kj+ma)D25kz1BO*0SDA~sLhRkGg ztgl?gcbcoNlp4leANN??vlnMO_M&8DBmFi?d)C)AX(RTKzFjp|LD|@`-q7>?Vd4gP z^_ySSjMT8?bzs9Lx9h&4nLJT1C=9fj7B zr*_Z#elPgNpMO&`n~MWFiDwwNVybG7JwP^V@ov_Nr_q5cqO_`(h(|%E1>mNi5ebU0 zhO$_$e*WZ3PI{ZWV4E67l~=I$#?C9m%z|LuM<-8MXQ}>Q#QA9TjGYas@7uT}KJf~Y z7F*YWZe$;TU86z7Tphdb4?g-O0KD~%H#Y15;PyM$oUnKP*6$n$(y6!J(Trz%cIN&+ zJ@A@0{p4$#KmMct*?qoLZvE+3w@rB(rxvLME~GFq&ek+315)ECRT38>6^~UR+w1py zQ%^=)vat#9oSUg7m+OG+t-&7r9>>om^IzwA;Mf# zpoa<1D-IGu(gDDwQMjv|PpV@_)ww{wP33a^Ue~()fxF>gAac?5w8PZafWy6>Nj!=n zvbGLrnVU%cB($bz! zhBva;c$nnk6V`H=;LQgKS;EiOLW%7r+&>YUQUs9#Go?KW+Ag~)c!baOn`bw4liK6c{w$X=P>VAqKL;0#jT<%Hio;|Tnk{f9$@^&B+LM%q1v%L@kg z)t9Q^*kZz@Fg=cog19*w9<>hKlC5vjB4L73-L&hA1u*Dode(bYBHGbjwaDpN=>7xV{MAN$t_U5TEm#D6QF zu_udj_P2YVvWMqS*i&mYRPp5()|1lg_%a5>dzkR#Cr&mVczL0rJ4o2s^1FGm%2qN9 zo~XEa+poPhc*nc%4eol^`+~cF<4o|Y%D1Q9|NHv<+riuQ+b_T8cZ0Xx^B#qL`%r|v zK3uk?J-svzprAz5&Fou8Hz)wwO_U8iw#;!EkrAjuTaP=O;Sq|o!z4-$4goqt&sR6y z{;Fo6j6G02-K!(J?*o6<=CS9IAO6|zZ;l75#8irYQkLBfOV$0Q{lqJNY(Ip=7t^Qh z@pDgj$N4S&ueIF^=k3YadGEzP^x+4ecbfe>}XhDeiQ1yMm{+fPCl@Z9#J;lF2 zgb<26g~jzLL@G8IWF6cZ?%(YG001Q@WAN?4&;O%+N_=o(E#Op59tCj#C{Z(|KNg9L z6qLO{k&1|C{pit#M%MG5!0!u)l{47Pg|5vsqNV!t3~&<;)m5 z)=@YO16tLN-W6WrimuM(x^L9&GxZf02Vm5pG*JN)DbJJg6cTJx(Gc;+M(kM8zWNhb zfrB@&u?V>oisdkFH#k#~UROE3&(j$x+w;$|xZ2Z^fKVl1JDJ*K%|^F)6vP3bkMAqK z6|BC2NXJI&N*m1nS)>Aq2N@k%o7|7${E-ty6Z-*_ti437rQA9ZdxrdlmU{V2W~cad}u8K2Hhz)e;AQjf9R;%P{ZB((3l4Xdhd-C&Io%NuPeXVA%Fi`T zDXS@2HX^~_yzj$bR(iVS_SZB!QP=uPg`ZwLZRc$6kH-A@y9~@@De^(2&wMA0askZF zPNvTv{J;ZOJPmHOfZOi4x#>45phR$=p8uBskPon-De*^L8l7supuA@Vy%FpB%-`lMm1zi*QtnXU5=TI`0)PT1rjOvs z%f7-&|E{5qE=G5E{f)sVdrMW9C;X8%UZ6{x8 zFN?3W6H(7w?V})D0f1Xm9nv#Of>9 z-p-oH`bxb=LAK-og@6j9cAH!}%DqvPcJ_gPf5-tjo(}E$!HewMUVNkd{WFi)W43GK zSfJ_NqafRbfD~MmORoc5a|nR{H$3|6yO4JZoo{W7}I!ZBnSc zJp!^70B&(9Ouw!^=OX{Hr~d=r_*&-xo+Z3Adx@P)kK2!a!*|&Y;f~h{JWo6dvK;_= zb@GlBZ=d6P`jdS8Gk;}&@z^Kq6QBKS`=`a{?30V9>~qz5_Y9swe_edc;&KDmm6fdk zphILwd0v<8gVcT2-v~Rl7k6!???*rT5BBg%V3ZeZ+8n;0|J9PM08kmwram@O_LarG zJ^gL4K>z*1$gh=Ld?IrMWV>}pSrn&HA_P$WA`zhY=Cgk0`9YSX)>YTYA5`-%KaPTI z2Y~7Tw$a!w_g!VI&an>!e=Ek@6#1%|V$7oe0000 Date: Mon, 26 Sep 2022 20:47:48 -0700 Subject: [PATCH 03/30] Sounds & Logic for the filing cabinet --- src/main/java/com/hbm/blocks/ModBlocks.java | 2 +- .../hbm/blocks/generic/BlockDecoModel.java | 6 +-- .../storage/TileEntityFileCabinet.java | 43 +++++++++++++------ 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index cbddf79bc..1ebb28d37 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -2792,7 +2792,7 @@ public class ModBlocks { GameRegistry.registerBlock(brick_dungeon_tile, brick_dungeon_tile.getUnlocalizedName()); GameRegistry.registerBlock(brick_dungeon_circle, brick_dungeon_circle.getUnlocalizedName()); GameRegistry.registerBlock(brick_forgotten, brick_forgotten.getUnlocalizedName()); - GameRegistry.registerBlock(deco_computer, ItemBlockMeta.class, deco_computer.getUnlocalizedName()); + GameRegistry.registerBlock(deco_computer, ItemBlockNamedMeta.class, deco_computer.getUnlocalizedName()); GameRegistry.registerBlock(filing_cabinet, filing_cabinet.getUnlocalizedName()); GameRegistry.registerBlock(tape_recorder, tape_recorder.getUnlocalizedName()); GameRegistry.registerBlock(steel_poles, steel_poles.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java b/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java index 6b836510d..dbe3af5ed 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java +++ b/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java @@ -42,7 +42,7 @@ public class BlockDecoModel extends Block { @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tabs, List list) { for(byte i = 0; i < subTypes; i++) { - list.add(new ItemStack(item, 1, i)); + list.add(new ItemStack(item, 1, i << 2)); } } @@ -88,7 +88,7 @@ public class BlockDecoModel extends Block { //Assumes meta is using the third and fourth bits. @Override - public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) { + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; int meta; @@ -102,7 +102,7 @@ public class BlockDecoModel extends Block { meta = 3; //For East(b01>b11), just set to 3 } - world.setBlockMetadataWithNotify(x, y, z, meta, 2); + world.setBlockMetadataWithNotify(x, y, z, meta | stack.getItemDamage(), 2); } //These are separate because they have to be constant diff --git a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityFileCabinet.java b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityFileCabinet.java index 958ad13de..e8fa9b73a 100644 --- a/src/main/java/com/hbm/tileentity/machine/storage/TileEntityFileCabinet.java +++ b/src/main/java/com/hbm/tileentity/machine/storage/TileEntityFileCabinet.java @@ -41,8 +41,6 @@ public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIPr @Override public void openInventory() { if(!worldObj.isRemote) this.playersUsing++; - //somehow guarentee that playersUsing is synced up when this method is called, to allow for sounds upon *actually* opening/closing? - //this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 1.0F, 1.0F); } @Override @@ -69,21 +67,40 @@ public class TileEntityFileCabinet extends TileEntityCrateBase implements IGUIPr } else { this.prevLowerExtent = lowerExtent; this.prevUpperExtent = upperExtent; - float openSpeed = 1F / 25F; - - if(this.playersUsing > 0) { - this.lowerExtent += openSpeed; + } + + float openSpeed = playersUsing > 0 ? 1F / 16F : 1F / 25F; + float maxExtent = 0.8F; + + if(this.playersUsing > 0) { + if(lowerExtent == 0F && upperExtent == 0F) + this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 0.8F, 1.0F); + else { + if(upperExtent + openSpeed >= maxExtent && lowerExtent < maxExtent) + this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.7F); - if(timer >= 10) - this.upperExtent += openSpeed; - } else { - this.lowerExtent -= openSpeed; - this.upperExtent -= openSpeed; + if(lowerExtent + openSpeed >= maxExtent && lowerExtent < maxExtent) + this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateOpen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.7F); } - this.lowerExtent = MathHelper.clamp_float(lowerExtent, 0F, 0.8F); - this.upperExtent = MathHelper.clamp_float(upperExtent, 0F, 0.8F); + this.lowerExtent += openSpeed; + + if(timer >= 10) + this.upperExtent += openSpeed; + + } else if(lowerExtent > 0) { + if(upperExtent - openSpeed < maxExtent / 2 && upperExtent >= maxExtent / 2 && upperExtent != lowerExtent) + this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateClose", 0.8F, 1.0F); + + if(lowerExtent - openSpeed < maxExtent / 2 && lowerExtent >= maxExtent / 2) + this.worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "hbm:block.crateClose", 0.8F, 1.0F); + + this.upperExtent -= openSpeed; + this.lowerExtent -= openSpeed; } + + this.lowerExtent = MathHelper.clamp_float(lowerExtent, 0F, maxExtent); + this.upperExtent = MathHelper.clamp_float(upperExtent, 0F, maxExtent); } @Override From 653ea24d861f7ba327aa106d282683378e46e452 Mon Sep 17 00:00:00 2001 From: Vaern Date: Thu, 29 Sep 2022 18:04:05 -0700 Subject: [PATCH 04/30] okay this was pretty painful ngl need a better way for doing lots of item generation mh has placed loot boolean replacement --- src/main/java/com/hbm/blocks/ModBlocks.java | 2 +- .../java/com/hbm/lib/HbmChestContents.java | 13 +++ .../world/worldgen/components/Feature.java | 25 +++- .../worldgen/components/OfficeFeatures.java | 109 +++++++++++++++++- 4 files changed, 140 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 1ebb28d37..86b105f95 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -2792,7 +2792,7 @@ public class ModBlocks { GameRegistry.registerBlock(brick_dungeon_tile, brick_dungeon_tile.getUnlocalizedName()); GameRegistry.registerBlock(brick_dungeon_circle, brick_dungeon_circle.getUnlocalizedName()); GameRegistry.registerBlock(brick_forgotten, brick_forgotten.getUnlocalizedName()); - GameRegistry.registerBlock(deco_computer, ItemBlockNamedMeta.class, deco_computer.getUnlocalizedName()); + GameRegistry.registerBlock(deco_computer, deco_computer.getUnlocalizedName()); GameRegistry.registerBlock(filing_cabinet, filing_cabinet.getUnlocalizedName()); GameRegistry.registerBlock(tape_recorder, tape_recorder.getUnlocalizedName()); GameRegistry.registerBlock(steel_poles, steel_poles.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/lib/HbmChestContents.java b/src/main/java/com/hbm/lib/HbmChestContents.java index 17cbe32fe..aa7df0b1a 100644 --- a/src/main/java/com/hbm/lib/HbmChestContents.java +++ b/src/main/java/com/hbm/lib/HbmChestContents.java @@ -352,9 +352,22 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.can_creature, 0, 1, 2, 2), new WeightedRandomChestContent(ModItems.can_smart, 0, 1, 3, 2), new WeightedRandomChestContent(ModItems.can_mrsugar, 0, 1, 2, 2), + new WeightedRandomChestContent(ModItems.cap_nuka, 0, 1, 16, 2), new WeightedRandomChestContent(ModItems.book_guide, 3, 1, 1, 1), new WeightedRandomChestContent(Item.getItemFromBlock(ModBlocks.deco_computer), 0, 1, 1, 1)}; + public static WeightedRandomChestContent[] filingCabinet = new WeightedRandomChestContent[] { + new WeightedRandomChestContent(Items.paper, 0, 1, 12, 240), + new WeightedRandomChestContent(Items.book, 0, 1, 3, 90), + new WeightedRandomChestContent(Items.map, 0, 1, 1, 50), + new WeightedRandomChestContent(Items.writable_book, 0, 1, 1, 30), + new WeightedRandomChestContent(ModItems.cigarette, 0, 1, 16, 20), + new WeightedRandomChestContent(ModItems.toothpicks, 0, 1, 16, 10), + new WeightedRandomChestContent(ModItems.dust, 0, 1, 1, 40), + new WeightedRandomChestContent(ModItems.dust_tiny, 0, 1, 3, 75), + new WeightedRandomChestContent(ModItems.ink, 0, 1, 1, 1), //make that mf rare; 1:555 weight + }; + /** Nowhere else to put this and this seems like the most fitting place **/ public static ItemStack genetateBook(String key) { diff --git a/src/main/java/com/hbm/world/worldgen/components/Feature.java b/src/main/java/com/hbm/world/worldgen/components/Feature.java index ceffa9eca..2042d2430 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Feature.java +++ b/src/main/java/com/hbm/world/worldgen/components/Feature.java @@ -251,11 +251,18 @@ abstract public class Feature extends StructureComponent { * @return TE implementing IInventory with randomized contents */ protected boolean generateInvContents(World world, StructureBoundingBox box, Random rand, Block block, int featureX, int featureY, int featureZ, WeightedRandomChestContent[] content, int amount) { + return generateInvContents(world, box, rand, block, 0, featureX, featureY, featureZ, content, amount); + } + + protected boolean generateInvContents(World world, StructureBoundingBox box, Random rand, Block block, int meta, int featureX, int featureY, int featureZ, WeightedRandomChestContent[] content, int amount) { int posX = this.getXWithOffset(featureX, featureZ); int posY = this.getYWithOffset(featureY); int posZ = this.getZWithOffset(featureX, featureZ); - this.placeBlockAtCurrentPosition(world, block, 0, featureX, featureY, featureZ, box); + if(world.getBlock(posX, posY, posZ) == block) //replacement for hasPlacedLoot checks + return false; + + this.placeBlockAtCurrentPosition(world, block, meta, featureX, featureY, featureZ, box); IInventory inventory = (IInventory)world.getTileEntity(posX, posY, posZ); if(inventory != null) { @@ -274,22 +281,30 @@ abstract public class Feature extends StructureComponent { */ protected boolean generateLockableContents(World world, StructureBoundingBox box, Random rand, Block block, int featureX, int featureY, int featureZ, WeightedRandomChestContent[] content, int amount, double mod) { + return generateLockableContents(world, box, rand, block, 0, featureX, featureY, featureZ, content, amount, mod); + } + + protected boolean generateLockableContents(World world, StructureBoundingBox box, Random rand, Block block, int meta, int featureX, int featureY, int featureZ, + WeightedRandomChestContent[] content, int amount, double mod) { int posX = this.getXWithOffset(featureX, featureZ); int posY = this.getYWithOffset(featureY); int posZ = this.getZWithOffset(featureX, featureZ); - this.placeBlockAtCurrentPosition(world, block, 0, featureX, featureY, featureZ, box); + if(world.getBlock(posX, posY, posZ) == block) //replacement for hasPlacedLoot checks + return false; + + this.placeBlockAtCurrentPosition(world, block, meta, featureX, featureY, featureZ, box); TileEntity tile = world.getTileEntity(posX, posY, posZ); TileEntityLockableBase lock = (TileEntityLockableBase) tile; IInventory inventory = (IInventory) tile; if(inventory != null && lock != null) { + amount = (int)Math.floor(amount * StructureConfig.lootAmountFactor); + WeightedRandomChestContent.generateChestContents(rand, content, inventory, amount < 1 ? 1 : amount); + lock.setPins(rand.nextInt(999) + 1); lock.setMod(mod); lock.lock(); - - amount = (int)Math.floor(amount * StructureConfig.lootAmountFactor); - WeightedRandomChestContent.generateChestContents(rand, content, inventory, amount < 1 ? 1 : amount); return true; } diff --git a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java index b0244cf84..36b72aa33 100644 --- a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java @@ -4,6 +4,7 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; import com.hbm.lib.HbmChestContents; +import com.hbm.util.LootGenerator; import com.hbm.world.worldgen.components.Feature.ConcreteBricks; import net.minecraft.init.Blocks; @@ -45,9 +46,6 @@ public class OfficeFeatures { } //Holy shit I despise this method so goddamn much - //TODO BOB: please i beg you make some sort of utility tool to simplify this - //ideally we'd invent something like the structure blocks or even a more advanced - //schematic to java tool @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { @@ -222,6 +220,8 @@ public class OfficeFeatures { private static ConcreteBricks ConcreteBricks = new ConcreteBricks(); + //no placed loot? it's because i would've had to do fucking 12 of them and i don't have an easy standardized system for that + public LargeOfficeCorner() { super(); } @@ -435,6 +435,109 @@ public class OfficeFeatures { placeDoor(world, box, ModBlocks.door_office, 1, 3, 9, 10); placeDoor(world, box, ModBlocks.door_metal, 0, 5, 13, 3); //Furniture + //Floor 1 + int NorthStairMeta = getStairMeta(2); + int SouthStairMeta = getStairMeta(3); + int NorthStairMetaUD = NorthStairMeta | 4; + int SouthStairMetaUD = SouthStairMeta | 4; + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 2, 1, 5, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, SouthStairMeta, 2, 1, 7, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 2, 1, 8, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, NorthStairMeta, 2, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 8, 1, 4, box); + fillWithMetadataBlocks(world, box, 8, 1, 5, 8, 1, 7, Blocks.wooden_slab, 13); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 8, 1, 8, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 9, 1, 8, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 9, 1, 5, box); + placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 9, 1, 4, box); + placeBlockAtCurrentPosition(world, Blocks.flower_pot, 10, 8, 2, 7, box); + + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 6, 1, 12, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, NorthStairMeta, 7, 1, 12, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 8, 1, 12, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 10, 1, 11, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 10, 1, 12, box); + placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 10, 2, 11, box); + //Floor 2 + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 4, 5, 4, box); + placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 13, 3, 5, 4, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 2, 5, 4, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, NorthStairMeta, 3, 5, 5, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(1), 3, 6, 4, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 3, 5, 7, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 4, 5, 7, box); + placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 13, 4, 5, 8, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 4, 5, 9, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 2, 5, 9, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 10, 5, 4, box); + placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 13, 10, 5, 5, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 10, 5, 6, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, NorthStairMeta, 8, 5, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(2), 10, 6, 6, box); + + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 8, 5, 11, box); + placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 13, 8, 5, 10, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 8, 5, 9, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 9, 5, 9, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 10, 5, 9, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, WestStairMeta, 10, 5, 10, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(1), 9, 6, 9, box); + + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 1, 5, 13, box); + placeBlockAtCurrentPosition(world, Blocks.wooden_slab, 13, 1, 5, 12, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 1, 5, 11, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, NorthStairMeta, 3, 5, 13, box); + placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 1, 6, 12, box); + placeBlockAtCurrentPosition(world, ModBlocks.machine_microwave, getDecoMeta(5), 1, 6, 11, box); + //Floor 3 + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 8, 9, 4, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 7, 9, 4, box); + placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 9, 9, 4, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 5, 9, 5, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 5, 9, 6, box); + fillWithMetadataBlocks(world, box, 3, 9, 6, 4, 9, 6, Blocks.wooden_slab, 13); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 2, 9, 6, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, SouthStairMeta, 3, 9, 5, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(0), 3, 10, 6, box); + + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 9, 9, 10, box); + fillWithMetadataBlocks(world, box, 7, 9, 10, 8, 9, 10, Blocks.wooden_slab, 13); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, SouthStairMetaUD, 6, 9, 10, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 5, 9, 10, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 5, 9, 11, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, NorthStairMetaUD, 5, 9, 12, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, NorthStairMeta, 8, 9, 11, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, EastStairMeta, 7, 9, 8, box); + placeBlockAtCurrentPosition(world, Blocks.oak_stairs, SouthStairMeta, 9, 9, 8, box); + placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 6, 10, 10, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(1), 7, 10, 10, box); + placeBlockAtCurrentPosition(world, ModBlocks.tape_recorder, getDecoMeta(5), 6, 9, 11, box); + placeRandomBobble(world, box, rand, 5, 10, 11); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, WestStairMetaUD, 2, 9, 11, box); + placeBlockAtCurrentPosition(world, Blocks.dark_oak_stairs, EastStairMetaUD, 1, 9, 11, box); + placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 2, 10, 11, box); + + //Roof + placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 5, 13, 9, box); + placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 7, 13, 11, box); + + //almost certainly a fucking astronomically better way to do this + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(3), 9, 1, 7, HbmChestContents.filingCabinet, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(1), 7, 5, 4, HbmChestContents.filingCabinet, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(1), 7, 6, 4, HbmChestContents.filingCabinet, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(2), 10, 5, 7, HbmChestContents.filingCabinet, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 10, 5, 12, HbmChestContents.filingCabinet, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 10, 6, 12, HbmChestContents.filingCabinet, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 2, 9, 5, HbmChestContents.filingCabinet, 4); + generateLockableContents(world, box, rand, ModBlocks.safe, getDecoMeta(2), 1, 9, 13, HbmChestContents.officeTrash, 10, 1.0D); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 2, 9, 13, HbmChestContents.filingCabinet, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 3, 9, 13, HbmChestContents.filingCabinet, 4); + generateLockableContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 3, 10, 13, HbmChestContents.expensive, 8, 0.1D); + + placeBlockAtCurrentPosition(world, ModBlocks.deco_loot, 0, 6, 13, 11, box); + LootGenerator.lootCapStash(world, this.getXWithOffset(6, 11), this.getYWithOffset(13), this.getZWithOffset(6, 11)); + + //this hurt my soul return false; } From d36626b8139f5e8e090c3019aa53cb1ff6186253 Mon Sep 17 00:00:00 2001 From: Vaern Date: Fri, 30 Sep 2022 22:48:48 -0700 Subject: [PATCH 05/30] MapGenBunker --- .../com/hbm/world/worldgen/MapGenBunker.java | 40 +++++++++++++++++++ .../hbm/world/worldgen/MapGenNTMFeatures.java | 6 +-- .../worldgen/components/BunkerComponents.java | 37 +++++++++++++++++ .../world/worldgen/components/Feature.java | 4 ++ .../worldgen/components/OfficeFeatures.java | 2 +- 5 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/hbm/world/worldgen/MapGenBunker.java create mode 100644 src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java diff --git a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java new file mode 100644 index 000000000..e72ef51ea --- /dev/null +++ b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java @@ -0,0 +1,40 @@ +package com.hbm.world.worldgen; + +import java.util.Random; + +import net.minecraft.world.World; +import net.minecraft.world.gen.structure.MapGenStructure; +import net.minecraft.world.gen.structure.StructureStart; + +public class MapGenBunker extends MapGenStructure { + + /** String ID for this MapGen */ + @Override + public String func_143025_a() { + return "NTMBunker"; + } + + @Override + protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) { + return false; + } + + @Override + protected StructureStart getStructureStart(int chunkX, int chunkZ) { + return new Start(this.worldObj, this.rand, chunkX, chunkZ); + } + + public static class Start extends StructureStart { + + public Start() { } + + public Start(World world, Random rand, int chunkX, int chunkZ) { + super(chunkX, chunkZ); + + + this.updateBoundingBox(); + this.markAvailableHeight(world, rand, 10); + } + + } +} diff --git a/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java b/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java index 5e6b70789..e23fed89e 100644 --- a/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java @@ -145,7 +145,7 @@ public class MapGenNTMFeatures extends MapGenStructure { MilitaryBaseFeatures.smallHelipad(components, chunkX, posY, chunkZ, rand); //agggggggg } else { //Everything else - switch(rand.nextInt(4)) { + switch(rand.nextInt(3)) { case 0: NTMLab2 lab2 = new NTMLab2(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); this.components.add(lab2); break; @@ -155,9 +155,9 @@ public class MapGenNTMFeatures extends MapGenStructure { case 2: LargeOffice office = new LargeOffice(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); this.components.add(office); break; - case 3: + /*case 3: LargeOfficeCorner officeCorner = new LargeOfficeCorner(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); - this.components.add(officeCorner); break; + this.components.add(officeCorner); break;*/ } } diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java new file mode 100644 index 000000000..91b2a93d2 --- /dev/null +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -0,0 +1,37 @@ +package com.hbm.world.worldgen.components; + +import java.util.List; +import java.util.Random; + +import net.minecraft.world.gen.structure.StructureComponent; + +public class BunkerComponents { + + + + public abstract static class Bunker extends Feature { + + public Bunker() { } + + public Bunker(int componentType) { + super(componentType); //important to carry over, as it allows for hard limits on the amount of components. increment once for each new component. + } + + /** Gets next component in any direction.
'component' refers to the initial starting component (hard distance limits), 'components' refers to the StructureStart list. */ + protected StructureComponent getNextComponentNormal(StructureComponent component, List components, Random rand, int offset, int offsetY) { + switch(this.coordBaseMode) { + case 0: + //TODO: getNextValidComponent() + case 1: + + case 2: + + case 3: + + default: + return null; + } + } + + } +} diff --git a/src/main/java/com/hbm/world/worldgen/components/Feature.java b/src/main/java/com/hbm/world/worldgen/components/Feature.java index 2042d2430..a9acc6d21 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Feature.java +++ b/src/main/java/com/hbm/world/worldgen/components/Feature.java @@ -37,6 +37,10 @@ abstract public class Feature extends StructureComponent { super(0); } + protected Feature(int componentType) { + super(componentType); + } + protected Feature(Random rand, int minX, int minY, int minZ, int maxX, int maxY, int maxZ ) { super(0); this.sizeX = maxX; diff --git a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java index 36b72aa33..fddcd5037 100644 --- a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java @@ -539,7 +539,7 @@ public class OfficeFeatures { //this hurt my soul - return false; + return false; //TODO: whoopsy! this should probably be true, with the failed ones being false! not necessary here since the structures always generate in one chunk } } From 1d37f1f78595c9e53b3c3ab1f7dbc8104ed56ee9 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sun, 2 Oct 2022 20:50:27 -0700 Subject: [PATCH 06/30] BunkerComponents stuff --- .../worldgen/components/BunkerComponents.java | 313 +++++++++++++++++- 1 file changed, 302 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index 91b2a93d2..2a8811c46 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -1,13 +1,116 @@ package com.hbm.world.worldgen.components; +import java.lang.reflect.Constructor; +import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.Random; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureComponent; public class BunkerComponents { + private static final Weight[] weightArray = new Weight[0]; + private static List componentWeightList; + static int totalWeight; + + public static void prepareComponents() { + componentWeightList = new ArrayList(); + + for(int i = 0; i < weightArray.length; i++) { + weightArray[i].instancesSpawned = 0; + componentWeightList.add(weightArray[i]); + } + } + + private static Bunker getWeightedComponent(StructureComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { + + for(int i = 0; i < 5; i++) { + int value = rand.nextInt(totalWeight); + Iterator iterator = componentWeightList.iterator(); + + while(iterator.hasNext()) { + Weight weight = (Weight)iterator.next(); + value -= weight.weight; + + if(value < 0) { + if(!weight.canSpawnStructure(componentType)) + break; + + Bunker component = weight.lambda.findValidPlacement(components, rand, minX, minY, minZ, coordMode, componentType); + + if(component != null) { + weight.instancesSpawned++; + + if(!weight.canSpawnMoreStructures()) + componentWeightList.remove(weight); + + return component; + } + + } + } + } + + return null; + } + + private static StructureComponent getNextValidComponent(StructureComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { + + if(components.size() > 50) + return null; + + if(Math.abs(minX - original.getBoundingBox().minX) <= 112 && Math.abs(minZ - original.getBoundingBox().minX) <= 112) { + + StructureComponent structure = getWeightedComponent(original, components, rand, minX, minY, minZ, coordMode, componentType); + + if(structure != null) { + components.add(structure); //Adds component to structure start list + structure.buildComponent(original, components, rand); //either a) add it to a list in the original to be built or b) do it here. obviously the latter. + } + + return structure; + } + + return null; + } + + static class Weight { + + public final instantiateStructure lambda; //i refuse to use some 🤓 ass method for getting the class from each PieceWeight + //here, we overengineer shit like real developers + + public final int weight; + public int instancesSpawned; + public int instanceLimit; + + public Weight(instantiateStructure lambda, int weight, int limit) { + this.lambda = lambda; + this.weight = weight; + this.instanceLimit = limit; + } + + //Checks if another structure can be spawned based on input data + public boolean canSpawnStructure(int componentAmount) { + return this.instanceLimit == 0 || this.instanceLimit < this.instanceLimit; + } + + //Checks if another structure can be spawned at all (used to flag for removal from the list) + public boolean canSpawnMoreStructures() { + return this.instanceLimit == 0 || this.instancesSpawned < this.instanceLimit; + } + + } + + /** Returns a new instance of this structureComponent, or null if not able to be placed. */ + @FunctionalInterface + interface instantiateStructure { + Bunker findValidPlacement(List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType); + } public abstract static class Bunker extends Feature { @@ -17,21 +120,209 @@ public class BunkerComponents { super(componentType); //important to carry over, as it allows for hard limits on the amount of components. increment once for each new component. } - /** Gets next component in any direction.
'component' refers to the initial starting component (hard distance limits), 'components' refers to the StructureStart list. */ - protected StructureComponent getNextComponentNormal(StructureComponent component, List components, Random rand, int offset, int offsetY) { + /** Gets next component in the direction this component is facing.
'original' refers to the initial starting component (hard distance limits), 'components' refers to the StructureStart list. */ + protected StructureComponent getNextComponentNormal(StructureComponent original, List components, Random rand, int offset, int offsetY) { switch(this.coordBaseMode) { - case 0: - //TODO: getNextValidComponent() - case 1: - - case 2: - - case 3: - + case 0: //South + return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType()); + case 1: //West + return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, this.coordBaseMode, this.getComponentType()); + case 2: //North + return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType()); + case 3: //East + return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, this.coordBaseMode, this.getComponentType()); default: return null; } } + //Keep in mind for these methods: a given room would have its *actual entrance* opposite the side it is facing. + /** Gets next component, to the West (-X) relative to this component. */ + protected StructureComponent getNextComponentNX(StructureComponent original, List components, Random rand, int offset, int offsetY) { + switch(this.coordBaseMode) { + case 0: //South + return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 1, this.getComponentType()); + case 1: //West + return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 2, this.getComponentType()); + case 2: //North + return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 3, this.getComponentType()); + case 3: //East + return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 0, this.getComponentType()); + default: + return null; + } + } + + /** Gets next component, to the East (+X) relative to this component. */ + protected StructureComponent getNextComponentPX(StructureComponent original, List components, Random rand, int offset, int offsetY) { + switch(this.coordBaseMode) { + case 0: //South + return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 1, this.getComponentType()); + case 1: //West + return getNextValidComponent(original, components, rand, this.boundingBox.minZ + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 2, this.getComponentType()); + case 2: //North + return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 3, this.getComponentType()); + case 3: //East + return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 0, this.getComponentType()); + default: + return null; + } + } + + protected static StructureBoundingBox getComponentToAddBoundingBox(int posX, int posY, int posZ, int offsetX, int offsetY, int offsetZ, int maxX, int maxY, int maxZ, int coordMode) { + switch(coordMode) { + case 0: + return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); + case 1: + return new StructureBoundingBox(posX - maxZ + 1 - offsetZ, posY + offsetY, posZ + offsetX, posX - offsetZ, posY + maxY - 1 + offsetY, posZ + maxX - 1 + offsetX); + case 2: + return new StructureBoundingBox(posX - maxX + 1 - offsetX, posY + offsetY, posZ - maxZ + 1 - offsetZ, posX - offsetX, posY + maxY - 1 + offsetY, posZ - offsetZ); + case 3: + return new StructureBoundingBox(posX + offsetZ, posY + offsetY, posZ - maxX + 1 - offsetX, posX + maxZ - 1 + offsetZ, posY + maxY - 1 + offsetY, posZ - offsetX); + default: + return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); + } + } } -} + + public static class Atrium extends Bunker { + + public Atrium() { } + + public Atrium(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType); + this.coordBaseMode = coordBaseMode; + this.boundingBox = box; + } + + @Override + public void buildComponent(StructureComponent original, List components, Random rand) { + + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + return true; + } + } + + public static class Corridor extends Bunker { + + + + public Corridor() { } + + public Corridor(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType); + this.coordBaseMode = coordBaseMode; + this.boundingBox = box; + + } + + protected void func_143012_a(NBTTagCompound data) { + super.func_143012_a(data); + + } + + protected void func_143011_b(NBTTagCompound data) { + super.func_143011_b(data); + + } + + @Override + public void buildComponent(StructureComponent original, List components, Random rand) { + + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + + if(isLiquidInStructureBoundingBox(world, box)) { + return false; + } else { + + + return true; + } + } + + } + + public static class WideCorridor extends Corridor { + + public WideCorridor() { } + + public WideCorridor(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType, rand, box, coordBaseMode); + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + return true; + } + } + + public static class Turn extends Bunker { + + public Turn() { } + + public Turn(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType); + this.coordBaseMode = coordBaseMode; + this.boundingBox = box; + + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + return true; + } + } + + public static class WideTurn extends Turn { + + public WideTurn() { } + + public WideTurn(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType, rand, box, coordBaseMode); + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + return true; + } + } + + public static class Intersection extends Bunker { + + public Intersection() { } + + public Intersection(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType); + this.coordBaseMode = coordBaseMode; + this.boundingBox = box; + + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + return true; + } + } + + public static class WideIntersection extends Intersection { + + public WideIntersection() { } + + public WideIntersection(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType, rand, box, coordBaseMode); + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + return true; + } + } + + +} \ No newline at end of file From 27e4c1f74666b927c464459c83e5073ea160c3d0 Mon Sep 17 00:00:00 2001 From: Vaern Date: Wed, 5 Oct 2022 15:46:18 -0700 Subject: [PATCH 07/30] Corridors and Block Placement Optimization Added regular and wide corridors + optimized block placement methods in Feature class --- .../worldgen/components/BunkerComponents.java | 174 +++++++++++++- .../world/worldgen/components/Feature.java | 221 +++++++++++++++++- 2 files changed, 383 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index 2a8811c46..fb67a0d55 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -6,6 +6,8 @@ import java.util.Iterator; import java.util.List; import java.util.Random; +import com.hbm.blocks.ModBlocks; + import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -208,7 +210,8 @@ public class BunkerComponents { public static class Corridor extends Bunker { - + boolean expandsNX = false; + boolean expandsPX = false; public Corridor() { } @@ -216,22 +219,32 @@ public class BunkerComponents { super(componentType); this.coordBaseMode = coordBaseMode; this.boundingBox = box; + expandsNX = rand.nextInt(3) == 0; + expandsPX = rand.nextInt(3) == 0; } protected void func_143012_a(NBTTagCompound data) { super.func_143012_a(data); - + data.setBoolean("expandsNX", expandsNX); + data.setBoolean("expandsPX", expandsPX); } protected void func_143011_b(NBTTagCompound data) { super.func_143011_b(data); - + expandsNX = data.getBoolean("expandsNX"); + expandsPX = data.getBoolean("expandsPX"); } @Override public void buildComponent(StructureComponent original, List components, Random rand) { + getNextComponentNormal(original, components, rand, 1, 1); + if(expandsNX) + getNextComponentNX(original, components, rand, 6, 1); + + if(expandsPX) + getNextComponentPX(original, components, rand, 6, 1); } @Override @@ -240,7 +253,54 @@ public class BunkerComponents { if(isLiquidInStructureBoundingBox(world, box)) { return false; } else { + fillWithAir(world, box, 1, 1, 0, 3, 3, 14); + fillWithBlocks(world, box, 1, 0, 0, 3, 0, 14, ModBlocks.deco_titanium); + //Walls + for(int x = 0; x <= 4; x += 4) { + fillWithBlocks(world, box, x, 1, 0, x, 1, 4, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, x, 1, 10, x, 1, 14, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, x, 2, 0, x, 2, 4, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, x, 2, 10, x, 2, 14, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, x, 3, 10, x, 3, 14, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, x, 3, 0, x, 3, 4, ModBlocks.reinforced_brick); + } + + //ExpandsNX + if(expandsNX) { + fillWithBlocks(world, box, 0, 0, 6, 0, 0, 8, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 0, 1, 5, 0, 3, 5, ModBlocks.concrete_pillar); //Walls + fillWithBlocks(world, box, 0, 1, 9, 0, 3, 9, ModBlocks.concrete_pillar); + fillWithAir(world, box, 0, 1, 6, 0, 3, 8); + fillWithBlocks(world, box, 0, 4, 6, 0, 4, 8, ModBlocks.reinforced_brick); //Ceiling + } else { + fillWithBlocks(world, box, 0, 1, 5, 0, 1, 9, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 5, 0, 2, 9, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 5, 0, 3, 9, ModBlocks.reinforced_brick); + } + + //ExpandsPX + if(expandsPX) { + fillWithBlocks(world, box, 4, 0, 6, 4, 0, 8, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 4, 1, 5, 4, 3, 5, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 4, 1, 9, 4, 3, 9, ModBlocks.concrete_pillar); + fillWithAir(world, box, 4, 1, 6, 4, 3, 8); + fillWithBlocks(world, box, 4, 4, 6, 4, 4, 8, ModBlocks.reinforced_brick); + } else { + fillWithBlocks(world, box, 4, 1, 5, 4, 1, 9, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 4, 2, 5, 4, 2, 9, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 4, 3, 5, 4, 3, 9, ModBlocks.reinforced_brick); + } + + //Ceiling + fillWithBlocks(world, box, 1, 4, 0, 1, 4, 14, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 3, 4, 0, 3, 4, 14, ModBlocks.reinforced_brick); + int pillarMeta = getPillarMeta(8); + for(int i = 0; i <= 12; i += 3) { + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 2, 4, i, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 2, 4, i + 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 2, 4, i + 2, box); + } return true; } @@ -250,15 +310,121 @@ public class BunkerComponents { public static class WideCorridor extends Corridor { + boolean bulkheadNZ = false; + boolean bulkheadPZ = true; + public WideCorridor() { } public WideCorridor(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { super(componentType, rand, box, coordBaseMode); } + @Override + public void buildComponent(StructureComponent original, List components, Random rand) { + getNextComponentNormal(original, components, rand, 1, 1); + + if(expandsNX) + getNextComponentNX(original, components, rand, 7, 1); + + if(expandsPX) + getNextComponentPX(original, components, rand, 7, 1); + } + @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - return true; + + if(isLiquidInStructureBoundingBox(world, box)) { + return false; + } else { + int begin = bulkheadNZ ? 1 : 0; + int end = bulkheadPZ ? 15 : 16; + + fillWithAir(world, box, 1, 1, begin, 7, 3, end); + + //Floor + fillWithBlocks(world, box, 1, 0, begin, 1, 0, end, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 2, 0, begin, 2, 0, end, ModBlocks.tile_lab); + fillWithBlocks(world, box, 3, 0, 0, 5, 0, 14, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 6, 0, begin, 6, 0, end, ModBlocks.tile_lab); + fillWithBlocks(world, box, 7, 0, begin, 7, 0, end, ModBlocks.deco_titanium); + + int pillarMeta = getPillarMeta(8); + //Walls + if(expandsNX) { + fillWithBlocks(world, box, 0, 1, begin, 0, 1, 5, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, begin, 0, 2, 5, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, begin, 0, 3, 5, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 1, 11, 0, 1, end, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 11, 0, 2, end, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 11, 0, 3, end, ModBlocks.reinforced_brick); + + fillWithBlocks(world, box, 0, 0, 7, 0, 0, 9, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 0, 1, 6, 0, 3, 6, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 0, 1, 10, 0, 3, 10, ModBlocks.concrete_pillar); + fillWithMetadataBlocks(world, box, 0, 4, 7, 0, 4, 9, ModBlocks.concrete_pillar, pillarMeta); + fillWithAir(world, box, 0, 1, 7, 0, 3, 9); + + } else { + fillWithBlocks(world, box, 0, 1, begin, 0, 1, end, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, begin, 0, 2, end, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, begin, 0, 3, end, ModBlocks.reinforced_brick); + } + + if(expandsPX) { + fillWithBlocks(world, box, 8, 1, begin, 8, 1, 5, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 2, begin, 8, 2, 5, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 8, 3, begin, 8, 3, 5, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 1, 11, 8, 1, end, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 2, 11, 8, 2, end, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 8, 3, 11, 8, 3, end, ModBlocks.reinforced_brick); + + fillWithBlocks(world, box, 8, 0, 7, 8, 0, 9, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 8, 1, 6, 8, 3, 6, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 8, 1, 10, 8, 3, 10, ModBlocks.concrete_pillar); + fillWithMetadataBlocks(world, box, 8, 4, 7, 8, 4, 9, ModBlocks.concrete_pillar, pillarMeta); + fillWithAir(world, box, 8, 1, 7, 8, 3, 9); + + } else { + fillWithBlocks(world, box, 8, 1, begin, 8, 1, end, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 2, begin, 8, 2, end, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 8, 3, begin, 8, 3, end, ModBlocks.reinforced_brick); + } + + if(bulkheadNZ) { + fillWithBlocks(world, box, 0, 1, 0, 1, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 0, 1, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 0, 1, 3, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 5, 1, 0, 6, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 5, 2, 0, 6, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 5, 3, 0, 6, 3, 0, ModBlocks.reinforced_brick); + } + + if(bulkheadPZ) { + fillWithBlocks(world, box, 0, 1, 16, 1, 1, 16, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 16, 1, 2, 16, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 16, 1, 3, 16, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 5, 1, 16, 6, 1, 16, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 5, 2, 16, 6, 2, 16, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 5, 3, 16, 6, 3, 16, ModBlocks.reinforced_brick); + } + + //Ceiling + fillWithBlocks(world, box, 1, 4, begin, 1, 4, end, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 2, 4, begin, 2, 4, end, ModBlocks.concrete_pillar, pillarMeta); + fillWithBlocks(world, box, 3, 4, 0, 3, 4, 16, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 5, 4, 0, 5, 4, 16, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 6, 4, begin, 6, 4, end, ModBlocks.concrete_pillar, pillarMeta); + fillWithBlocks(world, box, 7, 4, begin, 7, 4, end, ModBlocks.reinforced_brick); + + for(int i = 0; i <= 12; i += 3) { + fillWithMetadataBlocks(world, box, 4, 4, i, 4, 4, i + 1, ModBlocks.concrete_pillar, pillarMeta); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 4, 4, i + 2, box); + } + + fillWithMetadataBlocks(world, box, 4, 4, 15, 4, 4, 16, ModBlocks.concrete_pillar, pillarMeta); + + return true; + } } } diff --git a/src/main/java/com/hbm/world/worldgen/components/Feature.java b/src/main/java/com/hbm/world/worldgen/components/Feature.java index a9acc6d21..080aaea42 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Feature.java +++ b/src/main/java/com/hbm/world/worldgen/components/Feature.java @@ -436,22 +436,227 @@ abstract public class Feature extends StructureComponent { } } - /** Methods that remove the replaceBlock and alwaysReplace, and other parameters: as they are useless and only serve as a time sink normally. */ + /** Methods that are actually optimized, including ones that cut out replaceBlock and onlyReplace functionality when it's redundant. */ + protected void fillWithAir(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { + + if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) + return; + + for(int x = minX; x <= maxX; x++) { + + for(int z = minZ; z <= maxZ; z++) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + + if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { + for(int y = minY; y <= maxY; y++) { + int posY = getYWithOffset(y); + + world.setBlock(posX, posY, posZ, Blocks.air, 0, 2); + } + } + } + } + } + + @Override + protected void fillWithBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block, Block replaceBlock, boolean onlyReplace) { + + if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) + return; + + for(int x = minX; x <= maxX; x++) { + + for(int z = minZ; z <= maxZ; z++) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + + if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { + for(int y = minY; y <= maxY; y++) { + int posY = getYWithOffset(y); + + if(!onlyReplace || world.getBlock(posX, posY, posZ).getMaterial() != Material.air) { + if(x != minX && x != maxX && y != minY && y != maxY && z != minZ && z != maxZ) + world.setBlock(posX, posY, posZ, replaceBlock, 0, 2); + else + world.setBlock(posX, posY, posZ, block, 0, 2); + } + } + } + } + } + } protected void fillWithBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block) { - this.fillWithBlocks(world, box, minX, minY, minZ, maxX, maxY, maxZ, block, block, false); + + if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) + return; + + for(int x = minX; x <= maxX; x++) { + + for(int z = minZ; z <= maxZ; z++) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + + if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { + for(int y = minY; y <= maxY; y++) { + int posY = getYWithOffset(y); + + world.setBlock(posX, posY, posZ, block, 0, 2); + } + } + } + } + } + + @Override + protected void fillWithMetadataBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block, int meta, Block replaceBlock, int replaceMeta, boolean onlyReplace) { + + if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) + return; + + for(int x = minX; x <= maxX; x++) { + + for(int z = minZ; z <= maxZ; z++) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + + if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { + for(int y = minY; y <= maxY; y++) { + int posY = getYWithOffset(y); + + if(!onlyReplace || world.getBlock(posX, posY, posZ).getMaterial() != Material.air) { + if(x != minX && x != maxX && y != minY && y != maxY && z != minZ && z != maxZ) + world.setBlock(posX, posY, posZ, replaceBlock, replaceMeta, 2); + else + world.setBlock(posX, posY, posZ, block, meta, 2); + } + } + } + } + } } protected void fillWithMetadataBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block, int meta) { - this.fillWithMetadataBlocks(world, box, minX, minY, minZ, maxX, maxY, maxZ, block, meta, block, meta, false); + + if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) + return; + + for(int x = minX; x <= maxX; x++) { + + for(int z = minZ; z <= maxZ; z++) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + + if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { + for(int y = minY; y <= maxY; y++) { + int posY = getYWithOffset(y); + + world.setBlock(posX, posY, posZ, block, meta, 2); + } + } + } + } + } + + @Override + protected void fillWithRandomizedBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, boolean onlyReplace, Random rand, BlockSelector selector) { + + if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) + return; + + for(int x = minX; x <= maxX; x++) { + + for(int z = minZ; z <= maxZ; z++) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + + if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { + for(int y = minY; y <= maxY; y++) { + int posY = getYWithOffset(y); + + if(!onlyReplace || world.getBlock(posX, posY, posZ).getMaterial() != Material.air) { + selector.selectBlocks(rand, posX, posY, posZ, x == minX || x == maxX || y == minY || y == maxY || z == minZ || z == maxZ); + world.setBlock(posX, posY, posZ, selector.func_151561_a(), selector.getSelectedBlockMetaData(), 2); + } + } + } + } + } + } + + protected void fillWithRandomizedBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Random rand, BlockSelector selector) { //so i don't have to replace shit + + if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) + return; + + for(int x = minX; x <= maxX; x++) { + + for(int z = minZ; z <= maxZ; z++) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + + if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { + for(int y = minY; y <= maxY; y++) { + int posY = getYWithOffset(y); + //keep this functionality in mind! + selector.selectBlocks(rand, posX, posY, posZ, false); //for most structures it's redundant since nothing is just hollow cubes, but vanilla structures rely on this. use the method above in that case. + world.setBlock(posX, posY, posZ, selector.func_151561_a(), selector.getSelectedBlockMetaData(), 2); + } + } + } + } + } + + @Override + protected void randomlyFillWithBlocks(World world, StructureBoundingBox box, Random rand, float randLimit, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block, Block replaceBlock, boolean onlyReplace) { + + if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) + return; + + for(int x = minX; x <= maxX; x++) { + + for(int z = minZ; z <= maxZ; z++) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + + if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { + for(int y = minY; y <= maxY; y++) { + int posY = getYWithOffset(y); + + if(rand.nextFloat() <= randLimit && (!onlyReplace || world.getBlock(posX, posY, posZ).getMaterial() != Material.air)) { + if(x != minX && x != maxX && y != minY && y != maxY && z != minZ && z != maxZ) + world.setBlock(posX, posY, posZ, replaceBlock, 0, 2); + else + world.setBlock(posX, posY, posZ, block, 0, 2); + } + } + } + } + } } protected void randomlyFillWithBlocks(World world, StructureBoundingBox box, Random rand, float randLimit, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block) { - this.randomlyFillWithBlocks(world, box, rand, randLimit, minX, minY, minZ, maxX, maxY, maxZ, block, block, false); - } - - protected void fillWithRandomizedBlocks(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Random rand, BlockSelector selector) { - this.fillWithRandomizedBlocks(world, box, minX, minY, minZ, maxX, maxY, maxZ, false, rand, selector); + + if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) + return; + + for(int x = minX; x <= maxX; x++) { + + for(int z = minZ; z <= maxZ; z++) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + + if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { + for(int y = minY; y <= maxY; y++) { + int posY = getYWithOffset(y); + + if(rand.nextFloat() <= randLimit) + world.setBlock(posX, posY, posZ, block, 0, 2); + } + } + } + } } /** Block Selectors **/ From d804c81e18fc8f9b2ab65885f97387df9b188b81 Mon Sep 17 00:00:00 2001 From: Vaern Date: Wed, 5 Oct 2022 21:05:50 -0700 Subject: [PATCH 08/30] it actually works now --- .../java/com/hbm/items/tool/ItemWandD.java | 11 ++- src/main/java/com/hbm/lib/HbmWorld.java | 6 ++ .../com/hbm/world/worldgen/MapGenBunker.java | 18 +++++ .../worldgen/components/BunkerComponents.java | 80 ++++++++++++------- 4 files changed, 87 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/hbm/items/tool/ItemWandD.java b/src/main/java/com/hbm/items/tool/ItemWandD.java index 69fdac079..3d1c7d211 100644 --- a/src/main/java/com/hbm/items/tool/ItemWandD.java +++ b/src/main/java/com/hbm/items/tool/ItemWandD.java @@ -9,6 +9,7 @@ import com.hbm.items.ModItems; import com.hbm.items.special.ItemKitCustom; import com.hbm.lib.Library; import com.hbm.world.feature.OilSpot; +import com.hbm.world.worldgen.MapGenBunker.Start; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; @@ -19,6 +20,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; +import net.minecraft.world.gen.structure.StructureBoundingBox; public class ItemWandD extends Item { @@ -32,7 +34,14 @@ public class ItemWandD extends Item { if(pos != null) { - OilSpot.generateOilSpot(world, pos.blockX, pos.blockZ, 20, 500); + //use sparingly + int k = ((pos.blockX >> 4) << 4) + 8; + int l = ((pos.blockZ >> 4) << 4) + 8; + + Start start = new Start(world, world.rand, pos.blockX >> 4, pos.blockZ >> 4); + start.generateStructure(world, world.rand, new StructureBoundingBox(k - 100, l - 100, k + 15 + 100, l + 15 + 100)); + + /*OilSpot.generateOilSpot(world, pos.blockX, pos.blockZ, 20, 500);*/ /*EntityNukeTorex torex = new EntityNukeTorex(world); torex.setPositionAndRotation(pos.blockX, pos.blockY + 1, pos.blockZ, 0, 0); diff --git a/src/main/java/com/hbm/lib/HbmWorld.java b/src/main/java/com/hbm/lib/HbmWorld.java index fae367daf..b14484fb1 100644 --- a/src/main/java/com/hbm/lib/HbmWorld.java +++ b/src/main/java/com/hbm/lib/HbmWorld.java @@ -2,6 +2,7 @@ package com.hbm.lib; import com.hbm.world.worldgen.MapGenNTMFeatures; import com.hbm.world.worldgen.NTMWorldGenerator; +import com.hbm.world.worldgen.components.BunkerComponents.*; import com.hbm.world.worldgen.components.CivilianFeatures.*; import com.hbm.world.worldgen.components.MilitaryBaseFeatures.*; import com.hbm.world.worldgen.components.OfficeFeatures.*; @@ -49,5 +50,10 @@ public class HbmWorld { MapGenStructureIO.func_143031_a(RadioShack.class, "NTMRadioShack"); MapGenStructureIO.func_143031_a(LargeOffice.class, "NTMLargeOffice"); MapGenStructureIO.func_143031_a(LargeOfficeCorner.class, "NTMLargeOfficeCorner"); + + //bunker + MapGenStructureIO.func_143031_a(Atrium.class, "NTMBAtrium"); + MapGenStructureIO.func_143031_a(Corridor.class, "NTMBCorridor"); + MapGenStructureIO.func_143031_a(WideCorridor.class, "NTMBWideCorridor"); } } diff --git a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java index e72ef51ea..0513e51a6 100644 --- a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java +++ b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java @@ -2,8 +2,14 @@ package com.hbm.world.worldgen; import java.util.Random; +import com.hbm.config.GeneralConfig; +import com.hbm.world.worldgen.components.BunkerComponents; +import com.hbm.world.worldgen.components.BunkerComponents.Atrium; + import net.minecraft.world.World; import net.minecraft.world.gen.structure.MapGenStructure; +import net.minecraft.world.gen.structure.MapGenStructureIO; +import net.minecraft.world.gen.structure.StructureComponent; import net.minecraft.world.gen.structure.StructureStart; public class MapGenBunker extends MapGenStructure { @@ -30,7 +36,19 @@ public class MapGenBunker extends MapGenStructure { public Start(World world, Random rand, int chunkX, int chunkZ) { super(chunkX, chunkZ); + BunkerComponents.prepareComponents(); + Atrium atrium = new Atrium(0, rand, (chunkX << 4) + 8, (chunkZ << 4) + 8); + this.components.add(atrium); + atrium.buildComponent(atrium, components, rand); + if(GeneralConfig.enableDebugMode) { + System.out.print("[Debug] StructureStart at " + (chunkX * 16 + 8) + ", idfk lmao, " + (chunkZ * 16 + 8) + "\n[Debug] Components: "); + this.components.forEach((component) -> { + System.out.print(MapGenStructureIO.func_143036_a((StructureComponent) component) + " "); + }); + + System.out.print("\n"); + } this.updateBoundingBox(); this.markAvailableHeight(world, rand, 10); diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index fb67a0d55..a85a68a7b 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -15,7 +15,12 @@ import net.minecraft.world.gen.structure.StructureComponent; public class BunkerComponents { - private static final Weight[] weightArray = new Weight[0]; + private static final Weight[] weightArray = new Weight[] { + new Weight(2, 50, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = Bunker.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 5, 15, type); + return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Corridor(type, rand, box, mode) : null; }), + new Weight(3, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = Bunker.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 5, 17, type); + return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new WideCorridor(type, rand, box, mode) : null; }), + }; private static List componentWeightList; static int totalWeight; @@ -29,8 +34,26 @@ public class BunkerComponents { } } + private static boolean canAddStructurePieces() { + boolean flag = false; + totalWeight = 0; + Weight weight; + + for(Iterator iterator = componentWeightList.iterator(); iterator.hasNext(); totalWeight += weight.weight) { + weight = (Weight) iterator.next(); + + if(weight.instanceLimit >= 0 && weight.instancesSpawned < weight.instanceLimit) + flag = true; + } + System.out.println(flag); + return flag; + } + private static Bunker getWeightedComponent(StructureComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { + if(!canAddStructurePieces()) + return null; + for(int i = 0; i < 5; i++) { int value = rand.nextInt(totalWeight); Iterator iterator = componentWeightList.iterator(); @@ -43,7 +66,7 @@ public class BunkerComponents { if(!weight.canSpawnStructure(componentType)) break; - Bunker component = weight.lambda.findValidPlacement(components, rand, minX, minY, minZ, coordMode, componentType); + Bunker component = (Bunker) weight.lambda.findValidPlacement(components, rand, minX, minY, minZ, coordMode, componentType); if(component != null) { weight.instancesSpawned++; @@ -66,7 +89,7 @@ public class BunkerComponents { if(components.size() > 50) return null; - if(Math.abs(minX - original.getBoundingBox().minX) <= 112 && Math.abs(minZ - original.getBoundingBox().minX) <= 112) { + if(Math.abs(minX - original.getBoundingBox().minX) <= 112 && Math.abs(minZ - original.getBoundingBox().minZ) <= 112) { StructureComponent structure = getWeightedComponent(original, components, rand, minX, minY, minZ, coordMode, componentType); @@ -90,20 +113,20 @@ public class BunkerComponents { public int instancesSpawned; public int instanceLimit; - public Weight(instantiateStructure lambda, int weight, int limit) { - this.lambda = lambda; + public Weight(int weight, int limit, instantiateStructure lambda) { this.weight = weight; this.instanceLimit = limit; + this.lambda = lambda; } //Checks if another structure can be spawned based on input data public boolean canSpawnStructure(int componentAmount) { - return this.instanceLimit == 0 || this.instanceLimit < this.instanceLimit; + return this.instanceLimit < 0 || this.instanceLimit < this.instanceLimit; } //Checks if another structure can be spawned at all (used to flag for removal from the list) public boolean canSpawnMoreStructures() { - return this.instanceLimit == 0 || this.instancesSpawned < this.instanceLimit; + return this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit; } } @@ -111,7 +134,7 @@ public class BunkerComponents { /** Returns a new instance of this structureComponent, or null if not able to be placed. */ @FunctionalInterface interface instantiateStructure { - Bunker findValidPlacement(List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType); + StructureComponent findValidPlacement(List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType); } public abstract static class Bunker extends Feature { @@ -124,6 +147,7 @@ public class BunkerComponents { /** Gets next component in the direction this component is facing.
'original' refers to the initial starting component (hard distance limits), 'components' refers to the StructureStart list. */ protected StructureComponent getNextComponentNormal(StructureComponent original, List components, Random rand, int offset, int offsetY) { + switch(this.coordBaseMode) { case 0: //South return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType()); @@ -171,7 +195,7 @@ public class BunkerComponents { } } - protected static StructureBoundingBox getComponentToAddBoundingBox(int posX, int posY, int posZ, int offsetX, int offsetY, int offsetZ, int maxX, int maxY, int maxZ, int coordMode) { + public static StructureBoundingBox getComponentToAddBoundingBox(int posX, int posY, int posZ, int offsetX, int offsetY, int offsetZ, int maxX, int maxY, int maxZ, int coordMode) { switch(coordMode) { case 0: return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); @@ -191,15 +215,17 @@ public class BunkerComponents { public Atrium() { } - public Atrium(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + public Atrium(int componentType, Random rand, int posX, int posZ) { //TODO: change basically everything about this component super(componentType); - this.coordBaseMode = coordBaseMode; - this.boundingBox = box; + this.coordBaseMode = rand.nextInt(4); + this.boundingBox = new StructureBoundingBox(posX, 64, posZ, posX + 4, 68, posZ + 4); } @Override public void buildComponent(StructureComponent original, List components, Random rand) { - + getNextComponentNormal(original, components, rand, 1, 1); + getNextComponentNX(original, components, rand, 1, 1); + getNextComponentPX(original, components, rand, 1, 1); } @Override @@ -321,7 +347,7 @@ public class BunkerComponents { @Override public void buildComponent(StructureComponent original, List components, Random rand) { - getNextComponentNormal(original, components, rand, 1, 1); + getNextComponentNormal(original, components, rand, 3, 1); if(expandsNX) getNextComponentNX(original, components, rand, 7, 1); @@ -344,7 +370,7 @@ public class BunkerComponents { //Floor fillWithBlocks(world, box, 1, 0, begin, 1, 0, end, ModBlocks.deco_titanium); fillWithBlocks(world, box, 2, 0, begin, 2, 0, end, ModBlocks.tile_lab); - fillWithBlocks(world, box, 3, 0, 0, 5, 0, 14, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 3, 0, 0, 5, 0, 16, ModBlocks.deco_titanium); fillWithBlocks(world, box, 6, 0, begin, 6, 0, end, ModBlocks.tile_lab); fillWithBlocks(world, box, 7, 0, begin, 7, 0, end, ModBlocks.deco_titanium); @@ -391,21 +417,21 @@ public class BunkerComponents { } if(bulkheadNZ) { - fillWithBlocks(world, box, 0, 1, 0, 1, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 0, 1, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 0, 1, 3, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 5, 1, 0, 6, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 5, 2, 0, 6, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 5, 3, 0, 6, 3, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 1, 0, 2, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 0, 2, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 0, 2, 3, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 1, 0, 7, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 2, 0, 7, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 6, 3, 0, 7, 3, 0, ModBlocks.reinforced_brick); } if(bulkheadPZ) { - fillWithBlocks(world, box, 0, 1, 16, 1, 1, 16, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 16, 1, 2, 16, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 16, 1, 3, 16, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 5, 1, 16, 6, 1, 16, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 5, 2, 16, 6, 2, 16, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 5, 3, 16, 6, 3, 16, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 1, 16, 2, 1, 16, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 16, 2, 2, 16, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 16, 2, 3, 16, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 1, 16, 7, 1, 16, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 2, 16, 7, 2, 16, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 6, 3, 16, 7, 3, 16, ModBlocks.reinforced_brick); } //Ceiling From 697752c83940378dd8fcf2d28ccb9881424b73a6 Mon Sep 17 00:00:00 2001 From: Vaern Date: Fri, 7 Oct 2022 22:40:48 -0700 Subject: [PATCH 09/30] Procedural Generation fixes + added Intersection --- .../java/com/hbm/items/tool/ItemWandD.java | 2 +- src/main/java/com/hbm/lib/HbmWorld.java | 2 + .../com/hbm/world/worldgen/MapGenBunker.java | 7 + .../worldgen/components/BunkerComponents.java | 298 ++++++++++++++---- 4 files changed, 250 insertions(+), 59 deletions(-) diff --git a/src/main/java/com/hbm/items/tool/ItemWandD.java b/src/main/java/com/hbm/items/tool/ItemWandD.java index 3d1c7d211..e0cea6324 100644 --- a/src/main/java/com/hbm/items/tool/ItemWandD.java +++ b/src/main/java/com/hbm/items/tool/ItemWandD.java @@ -39,7 +39,7 @@ public class ItemWandD extends Item { int l = ((pos.blockZ >> 4) << 4) + 8; Start start = new Start(world, world.rand, pos.blockX >> 4, pos.blockZ >> 4); - start.generateStructure(world, world.rand, new StructureBoundingBox(k - 100, l - 100, k + 15 + 100, l + 15 + 100)); + start.generateStructure(world, world.rand, new StructureBoundingBox(k - 112, l - 112, k + 15 + 112, l + 15 + 112)); /*OilSpot.generateOilSpot(world, pos.blockX, pos.blockZ, 20, 500);*/ diff --git a/src/main/java/com/hbm/lib/HbmWorld.java b/src/main/java/com/hbm/lib/HbmWorld.java index b14484fb1..4cf2e090d 100644 --- a/src/main/java/com/hbm/lib/HbmWorld.java +++ b/src/main/java/com/hbm/lib/HbmWorld.java @@ -54,6 +54,8 @@ public class HbmWorld { //bunker MapGenStructureIO.func_143031_a(Atrium.class, "NTMBAtrium"); MapGenStructureIO.func_143031_a(Corridor.class, "NTMBCorridor"); + MapGenStructureIO.func_143031_a(Intersection.class, "NTMBIntersection"); MapGenStructureIO.func_143031_a(WideCorridor.class, "NTMBWideCorridor"); + } } diff --git a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java index 0513e51a6..665d2112e 100644 --- a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java +++ b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java @@ -41,6 +41,13 @@ public class MapGenBunker extends MapGenStructure { this.components.add(atrium); atrium.buildComponent(atrium, components, rand); + /*List list = atrium.componentsToBuild; + while(!list.isEmpty()) { + int k = rand.nextInt(list.size()); + Bunker component = (Bunker)list.remove(k); + component.buildComponent(atrium, list, rand); + }*/ + if(GeneralConfig.enableDebugMode) { System.out.print("[Debug] StructureStart at " + (chunkX * 16 + 8) + ", idfk lmao, " + (chunkZ * 16 + 8) + "\n[Debug] Components: "); this.components.forEach((component) -> { diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index a85a68a7b..c92cbc363 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -8,6 +8,7 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; +import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; @@ -16,10 +17,15 @@ import net.minecraft.world.gen.structure.StructureComponent; public class BunkerComponents { private static final Weight[] weightArray = new Weight[] { - new Weight(2, 50, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = Bunker.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 5, 15, type); + new Weight(1, 50, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = Bunker.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Corridor(type, rand, box, mode) : null; }), - new Weight(3, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = Bunker.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 5, 17, type); - return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new WideCorridor(type, rand, box, mode) : null; }), + new Weight(2, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = Bunker.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); + return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Corridor(type, rand, box, mode) : null; }), + new Weight(1, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = Bunker.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); + return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Intersection(type, rand, box, mode) : null; }), + new Weight(8, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = Bunker.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 17, mode); + return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new WideCorridor(type, rand, box, mode) : null; }), + }; private static List componentWeightList; @@ -45,7 +51,7 @@ public class BunkerComponents { if(weight.instanceLimit >= 0 && weight.instancesSpawned < weight.instanceLimit) flag = true; } - System.out.println(flag); + return flag; } @@ -89,13 +95,13 @@ public class BunkerComponents { if(components.size() > 50) return null; - if(Math.abs(minX - original.getBoundingBox().minX) <= 112 && Math.abs(minZ - original.getBoundingBox().minZ) <= 112) { + if(Math.abs(minX - original.getBoundingBox().minX) <= 64 && Math.abs(minZ - original.getBoundingBox().minZ) <= 64) { StructureComponent structure = getWeightedComponent(original, components, rand, minX, minY, minZ, coordMode, componentType); if(structure != null) { components.add(structure); //Adds component to structure start list - structure.buildComponent(original, components, rand); //either a) add it to a list in the original to be built or b) do it here. obviously the latter. + structure.buildComponent(original, components, rand); //no fucking clue why but doing it how mojang does it didn't work at all } return structure; @@ -147,16 +153,15 @@ public class BunkerComponents { /** Gets next component in the direction this component is facing.
'original' refers to the initial starting component (hard distance limits), 'components' refers to the StructureStart list. */ protected StructureComponent getNextComponentNormal(StructureComponent original, List components, Random rand, int offset, int offsetY) { - switch(this.coordBaseMode) { case 0: //South - return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType()); + return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType() + 1); case 1: //West - return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, this.coordBaseMode, this.getComponentType()); + return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, this.coordBaseMode, this.getComponentType() + 1); case 2: //North - return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType()); + return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType() + 1); case 3: //East - return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, this.coordBaseMode, this.getComponentType()); + return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, this.coordBaseMode, this.getComponentType() + 1); default: return null; } @@ -167,13 +172,13 @@ public class BunkerComponents { protected StructureComponent getNextComponentNX(StructureComponent original, List components, Random rand, int offset, int offsetY) { switch(this.coordBaseMode) { case 0: //South - return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 1, this.getComponentType()); + return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 1, this.getComponentType() + 1); case 1: //West - return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 2, this.getComponentType()); + return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 2, this.getComponentType() + 1); case 2: //North - return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 3, this.getComponentType()); + return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 3, this.getComponentType() + 1); case 3: //East - return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 0, this.getComponentType()); + return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 0, this.getComponentType() + 1); default: return null; } @@ -183,27 +188,28 @@ public class BunkerComponents { protected StructureComponent getNextComponentPX(StructureComponent original, List components, Random rand, int offset, int offsetY) { switch(this.coordBaseMode) { case 0: //South - return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 1, this.getComponentType()); + return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 1, this.getComponentType() + 1); case 1: //West - return getNextValidComponent(original, components, rand, this.boundingBox.minZ + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 2, this.getComponentType()); + return getNextValidComponent(original, components, rand, this.boundingBox.minZ + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 2, this.getComponentType() + 1); case 2: //North - return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 3, this.getComponentType()); + return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 3, this.getComponentType() + 1); case 3: //East - return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 0, this.getComponentType()); + return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 0, this.getComponentType() + 1); default: return null; } } public static StructureBoundingBox getComponentToAddBoundingBox(int posX, int posY, int posZ, int offsetX, int offsetY, int offsetZ, int maxX, int maxY, int maxZ, int coordMode) { - switch(coordMode) { - case 0: + System.out.print(posX + ", " + posY + ", " + posZ + ", CBM: " + coordMode); + switch(coordMode) { //fixed + case 0: //South return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); - case 1: + case 1: //West return new StructureBoundingBox(posX - maxZ + 1 - offsetZ, posY + offsetY, posZ + offsetX, posX - offsetZ, posY + maxY - 1 + offsetY, posZ + maxX - 1 + offsetX); - case 2: - return new StructureBoundingBox(posX - maxX + 1 - offsetX, posY + offsetY, posZ - maxZ + 1 - offsetZ, posX - offsetX, posY + maxY - 1 + offsetY, posZ - offsetZ); - case 3: + case 2: //North + return new StructureBoundingBox(posX - maxX + 1 - offsetX, posY + offsetY, posZ - maxZ + 1 - offsetZ, posX - offsetX, posY + maxY - 1 + offsetY, posZ + offsetZ); + case 3: //East return new StructureBoundingBox(posX + offsetZ, posY + offsetY, posZ - maxX + 1 - offsetX, posX + maxZ - 1 + offsetZ, posY + maxY - 1 + offsetY, posZ - offsetX); default: return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); @@ -238,6 +244,7 @@ public class BunkerComponents { boolean expandsNX = false; boolean expandsPX = false; + boolean extendsPZ = true; public Corridor() { } @@ -245,8 +252,6 @@ public class BunkerComponents { super(componentType); this.coordBaseMode = coordBaseMode; this.boundingBox = box; - expandsNX = rand.nextInt(3) == 0; - expandsPX = rand.nextInt(3) == 0; } @@ -254,44 +259,59 @@ public class BunkerComponents { super.func_143012_a(data); data.setBoolean("expandsNX", expandsNX); data.setBoolean("expandsPX", expandsPX); + data.setBoolean("extendsPZ", extendsPZ); } protected void func_143011_b(NBTTagCompound data) { super.func_143011_b(data); expandsNX = data.getBoolean("expandsNX"); expandsPX = data.getBoolean("expandsPX"); + extendsPZ = data.getBoolean("extendsPZ"); } @Override public void buildComponent(StructureComponent original, List components, Random rand) { - getNextComponentNormal(original, components, rand, 1, 1); + StructureComponent component = getNextComponentNormal(original, components, rand, 1, 1); + extendsPZ = component != null; - if(expandsNX) - getNextComponentNX(original, components, rand, 6, 1); + if(rand.nextInt(3) == 0) { + StructureComponent componentN = getNextComponentNX(original, components, rand, 6, 1); + expandsNX = componentN != null; + } - if(expandsPX) - getNextComponentPX(original, components, rand, 6, 1); + if(rand.nextInt(3) == 0) { + StructureComponent componentP = getNextComponentPX(original, components, rand, 6, 1); + expandsPX = componentP != null; + } } @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(isLiquidInStructureBoundingBox(world, box)) { + if(isLiquidInStructureBoundingBox(world, boundingBox)) { return false; } else { - fillWithAir(world, box, 1, 1, 0, 3, 3, 14); - fillWithBlocks(world, box, 1, 0, 0, 3, 0, 14, ModBlocks.deco_titanium); + int end = extendsPZ ? 14 : 13; + + fillWithAir(world, box, 1, 1, 0, 3, 3, end); + fillWithBlocks(world, box, 1, 0, 0, 3, 0, end, ModBlocks.deco_titanium); //Walls for(int x = 0; x <= 4; x += 4) { fillWithBlocks(world, box, x, 1, 0, x, 1, 4, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, x, 1, 10, x, 1, 14, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, x, 1, 10, x, 1, end, ModBlocks.reinforced_brick); fillWithBlocks(world, box, x, 2, 0, x, 2, 4, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, x, 2, 10, x, 2, 14, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, x, 3, 10, x, 3, 14, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, x, 2, 10, x, 2, end, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, x, 3, 10, x, 3, end, ModBlocks.reinforced_brick); fillWithBlocks(world, box, x, 3, 0, x, 3, 4, ModBlocks.reinforced_brick); } + if(!extendsPZ) { + fillWithBlocks(world, box, 1, 1, 14, 3, 1, 14, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 14, 3, 2, 14, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 14, 3, 3, 14, ModBlocks.reinforced_brick); + } + //ExpandsNX if(expandsNX) { fillWithBlocks(world, box, 0, 0, 6, 0, 0, 8, ModBlocks.deco_titanium); //Floor @@ -319,12 +339,18 @@ public class BunkerComponents { } //Ceiling - fillWithBlocks(world, box, 1, 4, 0, 1, 4, 14, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 3, 4, 0, 3, 4, 14, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 4, 0, 1, 4, end, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 3, 4, 0, 3, 4, end, ModBlocks.reinforced_brick); int pillarMeta = getPillarMeta(8); for(int i = 0; i <= 12; i += 3) { placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 2, 4, i, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 2, 4, i + 1, box); + + if(rand.nextInt(3) == 0) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_on, 0, 2, 4, i + 1, box); + placeBlockAtCurrentPosition(world, Blocks.redstone_block, 0, 2, 5, i + 1, box); + } else + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 2, 4, i + 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 2, 4, i + 2, box); } @@ -334,9 +360,12 @@ public class BunkerComponents { } - public static class WideCorridor extends Corridor { + interface Wide { } //now you may ask yourself - where is that beautiful house? you may ask yourself - where does that highway go to? + //you may ask yourself - am i right, am i wrong? you may say to yourself - my god, no multiple inheritance to be done! + + public static class WideCorridor extends Corridor implements Wide { - boolean bulkheadNZ = false; + boolean bulkheadNZ = true; boolean bulkheadPZ = true; public WideCorridor() { } @@ -347,30 +376,45 @@ public class BunkerComponents { @Override public void buildComponent(StructureComponent original, List components, Random rand) { - getNextComponentNormal(original, components, rand, 3, 1); + StructureComponent component = getNextComponentNormal(original, components, rand, 3, 1); + extendsPZ = component != null; - if(expandsNX) - getNextComponentNX(original, components, rand, 7, 1); + if(component instanceof Wide) { + bulkheadPZ = false; + + if(component instanceof WideCorridor) { + WideCorridor corridor = (WideCorridor) component; + corridor.bulkheadNZ = rand.nextInt(4) == 0; + } + } - if(expandsPX) - getNextComponentPX(original, components, rand, 7, 1); + if(rand.nextInt(3) == 0) { + StructureComponent componentN = getNextComponentNX(original, components, rand, 7, 1); + expandsNX = componentN != null; + } + + if(rand.nextInt(3) == 0) { + StructureComponent componentP = getNextComponentPX(original, components, rand, 7, 1); + expandsPX = componentP != null; + } } @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(isLiquidInStructureBoundingBox(world, box)) { + if(isLiquidInStructureBoundingBox(world, boundingBox)) { return false; } else { int begin = bulkheadNZ ? 1 : 0; - int end = bulkheadPZ ? 15 : 16; + int end = bulkheadPZ ? 15 : 16; //for the bulkhead + int endExtend = !extendsPZ ? 15 : 16; //for parts that would be cut off if it doesn't extend further fillWithAir(world, box, 1, 1, begin, 7, 3, end); //Floor fillWithBlocks(world, box, 1, 0, begin, 1, 0, end, ModBlocks.deco_titanium); fillWithBlocks(world, box, 2, 0, begin, 2, 0, end, ModBlocks.tile_lab); - fillWithBlocks(world, box, 3, 0, 0, 5, 0, 16, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 3, 0, 0, 5, 0, endExtend, ModBlocks.deco_titanium); fillWithBlocks(world, box, 6, 0, begin, 6, 0, end, ModBlocks.tile_lab); fillWithBlocks(world, box, 7, 0, begin, 7, 0, end, ModBlocks.deco_titanium); @@ -423,6 +467,7 @@ public class BunkerComponents { fillWithBlocks(world, box, 6, 1, 0, 7, 1, 0, ModBlocks.reinforced_brick); fillWithBlocks(world, box, 6, 2, 0, 7, 2, 0, ModBlocks.reinforced_stone); fillWithBlocks(world, box, 6, 3, 0, 7, 3, 0, ModBlocks.reinforced_brick); + fillWithAir(world, box, 3, 1, 0, 5, 3, 0); } if(bulkheadPZ) { @@ -432,22 +477,34 @@ public class BunkerComponents { fillWithBlocks(world, box, 6, 1, 16, 7, 1, 16, ModBlocks.reinforced_brick); fillWithBlocks(world, box, 6, 2, 16, 7, 2, 16, ModBlocks.reinforced_stone); fillWithBlocks(world, box, 6, 3, 16, 7, 3, 16, ModBlocks.reinforced_brick); + + if(!extendsPZ) { + fillWithBlocks(world, box, 3, 1, 16, 5, 1, 16, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 3, 2, 16, 5, 2, 16, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 3, 3, 16, 5, 3, 16, ModBlocks.reinforced_brick); + } else + fillWithAir(world, box, 3, 1, 16, 5, 3, 16); } //Ceiling fillWithBlocks(world, box, 1, 4, begin, 1, 4, end, ModBlocks.reinforced_brick); fillWithMetadataBlocks(world, box, 2, 4, begin, 2, 4, end, ModBlocks.concrete_pillar, pillarMeta); - fillWithBlocks(world, box, 3, 4, 0, 3, 4, 16, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 5, 4, 0, 5, 4, 16, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 3, 4, 0, 3, 4, endExtend, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 5, 4, 0, 5, 4, endExtend, ModBlocks.reinforced_brick); fillWithMetadataBlocks(world, box, 6, 4, begin, 6, 4, end, ModBlocks.concrete_pillar, pillarMeta); fillWithBlocks(world, box, 7, 4, begin, 7, 4, end, ModBlocks.reinforced_brick); for(int i = 0; i <= 12; i += 3) { fillWithMetadataBlocks(world, box, 4, 4, i, 4, 4, i + 1, ModBlocks.concrete_pillar, pillarMeta); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 4, 4, i + 2, box); + + if(rand.nextInt(3) == 0) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_on, 0, 4, 4, i + 2, box); + placeBlockAtCurrentPosition(world, Blocks.redstone_block, 0, 4, 5, i + 2, box); + } else + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 4, 4, i + 2, box); } - fillWithMetadataBlocks(world, box, 4, 4, 15, 4, 4, 16, ModBlocks.concrete_pillar, pillarMeta); + fillWithMetadataBlocks(world, box, 4, 4, 15, 4, 4, endExtend, ModBlocks.concrete_pillar, pillarMeta); return true; } @@ -471,7 +528,7 @@ public class BunkerComponents { } } - public static class WideTurn extends Turn { + public static class WideTurn extends Turn implements Wide { public WideTurn() { } @@ -487,6 +544,10 @@ public class BunkerComponents { public static class Intersection extends Bunker { + boolean opensNX = false; + boolean opensPX = false; + boolean opensPZ = false; + public Intersection() { } public Intersection(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { @@ -496,13 +557,134 @@ public class BunkerComponents { } + @Override + public void buildComponent(StructureComponent original, List components, Random rand) { + if(rand.nextInt(3) != 0) { + StructureComponent component = getNextComponentNormal(original, components, rand, 1, 1); + opensPZ = component != null; + } + + StructureComponent componentN = getNextComponentNX(original, components, rand, 1, 1); + opensNX = componentN != null; + + StructureComponent componentP = getNextComponentPX(original, components, rand, 1, 1); + opensPX = componentP != null; + } + + protected void func_143012_a(NBTTagCompound data) { + super.func_143012_a(data); + data.setBoolean("opensNX", opensNX); + data.setBoolean("opensPX", opensPX); + data.setBoolean("opensPZ", opensPZ); + } + + protected void func_143011_b(NBTTagCompound data) { + super.func_143011_b(data); + opensNX = data.getBoolean("opensNX"); + opensPX = data.getBoolean("opensPX"); + opensPZ = data.getBoolean("opensPZ"); + } + @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - return true; + if(isLiquidInStructureBoundingBox(world, boundingBox)) { + return false; + } else { + + fillWithAir(world, box, 1, 1, 0, 3, 3, 3); + //Floor + fillWithBlocks(world, box, 1, 0, 0, 3, 0, 3, ModBlocks.deco_titanium); + //Ceiling + int pillarMetaNS = getPillarMeta(8); + + fillWithBlocks(world, box, 3, 4, 0, 3, 4, 1, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 2, 4, 0, 2, 4, 1, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 1, 4, 0, 1, 4, 1, ModBlocks.reinforced_brick); + + if(rand.nextInt(3) == 0) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_on, 0, 2, 4, 2, box); + placeBlockAtCurrentPosition(world, Blocks.redstone_block, 0, 2, 5, 2, box); + } else + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 2, 4, 2, box); + + if(opensPZ) { + fillWithBlocks(world, box, 1, 0, 4, 3, 0, 4, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 1, 4, 3, 1, 4, 4, ModBlocks.reinforced_brick); //Ceiling + fillWithMetadataBlocks(world, box, 2, 4, 3, 2, 4, 4, ModBlocks.concrete_pillar, 8); + fillWithBlocks(world, box, 3, 4, 3, 3, 4, 4, ModBlocks.reinforced_brick); + fillWithAir(world, box, 1, 1, 4, 3, 3, 4); //Opening + } else { + fillWithBlocks(world, box, 1, 4, 3, 3, 4, 3, ModBlocks.reinforced_brick); //Ceiling + fillWithBlocks(world, box, 1, 1, 4, 3, 1, 4, ModBlocks.reinforced_brick); //Wall + fillWithBlocks(world, box, 1, 2, 4, 3, 2, 4, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 4, 3, 3, 4, ModBlocks.reinforced_brick); + } + + if(opensNX) { + fillWithBlocks(world, box, 0, 0, 1, 0, 0, 3, ModBlocks.deco_titanium); //Floor + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 1, box); //Ceiling + fillWithMetadataBlocks(world, box, 0, 4, 2, 1, 4, 2, ModBlocks.concrete_pillar, 4); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 3, box); + fillWithAir(world, box, 0, 1, 1, 0, 3, 3); //Opening + } else { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 4, 2, box); //Ceiling + fillWithBlocks(world, box, 0, 1, 1, 0, 1, 3, ModBlocks.reinforced_brick); //Wall + fillWithBlocks(world, box, 0, 2, 1, 0, 2, 3, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 1, 0, 3, 3, ModBlocks.reinforced_brick); + } + + if(opensPX) { + fillWithBlocks(world, box, 4, 0, 1, 4, 0, 3, ModBlocks.deco_titanium); //Floor + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 4, 1, box); //Ceiling + fillWithMetadataBlocks(world, box, 3, 4, 2, 4, 4, 2, ModBlocks.concrete_pillar, 4); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 4, 3, box); + fillWithAir(world, box, 4, 1, 1, 4, 3, 3); //Opening + } else { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 3, 4, 2, box); + fillWithBlocks(world, box, 4, 1, 1, 4, 1, 3, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 4, 2, 1, 4, 2, 3, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 4, 3, 1, 4, 3, 3, ModBlocks.reinforced_brick); + } + + //Pillars + if(opensNX) + fillWithBlocks(world, box, 0, 1, 0, 0, 3, 0, ModBlocks.concrete_pillar); + else { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 1, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 0, 2, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 3, 0, box); + } + + if(opensPX) + fillWithBlocks(world, box, 4, 1, 0, 4, 3, 0, ModBlocks.concrete_pillar); + else { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 1, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 4, 2, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 3, 0, box); + } + + if(opensNX && opensPZ) + fillWithBlocks(world, box, 0, 1, 4, 0, 3, 4, ModBlocks.concrete_pillar); + else if(opensNX || opensPZ) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 1, 4, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 0, 2, 4, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 3, 4, box); + } + + if(opensPX && opensPZ) + fillWithBlocks(world, box, 4, 1, 4, 4, 3, 4, ModBlocks.concrete_pillar); + else if(opensPX || opensPZ) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 1, 4, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 4, 2, 4, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 3, 4, box); + } + + return true; + } } } - public static class WideIntersection extends Intersection { + public static class WideIntersection extends Intersection implements Wide { public WideIntersection() { } From 7edbf615b65f7828737fb103ca00db253b543203 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sat, 8 Oct 2022 15:15:41 -0700 Subject: [PATCH 10/30] Major refactoring, some fixes aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --- .../com/hbm/world/worldgen/MapGenBunker.java | 11 +- .../worldgen/components/BunkerComponents.java | 225 ++--------------- .../worldgen/components/CivilianFeatures.java | 10 +- .../{Feature.java => Component.java} | 18 +- .../components/MilitaryBaseFeatures.java | 4 +- .../worldgen/components/OfficeFeatures.java | 6 +- .../components/ProceduralComponents.java | 228 ++++++++++++++++++ .../worldgen/components/RuinFeatures.java | 8 +- 8 files changed, 283 insertions(+), 227 deletions(-) rename src/main/java/com/hbm/world/worldgen/components/{Feature.java => Component.java} (98%) create mode 100644 src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java diff --git a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java index 665d2112e..669bf999d 100644 --- a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java +++ b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java @@ -1,10 +1,12 @@ package com.hbm.world.worldgen; +import java.util.List; import java.util.Random; import com.hbm.config.GeneralConfig; import com.hbm.world.worldgen.components.BunkerComponents; import com.hbm.world.worldgen.components.BunkerComponents.Atrium; +import com.hbm.world.worldgen.components.ProceduralComponents.ProceduralComponent; import net.minecraft.world.World; import net.minecraft.world.gen.structure.MapGenStructure; @@ -41,12 +43,13 @@ public class MapGenBunker extends MapGenStructure { this.components.add(atrium); atrium.buildComponent(atrium, components, rand); - /*List list = atrium.componentsToBuild; + List list = atrium.queuedComponents; while(!list.isEmpty()) { int k = rand.nextInt(list.size()); - Bunker component = (Bunker)list.remove(k); - component.buildComponent(atrium, list, rand); - }*/ + ProceduralComponent component = (ProceduralComponent)list.remove(k); + atrium.lastComponent = component; + component.buildComponent(atrium, this.components, rand); + } if(GeneralConfig.enableDebugMode) { System.out.print("[Debug] StructureStart at " + (chunkX * 16 + 8) + ", idfk lmao, " + (chunkZ * 16 + 8) + "\n[Debug] Components: "); diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index c92cbc363..67cef9a0f 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -14,23 +14,20 @@ import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureComponent; -public class BunkerComponents { +public class BunkerComponents extends ProceduralComponents { - private static final Weight[] weightArray = new Weight[] { - new Weight(1, 50, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = Bunker.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); + protected static final Weight[] weightArray = new Weight[] { + new Weight(1, 50, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Corridor(type, rand, box, mode) : null; }), - new Weight(2, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = Bunker.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); - return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Corridor(type, rand, box, mode) : null; }), - new Weight(1, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = Bunker.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); + new Weight(2, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); + return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Corridor(type, rand, box, mode) : null; }), + new Weight(1, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Intersection(type, rand, box, mode) : null; }), - new Weight(8, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = Bunker.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 17, mode); + new Weight(8, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 17, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new WideCorridor(type, rand, box, mode) : null; }), }; - private static List componentWeightList; - static int totalWeight; - public static void prepareComponents() { componentWeightList = new ArrayList(); @@ -40,198 +37,21 @@ public class BunkerComponents { } } - private static boolean canAddStructurePieces() { - boolean flag = false; - totalWeight = 0; - Weight weight; - - for(Iterator iterator = componentWeightList.iterator(); iterator.hasNext(); totalWeight += weight.weight) { - weight = (Weight) iterator.next(); - - if(weight.instanceLimit >= 0 && weight.instancesSpawned < weight.instanceLimit) - flag = true; - } - - return flag; - } - - private static Bunker getWeightedComponent(StructureComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { - - if(!canAddStructurePieces()) - return null; - - for(int i = 0; i < 5; i++) { - int value = rand.nextInt(totalWeight); - Iterator iterator = componentWeightList.iterator(); - - while(iterator.hasNext()) { - Weight weight = (Weight)iterator.next(); - value -= weight.weight; - - if(value < 0) { - if(!weight.canSpawnStructure(componentType)) - break; - - Bunker component = (Bunker) weight.lambda.findValidPlacement(components, rand, minX, minY, minZ, coordMode, componentType); - - if(component != null) { - weight.instancesSpawned++; - - if(!weight.canSpawnMoreStructures()) - componentWeightList.remove(weight); - - return component; - } - - } - } - } - - return null; - } - - private static StructureComponent getNextValidComponent(StructureComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { - - if(components.size() > 50) - return null; - - if(Math.abs(minX - original.getBoundingBox().minX) <= 64 && Math.abs(minZ - original.getBoundingBox().minZ) <= 64) { - - StructureComponent structure = getWeightedComponent(original, components, rand, minX, minY, minZ, coordMode, componentType); - - if(structure != null) { - components.add(structure); //Adds component to structure start list - structure.buildComponent(original, components, rand); //no fucking clue why but doing it how mojang does it didn't work at all - } - - return structure; - } - - return null; - } - - static class Weight { - - public final instantiateStructure lambda; //i refuse to use some 🤓 ass method for getting the class from each PieceWeight - //here, we overengineer shit like real developers - - public final int weight; - public int instancesSpawned; - public int instanceLimit; - - public Weight(int weight, int limit, instantiateStructure lambda) { - this.weight = weight; - this.instanceLimit = limit; - this.lambda = lambda; - } - - //Checks if another structure can be spawned based on input data - public boolean canSpawnStructure(int componentAmount) { - return this.instanceLimit < 0 || this.instanceLimit < this.instanceLimit; - } - - //Checks if another structure can be spawned at all (used to flag for removal from the list) - public boolean canSpawnMoreStructures() { - return this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit; - } - - } - - /** Returns a new instance of this structureComponent, or null if not able to be placed. */ - @FunctionalInterface - interface instantiateStructure { - StructureComponent findValidPlacement(List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType); - } - - public abstract static class Bunker extends Feature { - - public Bunker() { } - - public Bunker(int componentType) { - super(componentType); //important to carry over, as it allows for hard limits on the amount of components. increment once for each new component. - } - - /** Gets next component in the direction this component is facing.
'original' refers to the initial starting component (hard distance limits), 'components' refers to the StructureStart list. */ - protected StructureComponent getNextComponentNormal(StructureComponent original, List components, Random rand, int offset, int offsetY) { - switch(this.coordBaseMode) { - case 0: //South - return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType() + 1); - case 1: //West - return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, this.coordBaseMode, this.getComponentType() + 1); - case 2: //North - return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType() + 1); - case 3: //East - return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, this.coordBaseMode, this.getComponentType() + 1); - default: - return null; - } - } - - //Keep in mind for these methods: a given room would have its *actual entrance* opposite the side it is facing. - /** Gets next component, to the West (-X) relative to this component. */ - protected StructureComponent getNextComponentNX(StructureComponent original, List components, Random rand, int offset, int offsetY) { - switch(this.coordBaseMode) { - case 0: //South - return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 1, this.getComponentType() + 1); - case 1: //West - return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 2, this.getComponentType() + 1); - case 2: //North - return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 3, this.getComponentType() + 1); - case 3: //East - return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 0, this.getComponentType() + 1); - default: - return null; - } - } - - /** Gets next component, to the East (+X) relative to this component. */ - protected StructureComponent getNextComponentPX(StructureComponent original, List components, Random rand, int offset, int offsetY) { - switch(this.coordBaseMode) { - case 0: //South - return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 1, this.getComponentType() + 1); - case 1: //West - return getNextValidComponent(original, components, rand, this.boundingBox.minZ + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 2, this.getComponentType() + 1); - case 2: //North - return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 3, this.getComponentType() + 1); - case 3: //East - return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 0, this.getComponentType() + 1); - default: - return null; - } - } - - public static StructureBoundingBox getComponentToAddBoundingBox(int posX, int posY, int posZ, int offsetX, int offsetY, int offsetZ, int maxX, int maxY, int maxZ, int coordMode) { - System.out.print(posX + ", " + posY + ", " + posZ + ", CBM: " + coordMode); - switch(coordMode) { //fixed - case 0: //South - return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); - case 1: //West - return new StructureBoundingBox(posX - maxZ + 1 - offsetZ, posY + offsetY, posZ + offsetX, posX - offsetZ, posY + maxY - 1 + offsetY, posZ + maxX - 1 + offsetX); - case 2: //North - return new StructureBoundingBox(posX - maxX + 1 - offsetX, posY + offsetY, posZ - maxZ + 1 - offsetZ, posX - offsetX, posY + maxY - 1 + offsetY, posZ + offsetZ); - case 3: //East - return new StructureBoundingBox(posX + offsetZ, posY + offsetY, posZ - maxX + 1 - offsetX, posX + maxZ - 1 + offsetZ, posY + maxY - 1 + offsetY, posZ - offsetX); - default: - return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); - } - } - } - - public static class Atrium extends Bunker { + public static class Atrium extends ControlComponent { public Atrium() { } public Atrium(int componentType, Random rand, int posX, int posZ) { //TODO: change basically everything about this component super(componentType); this.coordBaseMode = rand.nextInt(4); - this.boundingBox = new StructureBoundingBox(posX, 64, posZ, posX + 4, 68, posZ + 4); + this.boundingBox = new StructureBoundingBox(posX, 64, posZ, posX + 8, 68, posZ + 8); } @Override - public void buildComponent(StructureComponent original, List components, Random rand) { - getNextComponentNormal(original, components, rand, 1, 1); - getNextComponentNX(original, components, rand, 1, 1); - getNextComponentPX(original, components, rand, 1, 1); + public void buildComponent(ControlComponent original, List components, Random rand) { + getNextComponentNormal(original, components, rand, 3, 1); + getNextComponentNX(original, components, rand, 3, 1); + getNextComponentPX(original, components, rand, 3, 1); } @Override @@ -240,7 +60,7 @@ public class BunkerComponents { } } - public static class Corridor extends Bunker { + public static class Corridor extends ProceduralComponent { boolean expandsNX = false; boolean expandsPX = false; @@ -270,7 +90,7 @@ public class BunkerComponents { } @Override - public void buildComponent(StructureComponent original, List components, Random rand) { + public void buildComponent(ControlComponent original, List components, Random rand) { StructureComponent component = getNextComponentNormal(original, components, rand, 1, 1); extendsPZ = component != null; @@ -375,7 +195,7 @@ public class BunkerComponents { } @Override - public void buildComponent(StructureComponent original, List components, Random rand) { + public void buildComponent(ControlComponent original, List components, Random rand) { StructureComponent component = getNextComponentNormal(original, components, rand, 3, 1); extendsPZ = component != null; @@ -511,7 +331,7 @@ public class BunkerComponents { } } - public static class Turn extends Bunker { + public static class Turn extends ProceduralComponent { public Turn() { } @@ -542,7 +362,7 @@ public class BunkerComponents { } } - public static class Intersection extends Bunker { + public static class Intersection extends ProceduralComponent { boolean opensNX = false; boolean opensPX = false; @@ -558,7 +378,7 @@ public class BunkerComponents { } @Override - public void buildComponent(StructureComponent original, List components, Random rand) { + public void buildComponent(ControlComponent original, List components, Random rand) { if(rand.nextInt(3) != 0) { StructureComponent component = getNextComponentNormal(original, components, rand, 1, 1); opensPZ = component != null; @@ -595,6 +415,7 @@ public class BunkerComponents { //Floor fillWithBlocks(world, box, 1, 0, 0, 3, 0, 3, ModBlocks.deco_titanium); //Ceiling + int pillarMetaWE = getPillarMeta(4); int pillarMetaNS = getPillarMeta(8); fillWithBlocks(world, box, 3, 4, 0, 3, 4, 1, ModBlocks.reinforced_brick); @@ -610,7 +431,7 @@ public class BunkerComponents { if(opensPZ) { fillWithBlocks(world, box, 1, 0, 4, 3, 0, 4, ModBlocks.deco_titanium); //Floor fillWithBlocks(world, box, 1, 4, 3, 1, 4, 4, ModBlocks.reinforced_brick); //Ceiling - fillWithMetadataBlocks(world, box, 2, 4, 3, 2, 4, 4, ModBlocks.concrete_pillar, 8); + fillWithMetadataBlocks(world, box, 2, 4, 3, 2, 4, 4, ModBlocks.concrete_pillar, pillarMetaNS); fillWithBlocks(world, box, 3, 4, 3, 3, 4, 4, ModBlocks.reinforced_brick); fillWithAir(world, box, 1, 1, 4, 3, 3, 4); //Opening } else { @@ -623,7 +444,7 @@ public class BunkerComponents { if(opensNX) { fillWithBlocks(world, box, 0, 0, 1, 0, 0, 3, ModBlocks.deco_titanium); //Floor placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 1, box); //Ceiling - fillWithMetadataBlocks(world, box, 0, 4, 2, 1, 4, 2, ModBlocks.concrete_pillar, 4); + fillWithMetadataBlocks(world, box, 0, 4, 2, 1, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 3, box); fillWithAir(world, box, 0, 1, 1, 0, 3, 3); //Opening } else { @@ -636,7 +457,7 @@ public class BunkerComponents { if(opensPX) { fillWithBlocks(world, box, 4, 0, 1, 4, 0, 3, ModBlocks.deco_titanium); //Floor placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 4, 1, box); //Ceiling - fillWithMetadataBlocks(world, box, 3, 4, 2, 4, 4, 2, ModBlocks.concrete_pillar, 4); + fillWithMetadataBlocks(world, box, 3, 4, 2, 4, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 4, 3, box); fillWithAir(world, box, 4, 1, 1, 4, 3, 3); //Opening } else { diff --git a/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java b/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java index b18789236..4110a1294 100644 --- a/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java @@ -22,7 +22,7 @@ import net.minecraft.world.gen.structure.StructureBoundingBox; public class CivilianFeatures { /** Sandstone Ruin 1 */ - public static class NTMHouse1 extends Feature { + public static class NTMHouse1 extends Component { private boolean hasPlacedChest; @@ -120,7 +120,7 @@ public class CivilianFeatures { } - public static class NTMHouse2 extends Feature { + public static class NTMHouse2 extends Component { private static Sandstone RandomSandstone = new Sandstone(); @@ -264,7 +264,7 @@ public class CivilianFeatures { } } - public static class NTMLab1 extends Feature { + public static class NTMLab1 extends Component { private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks(); private static LabTiles RandomLabTiles = new LabTiles(); @@ -391,7 +391,7 @@ public class CivilianFeatures { } } - public static class NTMLab2 extends Feature { + public static class NTMLab2 extends Component { private static SuperConcrete RandomSuperConcrete = new SuperConcrete(); private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks(); @@ -565,7 +565,7 @@ public class CivilianFeatures { } } - public static class NTMWorkshop1 extends Feature { + public static class NTMWorkshop1 extends Component { private static SuperConcrete RandomSuperConcrete = new SuperConcrete(); diff --git a/src/main/java/com/hbm/world/worldgen/components/Feature.java b/src/main/java/com/hbm/world/worldgen/components/Component.java similarity index 98% rename from src/main/java/com/hbm/world/worldgen/components/Feature.java rename to src/main/java/com/hbm/world/worldgen/components/Component.java index 080aaea42..b6eb382c0 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Feature.java +++ b/src/main/java/com/hbm/world/worldgen/components/Component.java @@ -23,7 +23,7 @@ import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureComponent; -abstract public class Feature extends StructureComponent { +abstract public class Component extends StructureComponent { /** The size of the bounding box for this feature in the X axis */ protected int sizeX; /** The size of the bounding box for this feature in the Y axis */ @@ -33,15 +33,15 @@ abstract public class Feature extends StructureComponent { /** Average height (Presumably stands for height position) */ protected int hpos = -1; - protected Feature() { + protected Component() { super(0); } - protected Feature(int componentType) { + protected Component(int componentType) { super(componentType); } - protected Feature(Random rand, int minX, int minY, int minZ, int maxX, int maxY, int maxZ ) { + protected Component(Random rand, int minX, int minY, int minZ, int maxX, int maxY, int maxZ ) { super(0); this.sizeX = maxX; this.sizeY = maxY; @@ -105,6 +105,10 @@ abstract public class Feature extends StructureComponent { return true; } + public int getCoordMode() { + return this.coordBaseMode; + } + /** Metadata for Decoration Methods **/ /** @@ -689,11 +693,11 @@ abstract public class Feature extends StructureComponent { public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean p_75062_5_) { float chance = rand.nextFloat(); - if(chance < 0.2F) { + if(chance < 0.4F) { this.field_151562_a = ModBlocks.brick_concrete; - } else if (chance < 0.55F) { + } else if (chance < 0.7F) { this.field_151562_a = ModBlocks.brick_concrete_mossy; - } else if (chance < 0.75F) { + } else if (chance < 0.9F) { this.field_151562_a = ModBlocks.brick_concrete_cracked; } else { this.field_151562_a = ModBlocks.brick_concrete_broken; diff --git a/src/main/java/com/hbm/world/worldgen/components/MilitaryBaseFeatures.java b/src/main/java/com/hbm/world/worldgen/components/MilitaryBaseFeatures.java index 27571adf5..06acabe2f 100644 --- a/src/main/java/com/hbm/world/worldgen/components/MilitaryBaseFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/MilitaryBaseFeatures.java @@ -48,7 +48,7 @@ public class MilitaryBaseFeatures { return chunkPos; } - public static class BasicHelipad extends Feature { + public static class BasicHelipad extends Component { public BasicHelipad() { super(); } @@ -100,7 +100,7 @@ public class MilitaryBaseFeatures { } - public static class RadioShack extends Feature { + public static class RadioShack extends Component { private static LabTiles RandomLabTiles = new LabTiles(); private static ConcreteBricks ConcreteBricks = new ConcreteBricks(); diff --git a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java index fddcd5037..32c5bf866 100644 --- a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java @@ -5,7 +5,7 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; import com.hbm.lib.HbmChestContents; import com.hbm.util.LootGenerator; -import com.hbm.world.worldgen.components.Feature.ConcreteBricks; +import com.hbm.world.worldgen.components.Component.ConcreteBricks; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; @@ -15,7 +15,7 @@ import net.minecraft.world.gen.structure.StructureBoundingBox; //Oh my fucking god TM public class OfficeFeatures { - public static class LargeOffice extends Feature { + public static class LargeOffice extends Component { private static ConcreteBricks ConcreteBricks = new ConcreteBricks(); @@ -216,7 +216,7 @@ public class OfficeFeatures { } //bob i could kiss you - public static class LargeOfficeCorner extends Feature { + public static class LargeOfficeCorner extends Component { private static ConcreteBricks ConcreteBricks = new ConcreteBricks(); diff --git a/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java b/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java new file mode 100644 index 000000000..57cfd5336 --- /dev/null +++ b/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java @@ -0,0 +1,228 @@ +package com.hbm.world.worldgen.components; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + +import com.hbm.world.worldgen.components.ProceduralComponents.ControlComponent; + +import net.minecraft.world.gen.structure.StructureBoundingBox; +import net.minecraft.world.gen.structure.StructureComponent; + +public abstract class ProceduralComponents { + + protected static List componentWeightList; + static int totalWeight; + + /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * The two methods/fields below *must* be recreated in the subclasses. + * Due to poor language design, Java does not allow the overriding/creation of static abstract methods; + * due to reasonable language design, Java does not allow overriding abstract fields. + * getWeightArray() should contain an array with Weight(s) for your components. + */ + + //protected static final Weight[] weightArray = new Weight[] { }; + + /*public static void prepareComponents() { + componentWeightList = new ArrayList(); + + for(int i = 0; i < weightArray.length; i++) { + weightArray[i].instancesSpawned = 0; + componentWeightList.add(weightArray[i]); + } + }*/ + + protected static boolean canAddStructurePieces() { + boolean flag = false; + totalWeight = 0; + Weight weight; + + for(Iterator iterator = componentWeightList.iterator(); iterator.hasNext(); totalWeight += weight.weight) { //Iterates over the entire list to find the total weight + weight = (Weight) iterator.next(); + + if(weight.instanceLimit >= 0 && weight.instancesSpawned < weight.instanceLimit) //can more structure pieces be added, in general? + flag = true; + } + + return flag; + } + + protected static ProceduralComponent getWeightedComponent(ControlComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { + + if(!canAddStructurePieces()) + return null; + + for(int i = 0; i < 5; i++) { + int value = rand.nextInt(totalWeight); //Pick a random value, based on how many parts there are already + Iterator iterator = componentWeightList.iterator(); + + while(iterator.hasNext()) { + Weight weight = (Weight)iterator.next(); + value -= weight.weight; //Iterate over the list until the value is less than 0 + + if(value < 0) { + if(!weight.canSpawnStructure(componentType, coordMode, original.lastComponent)) //Additional checks based on game state info preventing spawn? start from beginning + break; + + ProceduralComponent component = (ProceduralComponent) weight.lambda.findValidPlacement(components, rand, minX, minY, minZ, coordMode, componentType); //Construct the chosen component + + if(component != null) { //If it has been constructed, add it + weight.instancesSpawned++; + + if(!weight.canSpawnMoreStructures()) //Structure can no longer be spawned regardless of game state? remove as an option + componentWeightList.remove(weight); + + return component; + } + + } + } + } + + return null; + } + + protected static ProceduralComponent getNextValidComponent(ControlComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { + + if(components.size() > 50) //Hard limit on amount of components + return null; + + if(Math.abs(minX - original.getBoundingBox().minX) <= 64 && Math.abs(minZ - original.getBoundingBox().minZ) <= 64) { //Hard limit on spread of structure + + ProceduralComponent structure = getWeightedComponent(original, components, rand, minX, minY, minZ, coordMode, componentType + 1); //Returns null if all checks fail + + if(structure != null) { + components.add(structure); //Adds component to structure start list + original.queuedComponents.add(structure); //Add it to the list of queued components waiting to be built + } + + return structure; + } + + return null; + } + + /** StructureComponent that supports procedural generation */ + public abstract static class ProceduralComponent extends Component { + + public ProceduralComponent() { } + + public ProceduralComponent(int componentType) { + super(componentType); //Important to carry over. + } + + public void buildComponent(ControlComponent original, List components, Random rand) { } + + /** Gets next component in the direction this component is facing.
'original' refers to the initial starting component (hard distance limits), 'components' refers to the StructureStart list. */ + protected ProceduralComponent getNextComponentNormal(ControlComponent original, List components, Random rand, int offset, int offsetY) { + switch(this.coordBaseMode) { + case 0: //South + return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType()); + case 1: //West + return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, this.coordBaseMode, this.getComponentType()); + case 2: //North + return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType()); + case 3: //East + return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, this.coordBaseMode, this.getComponentType()); + default: + return null; + } + } + + //Keep in mind for these methods: a given room would have its *actual entrance* opposite the side it is facing. + /** Gets next component, to the West (-X) relative to this component. */ + protected ProceduralComponent getNextComponentNX(ControlComponent original, List components, Random rand, int offset, int offsetY) { + switch(this.coordBaseMode) { + case 0: //South + return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 1, this.getComponentType()); + case 1: //West + return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 2, this.getComponentType()); + case 2: //North + return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 3, this.getComponentType()); + case 3: //East + return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 0, this.getComponentType()); + default: + return null; + } + } + + /** Gets next component, to the East (+X) relative to this component. */ + protected ProceduralComponent getNextComponentPX(ControlComponent original, List components, Random rand, int offset, int offsetY) { + switch(this.coordBaseMode) { + case 0: //South + return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 1, this.getComponentType() + 1); + case 1: //West + return getNextValidComponent(original, components, rand, this.boundingBox.minZ + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 2, this.getComponentType() + 1); + case 2: //North + return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 3, this.getComponentType() + 1); + case 3: //East + return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 0, this.getComponentType() + 1); + default: + return null; + } + } + + public static StructureBoundingBox getComponentToAddBoundingBox(int posX, int posY, int posZ, int offsetX, int offsetY, int offsetZ, int maxX, int maxY, int maxZ, int coordMode) { + switch(coordMode) { + case 0: //South + return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); + case 1: //West + return new StructureBoundingBox(posX - maxZ + 1 - offsetZ, posY + offsetY, posZ + offsetX, posX - offsetZ, posY + maxY - 1 + offsetY, posZ + maxX - 1 + offsetX); + case 2: //North + return new StructureBoundingBox(posX - maxX + 1 - offsetX, posY + offsetY, posZ - maxZ + 1 - offsetZ, posX - offsetX, posY + maxY - 1 + offsetY, posZ + offsetZ); + case 3: //East + return new StructureBoundingBox(posX + offsetZ, posY + offsetY, posZ - maxX + 1 - offsetX, posX + maxZ - 1 + offsetZ, posY + maxY - 1 + offsetY, posZ - offsetX); + default: + return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); + } + } + } + + /** ProceduralComponent that can serve as a master "control component" for procedural generation and building of components. */ + public abstract static class ControlComponent extends ProceduralComponent { + + public List queuedComponents = new ArrayList(); //List of all queued ProceduralComponents waiting to be built. Randomly iterated over until limits like component amt or dist are reached. + public ProceduralComponent lastComponent = this; //Last component to be built. Used as input for the random selection's checks for specific components. + + public ControlComponent() { } + + public ControlComponent(int componentType) { + super(componentType); + } + } + + /** Returns a new instance of this structureComponent, or null if not able to be placed.
Based on bounding box checks. */ + @FunctionalInterface + interface instantiateStructure { + ProceduralComponent findValidPlacement(List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType); + } + + + protected static class Weight { + + public final instantiateStructure lambda; //Read above + + public final int weight; //Weight of this component + public int instancesSpawned; //How many components spawned? + public int instanceLimit; //Limit on amount of components: -1 for no limit + + public Weight(int weight, int limit, instantiateStructure lambda) { + this.weight = weight; + this.instanceLimit = limit; + this.lambda = lambda; + } + + //Checks if another structure can be spawned based on input data + public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { + return this.instanceLimit < 0 || this.instanceLimit < this.instanceLimit; + } + + //Checks if another structure can be spawned at all (used to flag for removal from the list) + public boolean canSpawnMoreStructures() { + return this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit; + } + + } + +} diff --git a/src/main/java/com/hbm/world/worldgen/components/RuinFeatures.java b/src/main/java/com/hbm/world/worldgen/components/RuinFeatures.java index 47953d9da..6ba87e6fc 100644 --- a/src/main/java/com/hbm/world/worldgen/components/RuinFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/RuinFeatures.java @@ -10,7 +10,7 @@ import net.minecraft.world.gen.structure.StructureBoundingBox; public class RuinFeatures { - public static class NTMRuin1 extends Feature { + public static class NTMRuin1 extends Component { private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks(); @@ -82,7 +82,7 @@ public class RuinFeatures { } } - public static class NTMRuin2 extends Feature { + public static class NTMRuin2 extends Component { private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks(); @@ -145,7 +145,7 @@ public class RuinFeatures { } } - public static class NTMRuin3 extends Feature { + public static class NTMRuin3 extends Component { private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks(); @@ -202,7 +202,7 @@ public class RuinFeatures { } } - public static class NTMRuin4 extends Feature { + public static class NTMRuin4 extends Component { private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks(); From ac69b9fb9d629ff59cbbe5d2993841d161f05a02 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sat, 8 Oct 2022 23:20:37 -0700 Subject: [PATCH 11/30] UtilityCloset, WideIntersection, fixes --- src/main/java/com/hbm/lib/HbmWorld.java | 5 +- .../worldgen/components/BunkerComponents.java | 443 +++++++++++++++--- 2 files changed, 386 insertions(+), 62 deletions(-) diff --git a/src/main/java/com/hbm/lib/HbmWorld.java b/src/main/java/com/hbm/lib/HbmWorld.java index 4cf2e090d..794866e41 100644 --- a/src/main/java/com/hbm/lib/HbmWorld.java +++ b/src/main/java/com/hbm/lib/HbmWorld.java @@ -54,8 +54,9 @@ public class HbmWorld { //bunker MapGenStructureIO.func_143031_a(Atrium.class, "NTMBAtrium"); MapGenStructureIO.func_143031_a(Corridor.class, "NTMBCorridor"); - MapGenStructureIO.func_143031_a(Intersection.class, "NTMBIntersection"); MapGenStructureIO.func_143031_a(WideCorridor.class, "NTMBWideCorridor"); - + MapGenStructureIO.func_143031_a(Intersection.class, "NTMBIntersection"); + MapGenStructureIO.func_143031_a(WideIntersection.class, "NTMBWideIntersection"); + MapGenStructureIO.func_143031_a(UtilityCloset.class, "NTMBUtilityCloset"); } } diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index 67cef9a0f..658fcb904 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -7,6 +7,8 @@ import java.util.List; import java.util.Random; import com.hbm.blocks.ModBlocks; +import com.hbm.lib.HbmChestContents; +import com.hbm.world.worldgen.components.ProceduralComponents.ProceduralComponent; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; @@ -19,13 +21,22 @@ public class BunkerComponents extends ProceduralComponents { protected static final Weight[] weightArray = new Weight[] { new Weight(1, 50, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Corridor(type, rand, box, mode) : null; }), - new Weight(2, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); + new Weight(10, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 15, mode); //Corridor and Wide version + if(box.minY > 10 && StructureComponent.findIntersecting(list, box) == null) return new WideCorridor(type, rand, box, mode); + + box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Corridor(type, rand, box, mode) : null; }), - new Weight(1, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); + new Weight(2, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); //Intersection and wide ver. + if(box.minY > 10 && StructureComponent.findIntersecting(list, box) == null) return new WideIntersection(type, rand, box, mode); + + box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Intersection(type, rand, box, mode) : null; }), - new Weight(8, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 17, mode); - return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new WideCorridor(type, rand, box, mode) : null; }), - + new Weight(1, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 5, 4, mode); + return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new UtilityCloset(type, rand, box, mode) : null; }) { + public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { + return (this.instanceLimit < 0 || this.instanceLimit < this.instanceLimit) && componentAmount > 15; //prevent the gimping of necessary corridors + } + }, }; public static void prepareComponents() { @@ -37,6 +48,87 @@ public class BunkerComponents extends ProceduralComponents { } } + public static class UtilityCloset extends ProceduralComponent { + + boolean energy = false; //if false, this is a water closet. if true, this is an energy closet + boolean hasLoot = false; + + public UtilityCloset() { } + + public UtilityCloset(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType); + this.coordBaseMode = coordBaseMode; + this.boundingBox = box; + + energy = rand.nextBoolean(); + hasLoot = rand.nextInt(3) == 0; + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + if(isLiquidInStructureBoundingBox(world, box)) { + return false; + } else { + + fillWithAir(world, box, 1, 1, 1, 3, 3, 2); + //Floor + placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 2, 0, 0, box); + fillWithBlocks(world, box, 1, 0, 1, 3, 0, 2, ModBlocks.deco_titanium); + //Wall + fillWithBlocks(world, box, 0, 1, 1, 0, 1, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 1, 0, 2, 2, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 1, 0, 3, 2, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 1, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 1, 2, 0, box); + fillWithBlocks(world, box, 1, 3, 0, 3, 3, 0, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 3, 1, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 3, 2, 0, box); + fillWithBlocks(world, box, 4, 1, 1, 4, 1, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 4, 2, 1, 4, 2, 2, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 4, 3, 1, 4, 3, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 1, 3, 3, 1, 3, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 3, 3, 2, 3, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 3, 3, 3, 3, ModBlocks.reinforced_brick); + //Ceiling + fillWithBlocks(world, box, 1, 4, 1, 3, 4, 2, ModBlocks.reinforced_brick); + + int decoMetaS = getDecoMeta(2); + int decoMetaN = getDecoMeta(3); + int decoMetaW = getDecoMeta(4); + + if(energy) { + placeBlockAtCurrentPosition(world, ModBlocks.red_wire_coated, 0, 0, 3, 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.machine_transformer, 0, 1, 3, 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.red_connector, getDecoMeta(5), 2, 3, 2, box); + fillWithMetadataBlocks(world, box, 2, 1, 2, 2, 2, 2, ModBlocks.red_connector, decoMetaW); + fillWithMetadataBlocks(world, box,3, 1, 1, 3, 2, 1, ModBlocks.steel_wall, decoMetaS); + placeBlockAtCurrentPosition(world, ModBlocks.steel_roof, 0, 3, 3, 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.cable_diode, decoMetaS, 3, 1, 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.cable_diode, decoMetaW, 3, 2, 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_red_copper, 0, 3, 1, 3, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_red_copper, 0, 4, 2, 2, box); + + int cabinetMeta = getDecoModelMeta(0); + if(hasLoot) + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, cabinetMeta, 1, 1, 2, HbmChestContents.filingCabinet, 4); + } else { + fillWithMetadataBlocks(world, box, 1, 1, 2, 2, 1, 2, ModBlocks.deco_pipe_quad_green_rusted, getPillarMeta(4)); + placeBlockAtCurrentPosition(world, ModBlocks.machine_boiler_off, decoMetaN, 3, 1, 2, box); + fillWithBlocks(world, box, 3, 2, 2, 3, 3, 2, ModBlocks.deco_pipe_rusted); + + int cabinetMeta = getDecoModelMeta(3); + if(hasLoot) + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, cabinetMeta, 1, 1, 1, HbmChestContents.filingCabinet, 4); + } + + //Door + placeDoor(world, box, ModBlocks.door_bunker, 1, 2, 1, 0); + + return true; + } + } + } + public static class Atrium extends ControlComponent { public Atrium() { } @@ -94,12 +186,12 @@ public class BunkerComponents extends ProceduralComponents { StructureComponent component = getNextComponentNormal(original, components, rand, 1, 1); extendsPZ = component != null; - if(rand.nextInt(3) == 0) { + if(rand.nextInt(3) > 0) { StructureComponent componentN = getNextComponentNX(original, components, rand, 6, 1); expandsNX = componentN != null; } - if(rand.nextInt(3) == 0) { + if(rand.nextInt(3) > 0) { StructureComponent componentP = getNextComponentPX(original, components, rand, 6, 1); expandsPX = componentP != null; } @@ -171,7 +263,8 @@ public class BunkerComponents extends ProceduralComponents { } else placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 2, 4, i + 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 2, 4, i + 2, box); + if(extendsPZ || i < 12) + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 2, 4, i + 2, box); } return true; @@ -208,13 +301,13 @@ public class BunkerComponents extends ProceduralComponents { } } - if(rand.nextInt(3) == 0) { - StructureComponent componentN = getNextComponentNX(original, components, rand, 7, 1); + if(rand.nextInt(3) > 0) { + StructureComponent componentN = getNextComponentNX(original, components, rand, 6, 1); expandsNX = componentN != null; } - if(rand.nextInt(3) == 0) { - StructureComponent componentP = getNextComponentPX(original, components, rand, 7, 1); + if(rand.nextInt(3) > 0) { + StructureComponent componentP = getNextComponentPX(original, components, rand, 6, 1); expandsPX = componentP != null; } } @@ -226,8 +319,8 @@ public class BunkerComponents extends ProceduralComponents { return false; } else { int begin = bulkheadNZ ? 1 : 0; - int end = bulkheadPZ ? 15 : 16; //for the bulkhead - int endExtend = !extendsPZ ? 15 : 16; //for parts that would be cut off if it doesn't extend further + int end = bulkheadPZ ? 13 : 14; //for the bulkhead + int endExtend = !extendsPZ ? 13 : 14; //for parts that would be cut off if it doesn't extend further fillWithAir(world, box, 1, 1, begin, 7, 3, end); @@ -241,18 +334,18 @@ public class BunkerComponents extends ProceduralComponents { int pillarMeta = getPillarMeta(8); //Walls if(expandsNX) { - fillWithBlocks(world, box, 0, 1, begin, 0, 1, 5, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, begin, 0, 2, 5, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, begin, 0, 3, 5, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 1, 11, 0, 1, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 11, 0, 2, end, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 11, 0, 3, end, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 1, begin, 0, 1, 4, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, begin, 0, 2, 4, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, begin, 0, 3, 4, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 1, 10, 0, 1, end, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 10, 0, 2, end, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 10, 0, 3, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 0, 7, 0, 0, 9, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 0, 1, 6, 0, 3, 6, ModBlocks.concrete_pillar); - fillWithBlocks(world, box, 0, 1, 10, 0, 3, 10, ModBlocks.concrete_pillar); - fillWithMetadataBlocks(world, box, 0, 4, 7, 0, 4, 9, ModBlocks.concrete_pillar, pillarMeta); - fillWithAir(world, box, 0, 1, 7, 0, 3, 9); + fillWithBlocks(world, box, 0, 0, 6, 0, 0, 8, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 0, 1, 5, 0, 3, 5, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 0, 1, 9, 0, 3, 9, ModBlocks.concrete_pillar); + fillWithMetadataBlocks(world, box, 0, 4, 6, 0, 4, 8, ModBlocks.concrete_pillar, pillarMeta); + fillWithAir(world, box, 0, 1, 6, 0, 3, 8); } else { fillWithBlocks(world, box, 0, 1, begin, 0, 1, end, ModBlocks.reinforced_brick); @@ -261,18 +354,18 @@ public class BunkerComponents extends ProceduralComponents { } if(expandsPX) { - fillWithBlocks(world, box, 8, 1, begin, 8, 1, 5, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 2, begin, 8, 2, 5, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 8, 3, begin, 8, 3, 5, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 1, 11, 8, 1, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 2, 11, 8, 2, end, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 8, 3, 11, 8, 3, end, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 1, begin, 8, 1, 4, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 2, begin, 8, 2, 4, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 8, 3, begin, 8, 3, 4, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 1, 10, 8, 1, end, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 2, 10, 8, 2, end, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 8, 3, 10, 8, 3, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 0, 7, 8, 0, 9, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 8, 1, 6, 8, 3, 6, ModBlocks.concrete_pillar); - fillWithBlocks(world, box, 8, 1, 10, 8, 3, 10, ModBlocks.concrete_pillar); - fillWithMetadataBlocks(world, box, 8, 4, 7, 8, 4, 9, ModBlocks.concrete_pillar, pillarMeta); - fillWithAir(world, box, 8, 1, 7, 8, 3, 9); + fillWithBlocks(world, box, 8, 0, 6, 8, 0, 8, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 8, 1, 5, 8, 3, 5, ModBlocks.concrete_pillar); + fillWithBlocks(world, box, 8, 1, 9, 8, 3, 9, ModBlocks.concrete_pillar); + fillWithMetadataBlocks(world, box, 8, 4, 6, 8, 4, 8, ModBlocks.concrete_pillar, pillarMeta); + fillWithAir(world, box, 8, 1, 6, 8, 3, 8); } else { fillWithBlocks(world, box, 8, 1, begin, 8, 1, end, ModBlocks.reinforced_brick); @@ -291,19 +384,19 @@ public class BunkerComponents extends ProceduralComponents { } if(bulkheadPZ) { - fillWithBlocks(world, box, 1, 1, 16, 2, 1, 16, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 16, 2, 2, 16, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 16, 2, 3, 16, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 1, 16, 7, 1, 16, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 2, 16, 7, 2, 16, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 6, 3, 16, 7, 3, 16, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 1, 14, 2, 1, 14, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 14, 2, 2, 14, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 14, 2, 3, 14, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 1, 14, 7, 1, 14, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 2, 14, 7, 2, 14, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 6, 3, 14, 7, 3, 14, ModBlocks.reinforced_brick); if(!extendsPZ) { - fillWithBlocks(world, box, 3, 1, 16, 5, 1, 16, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 3, 2, 16, 5, 2, 16, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 3, 3, 16, 5, 3, 16, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 3, 1, 14, 5, 1, 14, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 3, 2, 14, 5, 2, 14, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 3, 3, 14, 5, 3, 14, ModBlocks.reinforced_brick); } else - fillWithAir(world, box, 3, 1, 16, 5, 3, 16); + fillWithAir(world, box, 3, 1, 14, 5, 3, 14); } //Ceiling @@ -315,17 +408,18 @@ public class BunkerComponents extends ProceduralComponents { fillWithBlocks(world, box, 7, 4, begin, 7, 4, end, ModBlocks.reinforced_brick); for(int i = 0; i <= 12; i += 3) { - fillWithMetadataBlocks(world, box, 4, 4, i, 4, 4, i + 1, ModBlocks.concrete_pillar, pillarMeta); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 4, 4, i, box); if(rand.nextInt(3) == 0) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_on, 0, 4, 4, i + 2, box); - placeBlockAtCurrentPosition(world, Blocks.redstone_block, 0, 4, 5, i + 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_on, 0, 4, 4, i + 1, box); + placeBlockAtCurrentPosition(world, Blocks.redstone_block, 0, 4, 5, i + 1, box); } else - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 4, 4, i + 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 4, 4, i + 1, box); + + if(extendsPZ || i < 12) + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 4, 4, i + 2, box); } - - fillWithMetadataBlocks(world, box, 4, 4, 15, 4, 4, endExtend, ModBlocks.concrete_pillar, pillarMeta); - + return true; } } @@ -379,10 +473,8 @@ public class BunkerComponents extends ProceduralComponents { @Override public void buildComponent(ControlComponent original, List components, Random rand) { - if(rand.nextInt(3) != 0) { - StructureComponent component = getNextComponentNormal(original, components, rand, 1, 1); - opensPZ = component != null; - } + StructureComponent component = getNextComponentNormal(original, components, rand, 1, 1); + opensPZ = component != null; StructureComponent componentN = getNextComponentNX(original, components, rand, 1, 1); opensNX = componentN != null; @@ -507,17 +599,248 @@ public class BunkerComponents extends ProceduralComponents { public static class WideIntersection extends Intersection implements Wide { + boolean bulkheadNZ = true; + boolean bulkheadPZ = true; + boolean bulkheadNX = true; + boolean bulkheadPX = true; + public WideIntersection() { } public WideIntersection(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { super(componentType, rand, box, coordBaseMode); + System.out.println(coordBaseMode); + } + + protected void func_143012_a(NBTTagCompound data) { + super.func_143012_a(data); + data.setBoolean("bulkheadNZ", bulkheadNZ); + data.setBoolean("bulkheadPZ", bulkheadPZ); + data.setBoolean("opensNX", opensNX); + data.setBoolean("opensPX", opensPX); + } + + protected void func_143011_b(NBTTagCompound data) { + super.func_143011_b(data); + bulkheadNZ = data.getBoolean("bulkheadNZ"); + bulkheadPZ = data.getBoolean("bulkheadPZ"); + bulkheadNX = data.getBoolean("bulkheadNX"); + bulkheadPX = data.getBoolean("bulkheadPX"); + } + + @Override + public void buildComponent(ControlComponent original, List components, Random rand) { + StructureComponent component = getNextComponentNormal(original, components, rand, 3, 1); + opensPZ = component != null; + + if(component instanceof Wide) { + bulkheadPZ = false; + + if(component instanceof WideCorridor) { + WideCorridor corridor = (WideCorridor) component; + corridor.bulkheadNZ = rand.nextInt(4) == 0; + } + } + + StructureComponent componentN = getNextComponentNX(original, components, rand, 3, 1); + opensNX = componentN != null; + + if(componentN instanceof Wide) { + bulkheadNX = false; + + if(componentN instanceof WideCorridor) { + WideCorridor corridor = (WideCorridor) componentN; + corridor.bulkheadNZ = rand.nextInt(4) == 0; + } + } + + StructureComponent componentP = getNextComponentPX(original, components, rand, 3, 1); + opensPX = componentP != null; + + if(componentP instanceof Wide) { + bulkheadPX = false; + + if(componentP instanceof WideCorridor) { + WideCorridor corridor = (WideCorridor) componentP; + corridor.bulkheadNZ = rand.nextInt(4) == 0; + } + } } @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - return true; + if(isLiquidInStructureBoundingBox(world, boundingBox)) { + return false; + } else { + + int pillarMetaNS = getPillarMeta(8); + int pillarMetaWE = getPillarMeta(4); + + fillWithAir(world, box, 1, 1, 0, 7, 3, 7); + //Floor + fillWithBlocks(world, box, 3, 0, 0, 5, 0, 1, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 2, 0, 0, 2, 0, 6, ModBlocks.tile_lab); + fillWithBlocks(world, box, 3, 0, 2, 5, 0, 2, ModBlocks.tile_lab); + fillWithBlocks(world, box, 3, 0, 6, 5, 0, 6, ModBlocks.tile_lab); + fillWithBlocks(world, box, 6, 0, 0, 6, 0, 6, ModBlocks.tile_lab); + fillWithBlocks(world, box, 3, 0, 3, 5, 0, 5, ModBlocks.deco_titanium); + //Wall + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 1, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 0, 2, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 3, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 1, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 8, 2, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 3, 0, box); + //Ceiling + fillWithBlocks(world, box, 1, 4, 0, 1, 4, 1, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 2, 4, 0, 2, 4, 1, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 3, 4, 0, 3, 4, 3, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 4, 4, 0, 4, 4, 3, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 5, 4, 0, 5, 4, 3, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 6, 4, 0, 6, 4, 1, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 7, 4, 0, 7, 4, 1, ModBlocks.reinforced_brick); + placeLamp(world, rand, 2, 4, 2, box); + placeLamp(world, rand, 2, 4, 6, box); + placeLamp(world, rand, 4, 4, 4, box); + placeLamp(world, rand, 6, 4, 2, box); + placeLamp(world, rand, 6, 4, 6, box); + + if(bulkheadNZ) { + fillWithBlocks(world, box, 1, 1, 0, 2, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 0, 2, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 0, 2, 3, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 1, 0, 7, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 2, 0, 7, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 6, 3, 0, 7, 3, 0, ModBlocks.reinforced_brick); + fillWithAir(world, box, 3, 1, 0, 5, 3, 0); + } else + fillWithAir(world, box, 1, 1, 0, 7, 3, 0); + + if(opensPZ) { + fillWithBlocks(world, box, 1, 0, 7, 1, 0, 8, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 2, 0, 7, 2, 0, 8, ModBlocks.tile_lab); + fillWithBlocks(world, box, 3, 0, 7, 5, 0, 8, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 6, 0, 7, 6, 0, 8, ModBlocks.tile_lab); + fillWithBlocks(world, box, 7, 0, 7, 7, 0, 8, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 1, 4, 7, 1, 4, 8, ModBlocks.reinforced_brick); //Ceiling + fillWithMetadataBlocks(world, box, 2, 4, 7, 2, 4, 8, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 3, 4, 5, 3, 4, 8, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 4, 4, 5, 4, 4, 8, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 5, 4, 5, 5, 4, 8, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 6, 4, 7, 6, 4, 8, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 7, 4, 7, 7, 4, 8, ModBlocks.reinforced_brick); + + if(bulkheadPZ) { + fillWithBlocks(world, box, 1, 1, 8, 2, 1, 8, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 8, 2, 2, 8, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 8, 2, 3, 8, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 1, 8, 7, 1, 8, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 2, 8, 7, 2, 8, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 6, 3, 8, 7, 3, 8, ModBlocks.reinforced_brick); + fillWithAir(world, box, 3, 1, 8, 5, 3, 8); + } else + fillWithAir(world, box, 1, 1, 8, 7, 3, 8); + } else { + fillWithBlocks(world, box, 1, 0, 7, 7, 0, 7, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 1, 1, 8, 7, 1, 8, ModBlocks.reinforced_brick); //Wall + fillWithBlocks(world, box, 1, 2, 8, 7, 2, 8, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 8, 7, 3, 8, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 3, 4, 5, 5, 4, 6, ModBlocks.reinforced_brick); //Ceiling + fillWithBlocks(world, box, 1, 4, 7, 7, 4, 7, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 4, 5, box); + } + + if(opensNX) { + placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 1, 0, 0, box); //Floor + fillWithBlocks(world, box, 0, 0, 1, 1, 0, 1, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 0, 0, 2, 1, 0, 2, ModBlocks.tile_lab); + fillWithBlocks(world, box, 0, 0, 3, 1, 0, 5, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 0, 0, 6, 1, 0, 6, ModBlocks.tile_lab); + placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 0, 0, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 1, box); //Ceiling + fillWithMetadataBlocks(world, box, 0, 4, 2, 1, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); + fillWithBlocks(world, box, 0, 4, 3, 2, 4, 3, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 0, 4, 4, 3, 4, 4, ModBlocks.concrete_pillar, pillarMetaWE); + fillWithBlocks(world, box, 0, 4, 5, 2, 4, 5, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 0, 4, 6, 1, 4, 6, ModBlocks.concrete_pillar, pillarMetaWE); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 7, box); + + if(bulkheadNX) { + fillWithBlocks(world, box, 0, 1, 1, 0, 1, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 1, 0, 2, 2, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 1, 0, 3, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 1, 6, 0, 1, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 6, 0, 2, 7, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 6, 0, 3, 7, ModBlocks.reinforced_brick); + fillWithAir(world, box, 0, 1, 3, 0, 3, 5); + } else + fillWithAir(world, box, 0, 1, 1, 0, 3, 7); + } else { + fillWithBlocks(world, box, 1, 0, 0, 1, 0, 6, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 0, 1, 1, 0, 1, 7, ModBlocks.reinforced_brick); //Wall + fillWithBlocks(world, box, 0, 2, 1, 0, 2, 7, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 1, 0, 3, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 4, 2, 1, 4, 6, ModBlocks.reinforced_brick); //Ceiling + fillWithBlocks(world, box, 2, 4, 3, 2, 4, 5, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 3, 4, 4, box); + } + + if(opensPX) { + placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 7, 0, 0, box); //Floor + fillWithBlocks(world, box, 7, 0, 1, 8, 0, 1, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 7, 0, 2, 8, 0, 2, ModBlocks.tile_lab); + fillWithBlocks(world, box, 7, 0, 3, 8, 0, 5, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 7, 0, 6, 8, 0, 6, ModBlocks.tile_lab); + placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 8, 0, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 4, 1, box); //Ceiling + fillWithMetadataBlocks(world, box, 7, 4, 2, 8, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); + fillWithBlocks(world, box, 6, 4, 3, 8, 4, 3, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 5, 4, 4, 8, 4, 4, ModBlocks.concrete_pillar, pillarMetaWE); + fillWithBlocks(world, box, 6, 4, 5, 8, 4, 5, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 7, 4, 6, 8, 4, 6, ModBlocks.concrete_pillar, pillarMetaWE); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 4, 7, box); + + if(bulkheadPX) { + fillWithBlocks(world, box, 8, 1, 1, 8, 1, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 2, 1, 8, 2, 2, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 8, 3, 1, 8, 3, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 1, 6, 8, 1, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 2, 6, 8, 2, 7, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 8, 3, 6, 8, 3, 7, ModBlocks.reinforced_brick); + fillWithAir(world, box, 8, 1, 3, 8, 3, 5); + } else + fillWithAir(world, box, 8, 1, 1, 8, 3, 7); + } else { + fillWithBlocks(world, box, 7, 0, 0, 7, 0, 6, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 8, 1, 1, 8, 1, 7, ModBlocks.reinforced_brick); //Wall + fillWithBlocks(world, box, 8, 2, 1, 8, 2, 7, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 8, 3, 1, 8, 3, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 4, 3, 6, 4, 5, ModBlocks.reinforced_brick); //Ceiling + fillWithBlocks(world, box, 7, 4, 2, 7, 4, 6, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 5, 4, 4, box); + } + //Wall corners + //if(opensNX || opensPZ) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 1, 8, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 8, 2, 8, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 3, 8, box); + //} + + //if(opensPX || opensPZ) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 1, 8, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 0, 2, 8, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 3, 8, box); + //} + + return true; + } + } + + protected void placeLamp(World world, Random rand, int featureX, int featureY, int featureZ, StructureBoundingBox box) { + if(rand.nextInt(3) == 0) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_on, 0, featureX, featureY, featureZ, box); + placeBlockAtCurrentPosition(world, Blocks.redstone_block, 0, featureX, featureY + 1, featureZ, box); + } else + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, featureX, featureY, featureZ, box); } } - - } \ No newline at end of file From 86e23dc89db581b5dc19e63df42aa1037c3d4bb3 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sun, 9 Oct 2022 22:13:44 -0700 Subject: [PATCH 12/30] fixes, cobwebs, swampification, connector cables --- .../com/hbm/world/worldgen/MapGenBunker.java | 1 + .../worldgen/components/BunkerComponents.java | 378 +++++++++++++----- .../world/worldgen/components/Component.java | 38 ++ 3 files changed, 319 insertions(+), 98 deletions(-) diff --git a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java index 669bf999d..146e69547 100644 --- a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java +++ b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java @@ -42,6 +42,7 @@ public class MapGenBunker extends MapGenStructure { Atrium atrium = new Atrium(0, rand, (chunkX << 4) + 8, (chunkZ << 4) + 8); this.components.add(atrium); atrium.buildComponent(atrium, components, rand); + atrium.underwater = true;//rand.nextInt(2) == 0; List list = atrium.queuedComponents; while(!list.isEmpty()) { diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index 658fcb904..9685a0a2a 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -1,6 +1,5 @@ package com.hbm.world.worldgen.components; -import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -8,19 +7,22 @@ import java.util.Random; import com.hbm.blocks.ModBlocks; import com.hbm.lib.HbmChestContents; +import com.hbm.tileentity.network.TileEntityPylonBase; import com.hbm.world.worldgen.components.ProceduralComponents.ProceduralComponent; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureComponent; +import net.minecraftforge.common.util.ForgeDirection; public class BunkerComponents extends ProceduralComponents { protected static final Weight[] weightArray = new Weight[] { - new Weight(1, 50, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); - return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Corridor(type, rand, box, mode) : null; }), new Weight(10, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 15, mode); //Corridor and Wide version if(box.minY > 10 && StructureComponent.findIntersecting(list, box) == null) return new WideCorridor(type, rand, box, mode); @@ -31,10 +33,10 @@ public class BunkerComponents extends ProceduralComponents { box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Intersection(type, rand, box, mode) : null; }), - new Weight(1, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 5, 4, mode); + new Weight(2, 5, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 5, 4, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new UtilityCloset(type, rand, box, mode) : null; }) { public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { - return (this.instanceLimit < 0 || this.instanceLimit < this.instanceLimit) && componentAmount > 15; //prevent the gimping of necessary corridors + return (this.instanceLimit < 0 || this.instanceLimit < this.instanceLimit) && componentAmount > 10; //prevent the gimping of necessary corridors } }, }; @@ -48,7 +50,124 @@ public class BunkerComponents extends ProceduralComponents { } } - public static class UtilityCloset extends ProceduralComponent { + public static abstract class Bunker extends ProceduralComponent { + + boolean underwater = false; + + public Bunker() { } + + public Bunker(int componentType) { + super(componentType); + } + + protected void checkModifiers(ControlComponent original) { + if(original instanceof Atrium) + this.underwater = ((Atrium) original).underwater; + } + + protected void placeLamp(World world, StructureBoundingBox box, Random rand, int featureX, int featureY, int featureZ) { + if(rand.nextInt(underwater ? 5 : 3) == 0) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_on, 0, featureX, featureY, featureZ, box); + placeBlockAtCurrentPosition(world, Blocks.redstone_block, 0, featureX, featureY + 1, featureZ, box); + } else + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, featureX, featureY, featureZ, box); + } + + protected void fillWithWater(World world, StructureBoundingBox box, Random rand, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, int waterLevel) { + + if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) + return; + + waterLevel += getYWithOffset(minY) - 1; + + for(int x = minX; x <= maxX; x++) { + + for(int z = minZ; z <= maxZ; z++) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + + if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { + for(int y = minY; y <= maxY; y++) { + int posY = getYWithOffset(y); + Block genTarget = world.getBlock(posX, posY, posZ); + + if(!genTarget.isAir(world, posX, posY, posZ)) + continue; + + if(posY <= waterLevel && world.getBlock(posX, posY - 1, posZ).getMaterial() != Material.air) { + world.setBlock(posX, posY, posZ, Blocks.water, 0, 2); + continue; + } + + boolean canGenFluid = true; + boolean canGenPlant = false; + int canGenVine = -1; + + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + Block neighbor = world.getBlock(posX + dir.offsetX, posY + dir.offsetY, posZ + dir.offsetZ); + boolean isSolid = neighbor.isNormalCube(); + + switch(dir) { + case DOWN: if(neighbor == Blocks.water) canGenPlant = true; + if(!isSolid && neighbor != Blocks.water) canGenFluid = false; + break; + case UP: if(neighbor.getMaterial() != Material.air) canGenFluid = false; + if(isSolid) canGenVine = 0; + break; + case NORTH: if(isSolid) canGenVine |= 4; + if(!isSolid && neighbor != Blocks.water) canGenFluid = false; + break; + case SOUTH: if(isSolid) canGenVine |= 1; + if(!isSolid && neighbor != Blocks.water) canGenFluid = false; + break; + case EAST: if(isSolid) canGenVine |= 8; + if(!isSolid && neighbor != Blocks.water) canGenFluid = false; + break; + case WEST: if(isSolid) canGenVine |= 2; + if(!isSolid && neighbor != Blocks.water) canGenFluid = false; + break; + default: //shut the fuck up! + if(!isSolid && neighbor != Blocks.water) canGenFluid = false; + break; + } + } + + if(canGenFluid) + world.setBlock(posX, posY, posZ, Blocks.water); + else { + if(canGenVine != -1) { + if(rand.nextInt(3) == 0) + canGenVine |= 1 << rand.nextInt(4); + + world.setBlock(posX, posY, posZ, Blocks.vine, canGenVine, 2); + + if(canGenVine > 0) { + int i = posY; + while(world.getBlock(posX, --i, posZ).getMaterial() == Material.air) + world.setBlock(posX, i, posZ, Blocks.vine, canGenVine, 2); + } + } + + if(canGenPlant) { + /*Block belowNeighbor = world.getBlock(posX, posY - 2, posZ); + int bound = !belowNeighbor.isNormalCube() ? 10 : 10; //reeds + int value = rand.nextInt(bound); + + if(value <= 0) {*/ + int rY = posY + rand.nextInt(10) - rand.nextInt(10); + if(rY == posY) + world.setBlock(posX, posY, posZ, Blocks.waterlily, 0, 2); + //} + } + } + } + } + } + } + } + } + + public static class UtilityCloset extends Bunker { boolean energy = false; //if false, this is a water closet. if true, this is an energy closet boolean hasLoot = false; @@ -66,7 +185,7 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(isLiquidInStructureBoundingBox(world, box)) { + if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; } else { @@ -101,6 +220,10 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, ModBlocks.machine_transformer, 0, 1, 3, 2, box); placeBlockAtCurrentPosition(world, ModBlocks.red_connector, getDecoMeta(5), 2, 3, 2, box); fillWithMetadataBlocks(world, box, 2, 1, 2, 2, 2, 2, ModBlocks.red_connector, decoMetaW); + + makeConnection(world, 2, 3, 2, 2, 2, 2); + makeConnection(world, 2, 2, 2, 2, 1, 2); + fillWithMetadataBlocks(world, box,3, 1, 1, 3, 2, 1, ModBlocks.steel_wall, decoMetaS); placeBlockAtCurrentPosition(world, ModBlocks.steel_roof, 0, 3, 3, 2, box); placeBlockAtCurrentPosition(world, ModBlocks.cable_diode, decoMetaS, 3, 1, 2, box); @@ -124,13 +247,36 @@ public class BunkerComponents extends ProceduralComponents { //Door placeDoor(world, box, ModBlocks.door_bunker, 1, 2, 1, 0); + fillWithCobwebs(world, box, rand, 1, 1, 1, 3, 3, 2); + return true; } } + + protected void makeConnection(World world, int x1, int y1, int z1, int x2, int y2, int z2) { + int posX1 = getXWithOffset(x1, z1); + int posY1 = getYWithOffset(y1); + int posZ1 = getZWithOffset(x1, z1); + + int posX2 = getXWithOffset(x2, z2); + int posY2 = getYWithOffset(y2); + int posZ2 = getZWithOffset(x2, z2); + + TileEntity tile1 = world.getTileEntity(posX1, posY1, posZ1); + TileEntity tile2 = world.getTileEntity(posX2, posY2, posZ2); + if(tile1 instanceof TileEntityPylonBase && tile2 instanceof TileEntityPylonBase) { + TileEntityPylonBase pylon1 = (TileEntityPylonBase)tile1; + pylon1.addConnection(posX2, posY2, posZ2); + TileEntityPylonBase pylon2 = (TileEntityPylonBase)tile2; + pylon2.addConnection(posX1, posY1, posZ1); + } + } } public static class Atrium extends ControlComponent { + public boolean underwater = false; + public Atrium() { } public Atrium(int componentType, Random rand, int posX, int posZ) { //TODO: change basically everything about this component @@ -141,9 +287,15 @@ public class BunkerComponents extends ProceduralComponents { @Override public void buildComponent(ControlComponent original, List components, Random rand) { - getNextComponentNormal(original, components, rand, 3, 1); - getNextComponentNX(original, components, rand, 3, 1); - getNextComponentPX(original, components, rand, 3, 1); + + StructureComponent component = getNextComponentNormal(original, components, rand, 3, 1); + System.out.println("ComponentPZ:" + component); + + StructureComponent componentN = getNextComponentNX(original, components, rand, 3, 1); + System.out.println("ComponentNX:" + componentN); + + StructureComponent componentP = getNextComponentPX(original, components, rand, 3, 1); + System.out.println("ComponentPX:" + componentP); } @Override @@ -152,7 +304,7 @@ public class BunkerComponents extends ProceduralComponents { } } - public static class Corridor extends ProceduralComponent { + public static class Corridor extends Bunker { boolean expandsNX = false; boolean expandsPX = false; @@ -183,6 +335,8 @@ public class BunkerComponents extends ProceduralComponents { @Override public void buildComponent(ControlComponent original, List components, Random rand) { + checkModifiers(original); + StructureComponent component = getNextComponentNormal(original, components, rand, 1, 1); extendsPZ = component != null; @@ -200,7 +354,7 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(isLiquidInStructureBoundingBox(world, boundingBox)) { + if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; } else { int end = extendsPZ ? 14 : 13; @@ -256,17 +410,19 @@ public class BunkerComponents extends ProceduralComponents { int pillarMeta = getPillarMeta(8); for(int i = 0; i <= 12; i += 3) { placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 2, 4, i, box); - - if(rand.nextInt(3) == 0) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_on, 0, 2, 4, i + 1, box); - placeBlockAtCurrentPosition(world, Blocks.redstone_block, 0, 2, 5, i + 1, box); - } else - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 2, 4, i + 1, box); + placeLamp(world, box, rand, 2, 4, i + 1); if(extendsPZ || i < 12) placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 2, 4, i + 2, box); } + if(underwater) { + fillWithWater(world, box, rand, 1, 1, 0, 3, 3, end, 1); + if(expandsNX) fillWithWater(world, box, rand, 0, 1, 6, 0, 3, 8, 1); + if(expandsPX) fillWithWater(world, box, rand, 4, 1, 6, 4, 3, 8, 1); + } else + fillWithCobwebs(world, box, rand, expandsNX ? 0 : 1, 1, 0, expandsPX ? 4 : 3, 3, end); + return true; } } @@ -289,6 +445,8 @@ public class BunkerComponents extends ProceduralComponents { @Override public void buildComponent(ControlComponent original, List components, Random rand) { + checkModifiers(original); + StructureComponent component = getNextComponentNormal(original, components, rand, 3, 1); extendsPZ = component != null; @@ -315,7 +473,7 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(isLiquidInStructureBoundingBox(world, boundingBox)) { + if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; } else { int begin = bulkheadNZ ? 1 : 0; @@ -409,16 +567,18 @@ public class BunkerComponents extends ProceduralComponents { for(int i = 0; i <= 12; i += 3) { placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 4, 4, i, box); - - if(rand.nextInt(3) == 0) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_on, 0, 4, 4, i + 1, box); - placeBlockAtCurrentPosition(world, Blocks.redstone_block, 0, 4, 5, i + 1, box); - } else - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 4, 4, i + 1, box); + placeLamp(world, box, rand, 4, 4, i + 1); if(extendsPZ || i < 12) placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 4, 4, i + 2, box); } + + if(underwater) { + fillWithWater(world, box, rand, 1, 1, 0, 7, 3, endExtend, 1); + if(expandsNX) fillWithWater(world, box, rand, 0, 1, 6, 0, 3, 8, 1); + if(expandsPX) fillWithWater(world, box, rand, 8, 1, 6, 8, 3, 8, 1); + } else + fillWithCobwebs(world, box, rand, expandsNX ? 0 : 1, 1, 0, expandsPX ? 8 : 7, 3, endExtend); return true; } @@ -456,7 +616,7 @@ public class BunkerComponents extends ProceduralComponents { } } - public static class Intersection extends ProceduralComponent { + public static class Intersection extends Bunker { boolean opensNX = false; boolean opensPX = false; @@ -473,6 +633,8 @@ public class BunkerComponents extends ProceduralComponents { @Override public void buildComponent(ControlComponent original, List components, Random rand) { + checkModifiers(original); + StructureComponent component = getNextComponentNormal(original, components, rand, 1, 1); opensPZ = component != null; @@ -499,7 +661,7 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(isLiquidInStructureBoundingBox(world, boundingBox)) { + if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; } else { @@ -514,11 +676,7 @@ public class BunkerComponents extends ProceduralComponents { fillWithMetadataBlocks(world, box, 2, 4, 0, 2, 4, 1, ModBlocks.concrete_pillar, pillarMetaNS); fillWithBlocks(world, box, 1, 4, 0, 1, 4, 1, ModBlocks.reinforced_brick); - if(rand.nextInt(3) == 0) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_on, 0, 2, 4, 2, box); - placeBlockAtCurrentPosition(world, Blocks.redstone_block, 0, 2, 5, 2, box); - } else - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, 2, 4, 2, box); + placeLamp(world, box, rand, 2, 4, 2); if(opensPZ) { fillWithBlocks(world, box, 1, 0, 4, 3, 0, 4, ModBlocks.deco_titanium); //Floor @@ -592,6 +750,13 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 3, 4, box); } + if(underwater) { + fillWithWater(world, box, rand, 1, 1, 0, 3, 3, opensPX ? 4 : 3, 1); + if(opensNX) fillWithWater(world, box, rand, 0, 1, 1, 0, 3, 3, 1); + if(opensPX) fillWithWater(world, box, rand, 4, 1, 1, 4, 3, 3, 1); + } else + fillWithCobwebs(world, box, rand, opensNX ? 0 : 1, 1, 0, opensPX ? 4 : 3, 3, opensPZ ? 4 : 3); + return true; } } @@ -608,7 +773,6 @@ public class BunkerComponents extends ProceduralComponents { public WideIntersection(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { super(componentType, rand, box, coordBaseMode); - System.out.println(coordBaseMode); } protected void func_143012_a(NBTTagCompound data) { @@ -629,6 +793,8 @@ public class BunkerComponents extends ProceduralComponents { @Override public void buildComponent(ControlComponent original, List components, Random rand) { + checkModifiers(original); + StructureComponent component = getNextComponentNormal(original, components, rand, 3, 1); opensPZ = component != null; @@ -668,41 +834,51 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(isLiquidInStructureBoundingBox(world, boundingBox)) { + if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; } else { + int start = bulkheadNZ ? 1 : 0; + int end = bulkheadPZ ? 7 : 8; + int right = bulkheadNX ? 1 : 0; + int left = bulkheadPX ? 7 : 8; + int pillarMetaNS = getPillarMeta(8); int pillarMetaWE = getPillarMeta(4); - fillWithAir(world, box, 1, 1, 0, 7, 3, 7); + fillWithAir(world, box, 1, 1, 0, 7, 3, end); //Floor fillWithBlocks(world, box, 3, 0, 0, 5, 0, 1, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 2, 0, 0, 2, 0, 6, ModBlocks.tile_lab); + fillWithBlocks(world, box, 2, 0, start, 2, 0, 6, ModBlocks.tile_lab); fillWithBlocks(world, box, 3, 0, 2, 5, 0, 2, ModBlocks.tile_lab); fillWithBlocks(world, box, 3, 0, 6, 5, 0, 6, ModBlocks.tile_lab); - fillWithBlocks(world, box, 6, 0, 0, 6, 0, 6, ModBlocks.tile_lab); + fillWithBlocks(world, box, 6, 0, start, 6, 0, 6, ModBlocks.tile_lab); fillWithBlocks(world, box, 3, 0, 3, 5, 0, 5, ModBlocks.deco_titanium); //Wall - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 1, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 0, 2, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 3, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 1, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 8, 2, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 3, 0, box); + if(!bulkheadNZ || (opensNX && !bulkheadNX)) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 1, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 0, 2, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 3, 0, box); + } + + if(!bulkheadNZ || (opensPX && !bulkheadPX)) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 1, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 8, 2, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 3, 0, box); + } //Ceiling - fillWithBlocks(world, box, 1, 4, 0, 1, 4, 1, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 2, 4, 0, 2, 4, 1, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 1, 4, start, 1, 4, 1, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 2, 4, start, 2, 4, 1, ModBlocks.concrete_pillar, pillarMetaNS); fillWithBlocks(world, box, 3, 4, 0, 3, 4, 3, ModBlocks.reinforced_brick); fillWithMetadataBlocks(world, box, 4, 4, 0, 4, 4, 3, ModBlocks.concrete_pillar, pillarMetaNS); fillWithBlocks(world, box, 5, 4, 0, 5, 4, 3, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 6, 4, 0, 6, 4, 1, ModBlocks.concrete_pillar, pillarMetaNS); - fillWithBlocks(world, box, 7, 4, 0, 7, 4, 1, ModBlocks.reinforced_brick); - placeLamp(world, rand, 2, 4, 2, box); - placeLamp(world, rand, 2, 4, 6, box); - placeLamp(world, rand, 4, 4, 4, box); - placeLamp(world, rand, 6, 4, 2, box); - placeLamp(world, rand, 6, 4, 6, box); + fillWithMetadataBlocks(world, box, 6, 4, start, 6, 4, 1, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 7, 4, start, 7, 4, 1, ModBlocks.reinforced_brick); + placeLamp(world, box, rand, 2, 4, 2); + placeLamp(world, box, rand, 2, 4, 6); + placeLamp(world, box, rand, 4, 4, 4); + placeLamp(world, box, rand, 6, 4, 2); + placeLamp(world, box, rand, 6, 4, 6); if(bulkheadNZ) { fillWithBlocks(world, box, 1, 1, 0, 2, 1, 0, ModBlocks.reinforced_brick); @@ -716,18 +892,18 @@ public class BunkerComponents extends ProceduralComponents { fillWithAir(world, box, 1, 1, 0, 7, 3, 0); if(opensPZ) { - fillWithBlocks(world, box, 1, 0, 7, 1, 0, 8, ModBlocks.deco_titanium); //Floor - fillWithBlocks(world, box, 2, 0, 7, 2, 0, 8, ModBlocks.tile_lab); + fillWithBlocks(world, box, 1, 0, 7, 1, 0, end, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 2, 0, 7, 2, 0, end, ModBlocks.tile_lab); fillWithBlocks(world, box, 3, 0, 7, 5, 0, 8, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 6, 0, 7, 6, 0, 8, ModBlocks.tile_lab); - fillWithBlocks(world, box, 7, 0, 7, 7, 0, 8, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 1, 4, 7, 1, 4, 8, ModBlocks.reinforced_brick); //Ceiling - fillWithMetadataBlocks(world, box, 2, 4, 7, 2, 4, 8, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 6, 0, 7, 6, 0, end, ModBlocks.tile_lab); + fillWithBlocks(world, box, 7, 0, 7, 7, 0, end, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 1, 4, 7, 1, 4, end, ModBlocks.reinforced_brick); //Ceiling + fillWithMetadataBlocks(world, box, 2, 4, 7, 2, 4, end, ModBlocks.concrete_pillar, pillarMetaNS); fillWithBlocks(world, box, 3, 4, 5, 3, 4, 8, ModBlocks.reinforced_brick); fillWithMetadataBlocks(world, box, 4, 4, 5, 4, 4, 8, ModBlocks.concrete_pillar, pillarMetaNS); fillWithBlocks(world, box, 5, 4, 5, 5, 4, 8, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 6, 4, 7, 6, 4, 8, ModBlocks.concrete_pillar, pillarMetaNS); - fillWithBlocks(world, box, 7, 4, 7, 7, 4, 8, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 6, 4, 7, 6, 4, end, ModBlocks.concrete_pillar, pillarMetaNS); + fillWithBlocks(world, box, 7, 4, 7, 7, 4, end, ModBlocks.reinforced_brick); if(bulkheadPZ) { fillWithBlocks(world, box, 1, 1, 8, 2, 1, 8, ModBlocks.reinforced_brick); @@ -750,19 +926,18 @@ public class BunkerComponents extends ProceduralComponents { } if(opensNX) { - placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 1, 0, 0, box); //Floor - fillWithBlocks(world, box, 0, 0, 1, 1, 0, 1, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 0, 0, 2, 1, 0, 2, ModBlocks.tile_lab); + fillWithBlocks(world, box, 1, 0, start, 1, 0, 1, ModBlocks.deco_titanium); //Floor + + fillWithBlocks(world, box, right, 0, 2, 1, 0, 2, ModBlocks.tile_lab); fillWithBlocks(world, box, 0, 0, 3, 1, 0, 5, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 0, 0, 6, 1, 0, 6, ModBlocks.tile_lab); - placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 0, 0, 7, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 1, box); //Ceiling - fillWithMetadataBlocks(world, box, 0, 4, 2, 1, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); + fillWithBlocks(world, box, right, 0, 6, 1, 0, 6, ModBlocks.tile_lab); + + //Ceiling + fillWithMetadataBlocks(world, box, right, 4, 2, 1, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); fillWithBlocks(world, box, 0, 4, 3, 2, 4, 3, ModBlocks.reinforced_brick); fillWithMetadataBlocks(world, box, 0, 4, 4, 3, 4, 4, ModBlocks.concrete_pillar, pillarMetaWE); fillWithBlocks(world, box, 0, 4, 5, 2, 4, 5, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 0, 4, 6, 1, 4, 6, ModBlocks.concrete_pillar, pillarMetaWE); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 7, box); + fillWithMetadataBlocks(world, box, right, 4, 6, 1, 4, 6, ModBlocks.concrete_pillar, pillarMetaWE); if(bulkheadNX) { fillWithBlocks(world, box, 0, 1, 1, 0, 1, 2, ModBlocks.reinforced_brick); @@ -772,10 +947,15 @@ public class BunkerComponents extends ProceduralComponents { fillWithBlocks(world, box, 0, 2, 6, 0, 2, 7, ModBlocks.reinforced_stone); fillWithBlocks(world, box, 0, 3, 6, 0, 3, 7, ModBlocks.reinforced_brick); fillWithAir(world, box, 0, 1, 3, 0, 3, 5); - } else + } else { fillWithAir(world, box, 0, 1, 1, 0, 3, 7); + placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 0, 0, 1, box); //outlier single-block placing operations + placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 0, 0, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 7, box); + } } else { - fillWithBlocks(world, box, 1, 0, 0, 1, 0, 6, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 1, 0, start, 1, 0, 6, ModBlocks.deco_titanium); //Floor fillWithBlocks(world, box, 0, 1, 1, 0, 1, 7, ModBlocks.reinforced_brick); //Wall fillWithBlocks(world, box, 0, 2, 1, 0, 2, 7, ModBlocks.reinforced_stone); fillWithBlocks(world, box, 0, 3, 1, 0, 3, 7, ModBlocks.reinforced_brick); @@ -785,19 +965,17 @@ public class BunkerComponents extends ProceduralComponents { } if(opensPX) { - placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 7, 0, 0, box); //Floor - fillWithBlocks(world, box, 7, 0, 1, 8, 0, 1, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 7, 0, 2, 8, 0, 2, ModBlocks.tile_lab); + //Floor + fillWithBlocks(world, box, 7, 0, start, 7, 0, 1, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 7, 0, 2, left, 0, 2, ModBlocks.tile_lab); fillWithBlocks(world, box, 7, 0, 3, 8, 0, 5, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 7, 0, 6, 8, 0, 6, ModBlocks.tile_lab); - placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 8, 0, 7, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 4, 1, box); //Ceiling - fillWithMetadataBlocks(world, box, 7, 4, 2, 8, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); + fillWithBlocks(world, box, 7, 0, 6, left, 0, 6, ModBlocks.tile_lab); + //Ceiling + fillWithMetadataBlocks(world, box, 7, 4, 2, left, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); fillWithBlocks(world, box, 6, 4, 3, 8, 4, 3, ModBlocks.reinforced_brick); fillWithMetadataBlocks(world, box, 5, 4, 4, 8, 4, 4, ModBlocks.concrete_pillar, pillarMetaWE); fillWithBlocks(world, box, 6, 4, 5, 8, 4, 5, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 7, 4, 6, 8, 4, 6, ModBlocks.concrete_pillar, pillarMetaWE); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 4, 7, box); + fillWithMetadataBlocks(world, box, 7, 4, 6, left, 4, 6, ModBlocks.concrete_pillar, pillarMetaWE); if(bulkheadPX) { fillWithBlocks(world, box, 8, 1, 1, 8, 1, 2, ModBlocks.reinforced_brick); @@ -807,10 +985,15 @@ public class BunkerComponents extends ProceduralComponents { fillWithBlocks(world, box, 8, 2, 6, 8, 2, 7, ModBlocks.reinforced_stone); fillWithBlocks(world, box, 8, 3, 6, 8, 3, 7, ModBlocks.reinforced_brick); fillWithAir(world, box, 8, 1, 3, 8, 3, 5); - } else + } else { fillWithAir(world, box, 8, 1, 1, 8, 3, 7); + placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 8, 0, 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 8, 0, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 4, 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 4, 7, box); + } } else { - fillWithBlocks(world, box, 7, 0, 0, 7, 0, 6, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 7, 0, start, 7, 0, 6, ModBlocks.deco_titanium); //Floor fillWithBlocks(world, box, 8, 1, 1, 8, 1, 7, ModBlocks.reinforced_brick); //Wall fillWithBlocks(world, box, 8, 2, 1, 8, 2, 7, ModBlocks.reinforced_stone); fillWithBlocks(world, box, 8, 3, 1, 8, 3, 7, ModBlocks.reinforced_brick); @@ -819,28 +1002,27 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 5, 4, 4, box); } //Wall corners - //if(opensNX || opensPZ) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 1, 8, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 8, 2, 8, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 3, 8, box); - //} - - //if(opensPX || opensPZ) { + if(opensNX || opensPZ) { placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 1, 8, box); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 0, 2, 8, box); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 3, 8, box); - //} + } + + if(opensPX || opensPZ) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 1, 8, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 8, 2, 8, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 3, 8, box); + } + + if(underwater) { + fillWithWater(world, box, rand, 1, 1, 0, 7, 3, opensPZ ? 8 : 7, 1); + if(opensNX) fillWithWater(world, box, rand, 0, 1, bulkheadNX ? 3 : 1, 0, 3, bulkheadNX ? 5 : 7, 1); + if(opensPX) fillWithWater(world, box, rand, 8, 1, bulkheadPX ? 3 : 1, 8, 3, bulkheadPX ? 5 : 7, 1); + } else + fillWithCobwebs(world, box, rand, opensNX ? 0 : 1, 1, 0, opensPX ? 8 : 7, 3, opensPZ ? 8 : 7); return true; } } - - protected void placeLamp(World world, Random rand, int featureX, int featureY, int featureZ, StructureBoundingBox box) { - if(rand.nextInt(3) == 0) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_on, 0, featureX, featureY, featureZ, box); - placeBlockAtCurrentPosition(world, Blocks.redstone_block, 0, featureX, featureY + 1, featureZ, box); - } else - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, featureX, featureY, featureZ, box); - } } } \ No newline at end of file diff --git a/src/main/java/com/hbm/world/worldgen/components/Component.java b/src/main/java/com/hbm/world/worldgen/components/Component.java index b6eb382c0..065f25ca0 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Component.java +++ b/src/main/java/com/hbm/world/worldgen/components/Component.java @@ -11,6 +11,7 @@ import com.hbm.tileentity.machine.TileEntityLockableBase; import com.hbm.tileentity.machine.storage.TileEntityCrateIron; import net.minecraft.block.Block; +import net.minecraft.block.BlockWeb; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; import net.minecraft.inventory.IInventory; @@ -22,6 +23,7 @@ import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureComponent; +import net.minecraftforge.common.util.ForgeDirection; abstract public class Component extends StructureComponent { /** The size of the bounding box for this feature in the X axis */ @@ -405,6 +407,42 @@ abstract public class Component extends StructureComponent { } } + /** Fills an area with cobwebs. Cobwebs will concentrate on corners and surfaces without floating cobwebs. */ + protected void fillWithCobwebs(World world, StructureBoundingBox box, Random rand, int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { + + if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) + return; + + for(int x = minX; x <= maxX; x++) { + + for(int z = minZ; z <= maxZ; z++) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + + if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { + for(int y = minY; y <= maxY; y++) { + int posY = getYWithOffset(y); + Block genTarget = world.getBlock(posX, posY, posZ); + + if(!genTarget.isAir(world, posX, posY, posZ)) + continue; + + int validNeighbors = 0; + for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + Block neighbor = world.getBlock(posX + dir.offsetX, posY + dir.offsetY, posZ + dir.offsetZ); + + if(neighbor.getMaterial().blocksMovement() || neighbor instanceof BlockWeb) + validNeighbors++; + } + + if(validNeighbors > 5 || (validNeighbors > 1 && rand.nextInt(6 - validNeighbors) == 0)) + world.setBlock(posX, posY, posZ, Blocks.web); + } + } + } + } + } + /** getXWithOffset & getZWithOffset Methods that are actually fixed **/ //Turns out, this entire time every single minecraft structure is mirrored instead of rotated when facing East and North //Also turns out, it's a scarily easy fix that they somehow didn't see *entirely* From decce7723ca456d8554da6c19da746ffdbe819a8 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sat, 15 Oct 2022 22:46:06 -0700 Subject: [PATCH 13/30] hm SupplyRoom, fixed limited rooms not spawning WasteDisposal bedroom --- src/main/java/com/hbm/lib/HbmWorld.java | 1 + .../com/hbm/world/worldgen/MapGenBunker.java | 2 + .../worldgen/components/BunkerComponents.java | 426 ++++++++++++++++-- .../world/worldgen/components/Component.java | 2 +- .../components/ProceduralComponents.java | 2 +- 5 files changed, 400 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/hbm/lib/HbmWorld.java b/src/main/java/com/hbm/lib/HbmWorld.java index 794866e41..6285a137f 100644 --- a/src/main/java/com/hbm/lib/HbmWorld.java +++ b/src/main/java/com/hbm/lib/HbmWorld.java @@ -58,5 +58,6 @@ public class HbmWorld { MapGenStructureIO.func_143031_a(Intersection.class, "NTMBIntersection"); MapGenStructureIO.func_143031_a(WideIntersection.class, "NTMBWideIntersection"); MapGenStructureIO.func_143031_a(UtilityCloset.class, "NTMBUtilityCloset"); + MapGenStructureIO.func_143031_a(SupplyRoom.class, "NTMBSupplyRoom"); } } diff --git a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java index 146e69547..777421903 100644 --- a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java +++ b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java @@ -63,6 +63,8 @@ public class MapGenBunker extends MapGenStructure { this.updateBoundingBox(); this.markAvailableHeight(world, rand, 10); + + System.out.print(this.boundingBox.minY); } } diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index 9685a0a2a..2a13a4823 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -23,7 +23,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class BunkerComponents extends ProceduralComponents { protected static final Weight[] weightArray = new Weight[] { - new Weight(10, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 15, mode); //Corridor and Wide version + new Weight(8, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 15, mode); //Corridor and Wide version if(box.minY > 10 && StructureComponent.findIntersecting(list, box) == null) return new WideCorridor(type, rand, box, mode); box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); @@ -33,12 +33,24 @@ public class BunkerComponents extends ProceduralComponents { box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Intersection(type, rand, box, mode) : null; }), - new Weight(2, 5, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 5, 4, mode); + new Weight(3, 5, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 5, 4, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new UtilityCloset(type, rand, box, mode) : null; }) { public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { - return (this.instanceLimit < 0 || this.instanceLimit < this.instanceLimit) && componentAmount > 10; //prevent the gimping of necessary corridors + return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors } }, + new Weight(8, 4, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -5, -1, 0, 13, 6, 13, mode); + return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new SupplyRoom(type, rand, box, mode) : null; }) { + public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { + return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors + } + }, + new Weight(6, 3, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); + return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new WasteDisposal(type, rand, box, mode) : null; }) { + public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { + return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors + } + }, }; public static void prepareComponents() { @@ -60,6 +72,10 @@ public class BunkerComponents extends ProceduralComponents { super(componentType); } + public void buildComponent(ControlComponent original, List components, Random rand) { + checkModifiers(original); + } + protected void checkModifiers(ControlComponent original) { if(original instanceof Atrium) this.underwater = ((Atrium) original).underwater; @@ -233,7 +249,7 @@ public class BunkerComponents extends ProceduralComponents { int cabinetMeta = getDecoModelMeta(0); if(hasLoot) - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, cabinetMeta, 1, 1, 2, HbmChestContents.filingCabinet, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, cabinetMeta, 1, 1, 2, HbmChestContents.machineParts, 4); } else { fillWithMetadataBlocks(world, box, 1, 1, 2, 2, 1, 2, ModBlocks.deco_pipe_quad_green_rusted, getPillarMeta(4)); placeBlockAtCurrentPosition(world, ModBlocks.machine_boiler_off, decoMetaN, 3, 1, 2, box); @@ -241,7 +257,7 @@ public class BunkerComponents extends ProceduralComponents { int cabinetMeta = getDecoModelMeta(3); if(hasLoot) - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, cabinetMeta, 1, 1, 1, HbmChestContents.filingCabinet, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, cabinetMeta, 1, 1, 1, HbmChestContents.machineParts, 4); } //Door @@ -273,6 +289,346 @@ public class BunkerComponents extends ProceduralComponents { } } + public static class SupplyRoom extends Bunker { + + BlockSelector crateSelector = new BlockSelector() { + public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { + float chance = rand.nextFloat(); + + if(chance < 0.001) + this.field_151562_a = ModBlocks.crate_red; + else if(chance < 0.05) + this.field_151562_a = ModBlocks.crate_ammo; + else if(chance < 0.10) + this.field_151562_a = ModBlocks.crate_metal; + else if(chance < 0.20) + this.field_151562_a = ModBlocks.crate_weapon; + else if(chance < 0.35) + this.field_151562_a = ModBlocks.crate; + else if(chance < 0.50) + this.field_151562_a = ModBlocks.crate_can; + else + this.field_151562_a = Blocks.air; + } + }; + + public SupplyRoom() { } + + public SupplyRoom(int componentType, Random rand, StructureBoundingBox box, int coordModeBase) { + super(componentType); + this.coordBaseMode = coordModeBase; + this.boundingBox = box; + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + return false; + } else { + fillWithAir(world, box, 5, 1, 0, 7, 3, 0); + fillWithAir(world, box, 1, 1, 1, 11, 3, 11); + + //Floor + fillWithBlocks(world, box, 1, 0, 2, 1, 0, 10, ModBlocks.tile_lab); + fillWithBlocks(world, box, 2, 0, 1, 3, 0, 11, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 4, 0, 1, 4, 0, 11, ModBlocks.tile_lab); + fillWithBlocks(world, box, 5, 0, 0, 7, 0, 10, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 5, 0, 11, 7, 0, 11, ModBlocks.tile_lab); + fillWithBlocks(world, box, 8, 0, 1, 8, 0, 11, ModBlocks.tile_lab); + fillWithBlocks(world, box, 9, 0, 1, 10, 0, 11, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 11, 0, 2, 11, 0, 10, ModBlocks.tile_lab); + //Walls + fillWithBlocks(world, box, 2, 1, 0, 4, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 2, 2, 0, 4, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 2, 3, 0, 4, 3, 0, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 1, 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 1, 2, 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 3, 1, box); + fillWithBlocks(world, box, 0, 1, 2, 0, 1, 10, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 2, 0, 2, 10, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 2, 0, 3, 10, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 1, 11, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 1, 2, 11, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 3, 11, box); + fillWithBlocks(world, box, 2, 1, 12, 10, 1, 12, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 2, 2, 12, 10, 2, 12, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 2, 3, 12, 10, 3, 12, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 1, 0, 10, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 2, 0, 10, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 8, 3, 0, 10, 3, 0, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 11, 1, 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 11, 2, 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 11, 3, 1, box); + fillWithBlocks(world, box, 12, 1, 2, 12, 1, 10, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 12, 2, 2, 12, 2, 10, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 12, 3, 2, 12, 3, 10, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 11, 1, 11, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 11, 2, 11, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 11, 3, 11, box); + //Ceiling + int pillarMetaNS = getPillarMeta(8); + int pillarMetaWE = getPillarMeta(4); + + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 5, 4, 0, box); + fillWithBlocks(world, box, 2, 4, 1, 5, 4, 5, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 4, 2, 1, 4, 5, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 1, 4, 6, 5, 4, 6, ModBlocks.concrete_pillar, pillarMetaWE); + fillWithBlocks(world, box, 1, 4, 7, 1, 4, 10, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 2, 4, 7, 5, 4, 11, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 7, 4, 0, box); + fillWithBlocks(world, box, 7, 4, 1, 10, 4, 5, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 11, 4, 2, 11, 4, 5, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 7, 4, 6, 11, 4, 6, ModBlocks.concrete_pillar, pillarMetaWE); + fillWithBlocks(world, box, 11, 4, 7, 11, 4, 10, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 7, 4, 7, 10, 4, 11, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 7, 4, 0, box); + fillWithMetadataBlocks(world, box, 6, 4, 0, 6, 4, 2, ModBlocks.concrete_pillar, pillarMetaNS); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 5, 4, 0, box); + for(int i = 3; i <= 9; i += 3) { + placeLamp(world, box, rand, 6, 4, i); + fillWithMetadataBlocks(world, box, 6, 4, i + 1, 6, 4, i + 2, ModBlocks.concrete_pillar, pillarMetaNS); + } + //Shelves Right + for(int i = 1; i <= 11; i += i == 4 ? 4 : 3) { + if(i % 2 == 0) { + for(int j = 1; j <= 11; j += 10) { + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 1, j, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, i, 2, j, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 3, j, box); + } + } + + fillWithMetadataBlocks(world, box, i, 2, 2, i, 2, 4, ModBlocks.brick_slab, 8); //b100 = dense stone, top position + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 1, 5, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, i, 2, 5, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 3, 5, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 1, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, i, 2, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 3, 7, box); + fillWithMetadataBlocks(world, box, i, 2, 8, i, 2, 10, ModBlocks.brick_slab, 8); + //Crates + fillWithRandomizedBlocks(world, box, i, 1, 2, i, 1, 4, rand, crateSelector); + fillWithRandomizedBlocks(world, box, i, 3, 2, i, 3, 4, rand, crateSelector); + if(i % 2 != 0) { + placeBlockAtCurrentPosition(world, ModBlocks.brick_slab, 8, i, 2, 6, box); //middle shelf part + fillWithRandomizedBlocks(world, box, i, 1, 6, i, 1, 6, rand, crateSelector); + fillWithRandomizedBlocks(world, box, i, 3, 6, i, 3, 6, rand, crateSelector); + } + fillWithRandomizedBlocks(world, box, i, 1, 8, i, 1, 10, rand, crateSelector); + fillWithRandomizedBlocks(world, box, i, 3, 8, i, 3, 10, rand, crateSelector); + } + + fillWithMetadataBlocks(world, box, 5, 2, 11, 7, 2, 11, ModBlocks.brick_slab, 8); + generateInvContents(world, box, rand, ModBlocks.crate_iron, 6, 3, 11, HbmChestContents.machineParts, 10); + generateInvContents(world, box, rand, ModBlocks.crate_iron, 7, 1, 11, HbmChestContents.vault1, 8); + + if(underwater) { + fillWithWater(world, box, rand, 1, 1, 1, 11, 3, 11, 1); + fillWithWater(world, box, rand, 5, 1, 0, 7, 3, 0, 1); + } else + fillWithCobwebs(world, box, rand, 1, 1, 0, 11, 3, 11); + + return true; + } + } + } + //what 'waste'? + public static class WasteDisposal extends Bunker { + + public WasteDisposal() { } + + public WasteDisposal(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType); + this.coordBaseMode = coordBaseMode; + this.boundingBox = box; + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + return false; + } else { + //Floor + placeBlockAtCurrentPosition(world, ModBlocks.tile_lab, 0, 4, 0, 0, box); + fillWithBlocks(world, box, 1, 0, 1, 1, 0, 2, ModBlocks.concrete_brick_slab); + fillWithBlocks(world, box, 1, 0, 3, 1, 0, 7, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 2, 0, 1, 2, 0, 7, ModBlocks.tile_lab); + fillWithBlocks(world, box, 3, 0, 1, 5, 0, 3, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 3, 0, 4, 5, 0, 4, ModBlocks.tile_lab); + fillWithBlocks(world, box, 3, 0, 5, 5, 0, 7, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 6, 0, 1, 6, 0, 7, ModBlocks.tile_lab); + fillWithBlocks(world, box, 7, 0, 1, 7, 0, 2, ModBlocks.concrete_brick_slab); + fillWithBlocks(world, box, 7, 0, 3, 7, 0, 7, ModBlocks.deco_titanium); + //Wall + fillWithBlocks(world, box, 1, 0, 0, 1, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 2, 1, 0, 3, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 0, 3, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 7, 0, 0, 7, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 5, 1, 0, 6, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 5, 2, 0, 7, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 0, 7, 3, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 0, 1, 0, 1, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 1, 3, 0, 1, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 1, 0, 2, 7, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 1, 0, 3, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 1, 8, 7, 1, 8, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 8, 7, 2, 8, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 8, 7, 3, 8, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 1, 3, 8, 1, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 0, 1, 8, 1, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 2, 1, 8, 2, 7, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 8, 3, 1, 8, 3, 7, ModBlocks.reinforced_brick); + //Ceiling + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 4, 1, box); + fillWithBlocks(world, box, 1, 4, 1, 3, 4, 7, ModBlocks.reinforced_brick); + placeLamp(world, box, rand, 4, 4, 2); + fillWithBlocks(world, box, 4, 4, 3, 4, 4, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 5, 4, 1, 7, 4, 7, ModBlocks.reinforced_brick); + //Decorations + fillWithMetadataBlocks(world, box, 1, 1, 1, 1, 1, 2, ModBlocks.steel_grate, 7); + placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, getDecoMeta(3), 1, 1, 3, box); + placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, getDecoMeta(2), 1, 1, 5, box); + fillWithMetadataBlocks(world, box, 1, 1, 6, 1, 1, 7, ModBlocks.steel_grate, 7); + generateInvContents(world, box, rand, ModBlocks.crate_iron, 1, 2, 7, HbmChestContents.filingCabinet, 10); + fillWithMetadataBlocks(world, box, 7, 1, 1, 7, 1, 2, ModBlocks.steel_grate, 7); + placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, getDecoMeta(3), 7, 1, 3, box); + placeRandomBobble(world, box, rand, 7, 2, 1); + //Cremator + int pillarMetaWE = getPillarMeta(4); + + //fillWithMetadataBlocks(world, box, 3, 1, 5, 5, 1, 7, ModBlocks.heater_firebox, 4); + //placeholder, but how the hell am i to guarantee that this multiblock shit won't spill into unloaded chunks? + fillWithBlocks(world, box, 3, 1, 5, 3, 1, 7, ModBlocks.brick_fire); + fillWithMetadataBlocks(world, box, 4, 1, 5, 4, 1, 6, ModBlocks.brick_slab, 6); + placeBlockAtCurrentPosition(world, ModBlocks.brick_fire, 0, 4, 1, 7, box); + fillWithBlocks(world, box, 5, 1, 5, 5, 1, 7, ModBlocks.brick_fire); + //i genuinely cannot be bothered to go to the effort of block selectors for the stairs n shit + fillWithMetadataBlocks(world, box, 3, 2, 5, 3, 2, 6, ModBlocks.brick_concrete_stairs, getStairMeta(1)); + placeBlockAtCurrentPosition(world, ModBlocks.brick_concrete_stairs, getStairMeta(2), 3, 2, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_brick_slab, 0, 4, 2, 5, box); + placeBlockAtCurrentPosition(world, ModBlocks.brick_concrete_stairs, getStairMeta(2), 4, 2, 7, box); + fillWithMetadataBlocks(world, box, 5, 2, 5, 5, 2, 6, ModBlocks.brick_concrete_stairs, getStairMeta(0)); + placeBlockAtCurrentPosition(world, ModBlocks.brick_concrete_stairs, getStairMeta(2), 5, 2, 7, box); + fillWithBlocks(world, box, 3, 3, 5, 3, 3, 7, ModBlocks.brick_concrete); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_brick_slab, 8, 4, 3, 5, box); + placeBlockAtCurrentPosition(world, ModBlocks.brick_concrete, 0, 4, 3, 7, box); + fillWithBlocks(world, box, 5, 3, 5, 5, 3, 7, ModBlocks.brick_concrete); + fillWithMetadataBlocks(world, box, 1, 3, 6, 2, 3, 6, ModBlocks.deco_pipe_quad_rusted, pillarMetaWE); + fillWithMetadataBlocks(world, box, 6, 3, 6, 7, 3, 6, ModBlocks.deco_pipe_quad_rusted, pillarMetaWE); + placeDoor(world, box, ModBlocks.door_bunker, 1, 4, 1, 0); + + if(underwater) { //against all odds, building remains unflooded + fillWithWater(world, box, rand, 1, 1, 1, 7, 3, 7, 0); + } else { + fillWithCobwebs(world, box, rand, 1, 1, 1, 7, 3, 7); + } + + return true; + } + } + } + + public static class Bedroom extends Bunker { + + public Bedroom() { } + + public Bedroom(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType); + this.coordBaseMode = coordBaseMode; + this.boundingBox = box; + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + + if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + return false; + } else { + //Floor + placeBlockAtCurrentPosition(world, ModBlocks.tile_lab, 0, 2, 0, 0, box); + fillWithBlocks(world, box, 1, 0, 1, 6, 0, 8, ModBlocks.tile_lab); + //Wall + fillWithBlocks(world, box, 3, 1, 0, 6, 1, 0, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 1, 0, box); + fillWithBlocks(world, box, 3, 2, 0, 6, 3, 0, ModBlocks.concrete_colored); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_colored, 0, 2, 3, 0, box); + fillWithBlocks(world, box, 1, 2, 0, 1, 3, 0, ModBlocks.concrete_colored); + fillWithBlocks(world, box, 0, 1, 1, 0, 1, 8, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 1, 0, 3, 8, ModBlocks.concrete_colored); + fillWithBlocks(world, box, 1, 1, 9, 6, 1, 9, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 9, 3, 3, 9, ModBlocks.concrete_colored); + fillWithBlocks(world, box, 4, 2, 9, 6, 2, 9, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 4, 3, 9, 6, 3, 9, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 7, 1, 1, 7, 1, 8, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 7, 2, 1, 7, 3, 4, ModBlocks.concrete_colored); + fillWithBlocks(world, box, 7, 2, 5, 7, 2, 8, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 7, 3, 5, 7, 3, 8, ModBlocks.reinforced_brick); + //Interior Wall + fillWithBlocks(world, box, 5, 1, 5, 6, 1, 5, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 5, 2, 5, 6, 3, 5, ModBlocks.concrete_colored); + fillWithBlocks(world, box, 4, 1, 6, 4, 1, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 4, 2, 6, 4, 3, 7, ModBlocks.concrete_colored); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_colored, 0, 4, 3, 8, box); + //Ceiling + fillWithBlocks(world, box, 1, 4, 1, 6, 4, 1, ModBlocks.concrete); + for(int i = 1; i <= 4; i += 3) { + fillWithBlocks(world, box, i, 4, 2, i, 4, 3, ModBlocks.concrete); + placeLamp(world, box, rand, i + 1, 4, 2); + placeLamp(world, box, rand, i + 1, 4, 3); + fillWithBlocks(world, box, i + 2, 4, 2, i + 2, 4, 3, ModBlocks.concrete); + } + fillWithBlocks(world, box, 1, 4, 4, 1, 4, 8, ModBlocks.concrete); + fillWithBlocks(world, box, 2, 4, 4, 2, 4, 6, ModBlocks.concrete); + placeLamp(world, box, rand, 2, 4, 7); + fillWithBlocks(world, box, 2, 4, 8, 4, 4, 8, ModBlocks.concrete); + fillWithBlocks(world, box, 3, 4, 4, 4, 4, 7, ModBlocks.concrete); + fillWithBlocks(world, box, 5, 4, 4, 6, 4, 5, ModBlocks.concrete); + fillWithBlocks(world, box, 5, 4, 6, 5, 4, 8, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 6, 4, 6, box); + placeLamp(world, box, rand, 6, 4, 7); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 6, 4, 8, box); + + //Decorations + //Bathroom TODO: figure out meta for this shit + placeDoor(world, box, ModBlocks.door_metal, 4, 4, 1, 8); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 5, 1, 6, box); + placeBlockAtCurrentPosition(world, Blocks.cauldron, 0, 6, 1, 6, box); + placeBlockAtCurrentPosition(world, Blocks.tripwire_hook, 0, 6, 2, 6, box); + placeBlockAtCurrentPosition(world, Blocks.hopper, 3, 6, 1, 8, box); + placeBlockAtCurrentPosition(world, Blocks.trapdoor, 0, 6, 2, 8, box); + //Furnishing TODO: figure out beds + //placeBlockAtCurrentPosition(world, ModBlocks.bed, 2, 4, 1, 2, box); + //placeBlockAtCurrentPosition(world, ModBlocks.bed, 2, 5, 1, 2, box); + fillWithMetadataBlocks(world, box, 6, 1, 1, 6, 1, 4, ModBlocks.concrete_slab, 9); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(1), 5, 1, 4, box); + placeBlockAtCurrentPosition(world, ModBlocks.radiorec, getDecoMeta(5), 6, 2, 1, box); + placeRandomBobble(world, box, rand, 6, 2, 3); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(2), 6, 2, 4, box); + placeBlockAtCurrentPosition(world, ModBlocks.filing_cabinet, getDecoModelMeta(0), 4, 1, 5, box); + // + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, getStairMeta(7), 1, 1, 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, getStairMeta(6), 1, 1, 3, box); + placeBlockAtCurrentPosition(world, ModBlocks.machine_electric_furnace_off, 5, 1, 1, 4, box); + fillWithMetadataBlocks(world, box, 1, 3, 2, 1, 3, 4, ModBlocks.reinforced_brick_stairs, getStairMeta(1)); + // + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(3), 1, 1, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, getStairMeta(4), 2, 1, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 1, 1, 7, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 1, 1, 8, box); + + placeDoor(world, box, ModBlocks.door_metal, 1, 2, 1, 0); + + if(underwater) { //against all odds, building remains unflooded + fillWithWater(world, box, rand, 1, 1, 1, 6, 3, 8, 0); + } else { + fillWithCobwebs(world, box, rand, 1, 1, 1, 6, 3, 8); + } + + return true; + } + } + } + public static class Atrium extends ControlComponent { public boolean underwater = false; @@ -429,12 +785,22 @@ public class BunkerComponents extends ProceduralComponents { } - interface Wide { } //now you may ask yourself - where is that beautiful house? you may ask yourself - where does that highway go to? + private interface Wide { } //now you may ask yourself - where is that beautiful house? you may ask yourself - where does that highway go to? //you may ask yourself - am i right, am i wrong? you may say to yourself - my god, no multiple inheritance to be done! + private interface Bulkhead { public void setBulkheadNZ(boolean bool); + public default void flipConstitutentBulkhead(StructureComponent component, Random rand) { + if(component instanceof Bulkhead) { + Bulkhead head = (Bulkhead) component; + head.setBulkheadNZ(rand.nextInt(4) == 0); + } + } + } //mh - public static class WideCorridor extends Corridor implements Wide { + public static class WideCorridor extends Corridor implements Wide, Bulkhead { boolean bulkheadNZ = true; + public void setBulkheadNZ(boolean bool) { bulkheadNZ = bool; } //ihatelackofmultipleinheritanceihatelackofmultipleinheritanceihatelackofmultipleinheritanceihatelackofmultipleinheritance + boolean bulkheadPZ = true; public WideCorridor() { } @@ -443,6 +809,18 @@ public class BunkerComponents extends ProceduralComponents { super(componentType, rand, box, coordBaseMode); } + protected void func_143012_a(NBTTagCompound data) { + super.func_143012_a(data); + data.setBoolean("bulkheadNZ", bulkheadNZ); + data.setBoolean("bulkheadPZ", bulkheadPZ); + } + + protected void func_143011_b(NBTTagCompound data) { + super.func_143011_b(data); + bulkheadNZ = data.getBoolean("bulkheadNZ"); + bulkheadPZ = data.getBoolean("bulkheadPZ"); + } + @Override public void buildComponent(ControlComponent original, List components, Random rand) { checkModifiers(original); @@ -452,11 +830,7 @@ public class BunkerComponents extends ProceduralComponents { if(component instanceof Wide) { bulkheadPZ = false; - - if(component instanceof WideCorridor) { - WideCorridor corridor = (WideCorridor) component; - corridor.bulkheadNZ = rand.nextInt(4) == 0; - } + flipConstitutentBulkhead(component, rand); } if(rand.nextInt(3) > 0) { @@ -751,7 +1125,7 @@ public class BunkerComponents extends ProceduralComponents { } if(underwater) { - fillWithWater(world, box, rand, 1, 1, 0, 3, 3, opensPX ? 4 : 3, 1); + fillWithWater(world, box, rand, 1, 1, 0, 3, 3, opensPZ ? 4 : 3, 1); if(opensNX) fillWithWater(world, box, rand, 0, 1, 1, 0, 3, 3, 1); if(opensPX) fillWithWater(world, box, rand, 4, 1, 1, 4, 3, 3, 1); } else @@ -762,9 +1136,11 @@ public class BunkerComponents extends ProceduralComponents { } } - public static class WideIntersection extends Intersection implements Wide { + public static class WideIntersection extends Intersection implements Wide, Bulkhead { boolean bulkheadNZ = true; + public void setBulkheadNZ(boolean bool) { bulkheadNZ = bool; } + boolean bulkheadPZ = true; boolean bulkheadNX = true; boolean bulkheadPX = true; @@ -779,8 +1155,8 @@ public class BunkerComponents extends ProceduralComponents { super.func_143012_a(data); data.setBoolean("bulkheadNZ", bulkheadNZ); data.setBoolean("bulkheadPZ", bulkheadPZ); - data.setBoolean("opensNX", opensNX); - data.setBoolean("opensPX", opensPX); + data.setBoolean("bulkheadNX", bulkheadNX); + data.setBoolean("bulkheadPX", bulkheadPX); } protected void func_143011_b(NBTTagCompound data) { @@ -800,11 +1176,7 @@ public class BunkerComponents extends ProceduralComponents { if(component instanceof Wide) { bulkheadPZ = false; - - if(component instanceof WideCorridor) { - WideCorridor corridor = (WideCorridor) component; - corridor.bulkheadNZ = rand.nextInt(4) == 0; - } + flipConstitutentBulkhead(component, rand); } StructureComponent componentN = getNextComponentNX(original, components, rand, 3, 1); @@ -812,11 +1184,7 @@ public class BunkerComponents extends ProceduralComponents { if(componentN instanceof Wide) { bulkheadNX = false; - - if(componentN instanceof WideCorridor) { - WideCorridor corridor = (WideCorridor) componentN; - corridor.bulkheadNZ = rand.nextInt(4) == 0; - } + flipConstitutentBulkhead(component, rand); } StructureComponent componentP = getNextComponentPX(original, components, rand, 3, 1); @@ -824,11 +1192,7 @@ public class BunkerComponents extends ProceduralComponents { if(componentP instanceof Wide) { bulkheadPX = false; - - if(componentP instanceof WideCorridor) { - WideCorridor corridor = (WideCorridor) componentP; - corridor.bulkheadNZ = rand.nextInt(4) == 0; - } + flipConstitutentBulkhead(component, rand); } } diff --git a/src/main/java/com/hbm/world/worldgen/components/Component.java b/src/main/java/com/hbm/world/worldgen/components/Component.java index 065f25ca0..2b3f15868 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Component.java +++ b/src/main/java/com/hbm/world/worldgen/components/Component.java @@ -270,7 +270,7 @@ abstract public class Component extends StructureComponent { int posZ = this.getZWithOffset(featureX, featureZ); if(world.getBlock(posX, posY, posZ) == block) //replacement for hasPlacedLoot checks - return false; + return true; this.placeBlockAtCurrentPosition(world, block, meta, featureX, featureY, featureZ, box); IInventory inventory = (IInventory)world.getTileEntity(posX, posY, posZ); diff --git a/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java b/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java index 57cfd5336..28d208394 100644 --- a/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java @@ -215,7 +215,7 @@ public abstract class ProceduralComponents { //Checks if another structure can be spawned based on input data public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { - return this.instanceLimit < 0 || this.instanceLimit < this.instanceLimit; + return this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit; } //Checks if another structure can be spawned at all (used to flag for removal from the list) From 7e8611bebcd3f488a9032ea998c22b1896c6a8be Mon Sep 17 00:00:00 2001 From: Vaern Date: Sun, 16 Oct 2022 20:28:07 -0700 Subject: [PATCH 14/30] Vinyl Tiles, Refactoring to allow for proper subclasses --- src/main/java/com/hbm/blocks/BlockEnums.java | 5 + src/main/java/com/hbm/blocks/ModBlocks.java | 12 +- .../java/com/hbm/items/tool/ItemWandD.java | 2 +- src/main/java/com/hbm/lib/HbmWorld.java | 2 + .../com/hbm/world/worldgen/MapGenBunker.java | 11 +- .../worldgen/components/BunkerComponents.java | 230 +++++++++--------- .../world/worldgen/components/Component.java | 48 +++- .../components/ProceduralComponents.java | 99 ++++---- src/main/resources/assets/hbm/lang/en_US.lang | 2 + .../hbm/textures/blocks/vinyl_tile.large.png | Bin 0 -> 1515 bytes .../hbm/textures/blocks/vinyl_tile.small.png | Bin 0 -> 1321 bytes 11 files changed, 236 insertions(+), 175 deletions(-) create mode 100644 src/main/resources/assets/hbm/textures/blocks/vinyl_tile.large.png create mode 100644 src/main/resources/assets/hbm/textures/blocks/vinyl_tile.small.png diff --git a/src/main/java/com/hbm/blocks/BlockEnums.java b/src/main/java/com/hbm/blocks/BlockEnums.java index 52ee856a8..00858aae8 100644 --- a/src/main/java/com/hbm/blocks/BlockEnums.java +++ b/src/main/java/com/hbm/blocks/BlockEnums.java @@ -13,4 +13,9 @@ public class BlockEnums { SULFUR, ASBESTOS } + + public static enum TileType { + LARGE, + SMALL + } } diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 86b105f95..a09757d2d 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -3,6 +3,7 @@ package com.hbm.blocks; import com.hbm.blocks.generic.*; import com.hbm.blocks.generic.BlockHazard.ExtDisplayEffect; import com.hbm.blocks.generic.BlockMotherOfAllOres.ItemRandomOreBlock; +import com.hbm.blocks.BlockEnums.TileType; import com.hbm.blocks.bomb.*; import com.hbm.blocks.fluid.*; import com.hbm.blocks.gas.*; @@ -366,7 +367,9 @@ public class ModBlocks { public static Block cmb_brick; public static Block cmb_brick_reinforced; - + + public static Block vinyl_tile; + public static Block tile_lab; public static Block tile_lab_cracked; public static Block tile_lab_broken; @@ -1581,7 +1584,7 @@ public class ModBlocks { lamp_uv_off = new UVLamp(false).setBlockName("lamp_uv_off").setCreativeTab(MainRegistry.blockTab); lamp_uv_on = new UVLamp(true).setBlockName("lamp_uv_on").setCreativeTab(null); lamp_demon = new DemonLamp().setBlockName("lamp_demon").setStepSound(Block.soundTypeMetal).setCreativeTab(MainRegistry.blockTab).setLightLevel(1F).setHardness(3.0F).setBlockTextureName(RefStrings.MODID + ":lamp_demon"); - + reinforced_stone = new BlockGeneric(Material.rock).setBlockName("reinforced_stone").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(3000.0F).setBlockTextureName(RefStrings.MODID + ":reinforced_stone"); concrete_smooth = new BlockRadResistant(Material.rock).setBlockName("concrete_smooth").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(4000.0F).setBlockTextureName(RefStrings.MODID + ":concrete"); concrete_colored = new BlockConcreteColored(Material.rock).setBlockName("concrete_colored").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(4000.0F).setBlockTextureName(RefStrings.MODID + ":concrete"); @@ -1632,7 +1635,8 @@ public class ModBlocks { brick_compound_stairs = new BlockGenericStairs(brick_compound, 0).setBlockName("brick_compound_stairs").setCreativeTab(MainRegistry.blockTab); brick_asbestos_stairs = new BlockGenericStairs(brick_asbestos, 0).setBlockName("brick_asbestos_stairs").setCreativeTab(MainRegistry.blockTab); brick_fire_stairs = new BlockGenericStairs(brick_fire, 0).setBlockName("brick_fire_stairs").setCreativeTab(MainRegistry.blockTab); - + + vinyl_tile = new BlockEnumMulti(Material.rock, TileType.class, true, true).setBlockName("vinyl_tile").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(120.0F).setBlockTextureName(RefStrings.MODID + ":vinyl_tile"); tile_lab = new BlockOutgas(Material.rock, false, 5, true).setBlockName("tile_lab").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(1.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":tile_lab"); tile_lab_cracked = new BlockOutgas(Material.rock, false, 5, true).setBlockName("tile_lab_cracked").setStepSound(Block.soundTypeGlass).setCreativeTab(MainRegistry.blockTab).setHardness(1.0F).setResistance(20.0F).setBlockTextureName(RefStrings.MODID + ":tile_lab_cracked"); @@ -2740,6 +2744,8 @@ public class ModBlocks { GameRegistry.registerBlock(cmb_brick_reinforced, ItemBlockBlastInfo.class, cmb_brick_reinforced.getUnlocalizedName()); //Tiles + GameRegistry.registerBlock(vinyl_tile, ItemBlockBlastInfo.class, vinyl_tile.getUnlocalizedName()); //i would rather die than dip into fucking blocks with subtypes again + GameRegistry.registerBlock(tile_lab, tile_lab.getUnlocalizedName()); GameRegistry.registerBlock(tile_lab_cracked, tile_lab_cracked.getUnlocalizedName()); GameRegistry.registerBlock(tile_lab_broken, tile_lab_broken.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/tool/ItemWandD.java b/src/main/java/com/hbm/items/tool/ItemWandD.java index e0cea6324..6260e9ec2 100644 --- a/src/main/java/com/hbm/items/tool/ItemWandD.java +++ b/src/main/java/com/hbm/items/tool/ItemWandD.java @@ -39,7 +39,7 @@ public class ItemWandD extends Item { int l = ((pos.blockZ >> 4) << 4) + 8; Start start = new Start(world, world.rand, pos.blockX >> 4, pos.blockZ >> 4); - start.generateStructure(world, world.rand, new StructureBoundingBox(k - 112, l - 112, k + 15 + 112, l + 15 + 112)); + start.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124)); /*OilSpot.generateOilSpot(world, pos.blockX, pos.blockZ, 20, 500);*/ diff --git a/src/main/java/com/hbm/lib/HbmWorld.java b/src/main/java/com/hbm/lib/HbmWorld.java index 6285a137f..421900bc7 100644 --- a/src/main/java/com/hbm/lib/HbmWorld.java +++ b/src/main/java/com/hbm/lib/HbmWorld.java @@ -59,5 +59,7 @@ public class HbmWorld { MapGenStructureIO.func_143031_a(WideIntersection.class, "NTMBWideIntersection"); MapGenStructureIO.func_143031_a(UtilityCloset.class, "NTMBUtilityCloset"); MapGenStructureIO.func_143031_a(SupplyRoom.class, "NTMBSupplyRoom"); + MapGenStructureIO.func_143031_a(WasteDisposal.class, "NTMBWasteDisposal"); + MapGenStructureIO.func_143031_a(Bedroom.class, "NTMBBedroom"); } } diff --git a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java index 777421903..079049bbe 100644 --- a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java +++ b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java @@ -38,18 +38,21 @@ public class MapGenBunker extends MapGenStructure { public Start(World world, Random rand, int chunkX, int chunkZ) { super(chunkX, chunkZ); - BunkerComponents.prepareComponents(); + + BunkerComponents bunker = new BunkerComponents(); //oop is confusing sometimes + bunker.prepareComponents(); + Atrium atrium = new Atrium(0, rand, (chunkX << 4) + 8, (chunkZ << 4) + 8); this.components.add(atrium); - atrium.buildComponent(atrium, components, rand); - atrium.underwater = true;//rand.nextInt(2) == 0; + atrium.buildComponent(bunker, atrium, components, rand); + atrium.underwater = false;//rand.nextInt(2) == 0; List list = atrium.queuedComponents; while(!list.isEmpty()) { int k = rand.nextInt(list.size()); ProceduralComponent component = (ProceduralComponent)list.remove(k); atrium.lastComponent = component; - component.buildComponent(atrium, this.components, rand); + component.buildComponent(bunker, atrium, this.components, rand); } if(GeneralConfig.enableDebugMode) { diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index 2a13a4823..e4763a446 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -22,44 +22,46 @@ import net.minecraftforge.common.util.ForgeDirection; public class BunkerComponents extends ProceduralComponents { - protected static final Weight[] weightArray = new Weight[] { - new Weight(8, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 15, mode); //Corridor and Wide version + public BunkerComponents() { + weightArray = new Weight[] { + new Weight(30, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 15, mode); //Corridor and Wide version if(box.minY > 10 && StructureComponent.findIntersecting(list, box) == null) return new WideCorridor(type, rand, box, mode); - box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); + box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Corridor(type, rand, box, mode) : null; }), - new Weight(2, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); //Intersection and wide ver. + new Weight(10, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); //Intersection and wide ver. if(box.minY > 10 && StructureComponent.findIntersecting(list, box) == null) return new WideIntersection(type, rand, box, mode); - box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); + box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Intersection(type, rand, box, mode) : null; }), - new Weight(3, 5, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 5, 4, mode); + new Weight(3, 5, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 5, 4, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new UtilityCloset(type, rand, box, mode) : null; }) { public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors } }, - new Weight(8, 4, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -5, -1, 0, 13, 6, 13, mode); + new Weight(8, 4, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -5, -1, 0, 13, 6, 13, mode); return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new SupplyRoom(type, rand, box, mode) : null; }) { public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors } }, - new Weight(6, 3, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = ProceduralComponent.getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); - return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new WasteDisposal(type, rand, box, mode) : null; }) { - public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { - return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors - } - }, - }; - - public static void prepareComponents() { - componentWeightList = new ArrayList(); + new Weight(5, 3, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); + return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new WasteDisposal(type, rand, box, mode) : null; }) { + public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { + return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors + } + }, + new Weight(10, 15, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 8, 6, 10, mode); + return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Bedroom(type, rand, box, mode) : null; }) { + public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { + return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors + } + }, + }; - for(int i = 0; i < weightArray.length; i++) { - weightArray[i].instancesSpawned = 0; - componentWeightList.add(weightArray[i]); - } + sizeLimit = 100; + distanceLimit = 100; } public static abstract class Bunker extends ProceduralComponent { @@ -72,7 +74,7 @@ public class BunkerComponents extends ProceduralComponents { super(componentType); } - public void buildComponent(ControlComponent original, List components, Random rand) { + public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { checkModifiers(original); } @@ -207,8 +209,8 @@ public class BunkerComponents extends ProceduralComponents { fillWithAir(world, box, 1, 1, 1, 3, 3, 2); //Floor - placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 2, 0, 0, box); - fillWithBlocks(world, box, 1, 0, 1, 3, 0, 2, ModBlocks.deco_titanium); + placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 0, 2, 0, 0, box); + fillWithBlocks(world, box, 1, 0, 1, 3, 0, 2, ModBlocks.vinyl_tile); //Wall fillWithBlocks(world, box, 0, 1, 1, 0, 1, 2, ModBlocks.reinforced_brick); fillWithBlocks(world, box, 0, 2, 1, 0, 2, 2, ModBlocks.reinforced_stone); @@ -329,14 +331,14 @@ public class BunkerComponents extends ProceduralComponents { fillWithAir(world, box, 1, 1, 1, 11, 3, 11); //Floor - fillWithBlocks(world, box, 1, 0, 2, 1, 0, 10, ModBlocks.tile_lab); - fillWithBlocks(world, box, 2, 0, 1, 3, 0, 11, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 4, 0, 1, 4, 0, 11, ModBlocks.tile_lab); - fillWithBlocks(world, box, 5, 0, 0, 7, 0, 10, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 5, 0, 11, 7, 0, 11, ModBlocks.tile_lab); - fillWithBlocks(world, box, 8, 0, 1, 8, 0, 11, ModBlocks.tile_lab); - fillWithBlocks(world, box, 9, 0, 1, 10, 0, 11, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 11, 0, 2, 11, 0, 10, ModBlocks.tile_lab); + fillWithMetadataBlocks(world, box, 1, 0, 2, 1, 0, 10, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 2, 0, 1, 3, 0, 11, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 4, 0, 1, 4, 0, 11, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 5, 0, 0, 7, 0, 10, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 5, 0, 11, 7, 0, 11, ModBlocks.vinyl_tile, 1); + fillWithMetadataBlocks(world, box, 8, 0, 1, 8, 0, 11, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 9, 0, 1, 10, 0, 11, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 11, 0, 2, 11, 0, 10, ModBlocks.vinyl_tile, 1); //Walls fillWithBlocks(world, box, 2, 1, 0, 4, 1, 0, ModBlocks.reinforced_brick); fillWithBlocks(world, box, 2, 2, 0, 4, 2, 0, ModBlocks.reinforced_stone); @@ -449,16 +451,16 @@ public class BunkerComponents extends ProceduralComponents { return false; } else { //Floor - placeBlockAtCurrentPosition(world, ModBlocks.tile_lab, 0, 4, 0, 0, box); + placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 4, 0, 0, box); fillWithBlocks(world, box, 1, 0, 1, 1, 0, 2, ModBlocks.concrete_brick_slab); - fillWithBlocks(world, box, 1, 0, 3, 1, 0, 7, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 2, 0, 1, 2, 0, 7, ModBlocks.tile_lab); - fillWithBlocks(world, box, 3, 0, 1, 5, 0, 3, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 3, 0, 4, 5, 0, 4, ModBlocks.tile_lab); - fillWithBlocks(world, box, 3, 0, 5, 5, 0, 7, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 6, 0, 1, 6, 0, 7, ModBlocks.tile_lab); + fillWithBlocks(world, box, 1, 0, 3, 1, 0, 7, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 2, 0, 1, 2, 0, 7, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 3, 0, 1, 5, 0, 3, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 3, 0, 4, 5, 0, 4, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 3, 0, 5, 5, 0, 7, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 6, 0, 1, 6, 0, 7, ModBlocks.vinyl_tile, 1); fillWithBlocks(world, box, 7, 0, 1, 7, 0, 2, ModBlocks.concrete_brick_slab); - fillWithBlocks(world, box, 7, 0, 3, 7, 0, 7, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 7, 0, 3, 7, 0, 7, ModBlocks.vinyl_tile); //Wall fillWithBlocks(world, box, 1, 0, 0, 1, 1, 0, ModBlocks.reinforced_brick); fillWithBlocks(world, box, 2, 1, 0, 3, 1, 0, ModBlocks.reinforced_brick); @@ -545,8 +547,8 @@ public class BunkerComponents extends ProceduralComponents { return false; } else { //Floor - placeBlockAtCurrentPosition(world, ModBlocks.tile_lab, 0, 2, 0, 0, box); - fillWithBlocks(world, box, 1, 0, 1, 6, 0, 8, ModBlocks.tile_lab); + placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 2, 0, 0, box); + fillWithMetadataBlocks(world, box, 1, 0, 1, 6, 0, 8, ModBlocks.vinyl_tile, 1); //Wall fillWithBlocks(world, box, 3, 1, 0, 6, 1, 0, ModBlocks.reinforced_brick); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 1, 0, box); @@ -589,16 +591,16 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 6, 4, 8, box); //Decorations - //Bathroom TODO: figure out meta for this shit + //Bathroom placeDoor(world, box, ModBlocks.door_metal, 4, 4, 1, 8); placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 5, 1, 6, box); placeBlockAtCurrentPosition(world, Blocks.cauldron, 0, 6, 1, 6, box); - placeBlockAtCurrentPosition(world, Blocks.tripwire_hook, 0, 6, 2, 6, box); - placeBlockAtCurrentPosition(world, Blocks.hopper, 3, 6, 1, 8, box); - placeBlockAtCurrentPosition(world, Blocks.trapdoor, 0, 6, 2, 8, box); - //Furnishing TODO: figure out beds - //placeBlockAtCurrentPosition(world, ModBlocks.bed, 2, 4, 1, 2, box); - //placeBlockAtCurrentPosition(world, ModBlocks.bed, 2, 5, 1, 2, box); + placeBlockAtCurrentPosition(world, Blocks.tripwire_hook, getTripwireMeta(0), 6, 2, 6, box); + placeBlockAtCurrentPosition(world, Blocks.hopper, getDecoMeta(3), 6, 1, 8, box); + placeBlockAtCurrentPosition(world, Blocks.trapdoor, getDecoModelMeta(0), 6, 2, 8, box); + //Furnishing + placeBed(world, box, 2, 4, 1, 2); + placeBed(world, box, 2, 5, 1, 2); fillWithMetadataBlocks(world, box, 6, 1, 1, 6, 1, 4, ModBlocks.concrete_slab, 9); placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(1), 5, 1, 4, box); placeBlockAtCurrentPosition(world, ModBlocks.radiorec, getDecoMeta(5), 6, 2, 1, box); @@ -642,15 +644,15 @@ public class BunkerComponents extends ProceduralComponents { } @Override - public void buildComponent(ControlComponent original, List components, Random rand) { + public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { - StructureComponent component = getNextComponentNormal(original, components, rand, 3, 1); + StructureComponent component = getNextComponentNormal(instance, original, components, rand, 3, 1); System.out.println("ComponentPZ:" + component); - StructureComponent componentN = getNextComponentNX(original, components, rand, 3, 1); + StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 3, 1); System.out.println("ComponentNX:" + componentN); - StructureComponent componentP = getNextComponentPX(original, components, rand, 3, 1); + StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 3, 1); System.out.println("ComponentPX:" + componentP); } @@ -690,19 +692,19 @@ public class BunkerComponents extends ProceduralComponents { } @Override - public void buildComponent(ControlComponent original, List components, Random rand) { + public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { checkModifiers(original); - StructureComponent component = getNextComponentNormal(original, components, rand, 1, 1); + StructureComponent component = getNextComponentNormal(instance, original, components, rand, 1, 1); extendsPZ = component != null; if(rand.nextInt(3) > 0) { - StructureComponent componentN = getNextComponentNX(original, components, rand, 6, 1); + StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 6, 1); expandsNX = componentN != null; } if(rand.nextInt(3) > 0) { - StructureComponent componentP = getNextComponentPX(original, components, rand, 6, 1); + StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 6, 1); expandsPX = componentP != null; } } @@ -716,7 +718,7 @@ public class BunkerComponents extends ProceduralComponents { int end = extendsPZ ? 14 : 13; fillWithAir(world, box, 1, 1, 0, 3, 3, end); - fillWithBlocks(world, box, 1, 0, 0, 3, 0, end, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 1, 0, 0, 3, 0, end, ModBlocks.vinyl_tile); //Walls for(int x = 0; x <= 4; x += 4) { @@ -736,7 +738,7 @@ public class BunkerComponents extends ProceduralComponents { //ExpandsNX if(expandsNX) { - fillWithBlocks(world, box, 0, 0, 6, 0, 0, 8, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 0, 0, 6, 0, 0, 8, ModBlocks.vinyl_tile); //Floor fillWithBlocks(world, box, 0, 1, 5, 0, 3, 5, ModBlocks.concrete_pillar); //Walls fillWithBlocks(world, box, 0, 1, 9, 0, 3, 9, ModBlocks.concrete_pillar); fillWithAir(world, box, 0, 1, 6, 0, 3, 8); @@ -749,7 +751,7 @@ public class BunkerComponents extends ProceduralComponents { //ExpandsPX if(expandsPX) { - fillWithBlocks(world, box, 4, 0, 6, 4, 0, 8, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 4, 0, 6, 4, 0, 8, ModBlocks.vinyl_tile); fillWithBlocks(world, box, 4, 1, 5, 4, 3, 5, ModBlocks.concrete_pillar); fillWithBlocks(world, box, 4, 1, 9, 4, 3, 9, ModBlocks.concrete_pillar); fillWithAir(world, box, 4, 1, 6, 4, 3, 8); @@ -788,7 +790,7 @@ public class BunkerComponents extends ProceduralComponents { private interface Wide { } //now you may ask yourself - where is that beautiful house? you may ask yourself - where does that highway go to? //you may ask yourself - am i right, am i wrong? you may say to yourself - my god, no multiple inheritance to be done! private interface Bulkhead { public void setBulkheadNZ(boolean bool); - public default void flipConstitutentBulkhead(StructureComponent component, Random rand) { + public default void flipConstituentBulkhead(StructureComponent component, Random rand) { if(component instanceof Bulkhead) { Bulkhead head = (Bulkhead) component; head.setBulkheadNZ(rand.nextInt(4) == 0); @@ -822,24 +824,24 @@ public class BunkerComponents extends ProceduralComponents { } @Override - public void buildComponent(ControlComponent original, List components, Random rand) { + public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { checkModifiers(original); - StructureComponent component = getNextComponentNormal(original, components, rand, 3, 1); + StructureComponent component = getNextComponentNormal(instance, original, components, rand, 3, 1); extendsPZ = component != null; if(component instanceof Wide) { bulkheadPZ = false; - flipConstitutentBulkhead(component, rand); + flipConstituentBulkhead(component, rand); } if(rand.nextInt(3) > 0) { - StructureComponent componentN = getNextComponentNX(original, components, rand, 6, 1); + StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 6, 1); expandsNX = componentN != null; } if(rand.nextInt(3) > 0) { - StructureComponent componentP = getNextComponentPX(original, components, rand, 6, 1); + StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 6, 1); expandsPX = componentP != null; } } @@ -857,11 +859,11 @@ public class BunkerComponents extends ProceduralComponents { fillWithAir(world, box, 1, 1, begin, 7, 3, end); //Floor - fillWithBlocks(world, box, 1, 0, begin, 1, 0, end, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 2, 0, begin, 2, 0, end, ModBlocks.tile_lab); - fillWithBlocks(world, box, 3, 0, 0, 5, 0, endExtend, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 6, 0, begin, 6, 0, end, ModBlocks.tile_lab); - fillWithBlocks(world, box, 7, 0, begin, 7, 0, end, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 1, 0, begin, 1, 0, end, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 2, 0, begin, 2, 0, end, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 3, 0, 0, 5, 0, endExtend, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 6, 0, begin, 6, 0, end, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 7, 0, begin, 7, 0, end, ModBlocks.vinyl_tile); int pillarMeta = getPillarMeta(8); //Walls @@ -873,7 +875,7 @@ public class BunkerComponents extends ProceduralComponents { fillWithBlocks(world, box, 0, 2, 10, 0, 2, end, ModBlocks.reinforced_stone); fillWithBlocks(world, box, 0, 3, 10, 0, 3, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 0, 6, 0, 0, 8, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 0, 0, 6, 0, 0, 8, ModBlocks.vinyl_tile); fillWithBlocks(world, box, 0, 1, 5, 0, 3, 5, ModBlocks.concrete_pillar); fillWithBlocks(world, box, 0, 1, 9, 0, 3, 9, ModBlocks.concrete_pillar); fillWithMetadataBlocks(world, box, 0, 4, 6, 0, 4, 8, ModBlocks.concrete_pillar, pillarMeta); @@ -893,7 +895,7 @@ public class BunkerComponents extends ProceduralComponents { fillWithBlocks(world, box, 8, 2, 10, 8, 2, end, ModBlocks.reinforced_stone); fillWithBlocks(world, box, 8, 3, 10, 8, 3, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 0, 6, 8, 0, 8, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 8, 0, 6, 8, 0, 8, ModBlocks.vinyl_tile); fillWithBlocks(world, box, 8, 1, 5, 8, 3, 5, ModBlocks.concrete_pillar); fillWithBlocks(world, box, 8, 1, 9, 8, 3, 9, ModBlocks.concrete_pillar); fillWithMetadataBlocks(world, box, 8, 4, 6, 8, 4, 8, ModBlocks.concrete_pillar, pillarMeta); @@ -1006,16 +1008,16 @@ public class BunkerComponents extends ProceduralComponents { } @Override - public void buildComponent(ControlComponent original, List components, Random rand) { + public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { checkModifiers(original); - StructureComponent component = getNextComponentNormal(original, components, rand, 1, 1); + StructureComponent component = getNextComponentNormal(instance, original, components, rand, 1, 1); opensPZ = component != null; - StructureComponent componentN = getNextComponentNX(original, components, rand, 1, 1); + StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 1, 1); opensNX = componentN != null; - StructureComponent componentP = getNextComponentPX(original, components, rand, 1, 1); + StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 1, 1); opensPX = componentP != null; } @@ -1041,7 +1043,7 @@ public class BunkerComponents extends ProceduralComponents { fillWithAir(world, box, 1, 1, 0, 3, 3, 3); //Floor - fillWithBlocks(world, box, 1, 0, 0, 3, 0, 3, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 1, 0, 0, 3, 0, 3, ModBlocks.vinyl_tile); //Ceiling int pillarMetaWE = getPillarMeta(4); int pillarMetaNS = getPillarMeta(8); @@ -1053,7 +1055,7 @@ public class BunkerComponents extends ProceduralComponents { placeLamp(world, box, rand, 2, 4, 2); if(opensPZ) { - fillWithBlocks(world, box, 1, 0, 4, 3, 0, 4, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 1, 0, 4, 3, 0, 4, ModBlocks.vinyl_tile); //Floor fillWithBlocks(world, box, 1, 4, 3, 1, 4, 4, ModBlocks.reinforced_brick); //Ceiling fillWithMetadataBlocks(world, box, 2, 4, 3, 2, 4, 4, ModBlocks.concrete_pillar, pillarMetaNS); fillWithBlocks(world, box, 3, 4, 3, 3, 4, 4, ModBlocks.reinforced_brick); @@ -1066,7 +1068,7 @@ public class BunkerComponents extends ProceduralComponents { } if(opensNX) { - fillWithBlocks(world, box, 0, 0, 1, 0, 0, 3, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 0, 0, 1, 0, 0, 3, ModBlocks.vinyl_tile); //Floor placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 1, box); //Ceiling fillWithMetadataBlocks(world, box, 0, 4, 2, 1, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 3, box); @@ -1079,7 +1081,7 @@ public class BunkerComponents extends ProceduralComponents { } if(opensPX) { - fillWithBlocks(world, box, 4, 0, 1, 4, 0, 3, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 4, 0, 1, 4, 0, 3, ModBlocks.vinyl_tile); //Floor placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 4, 1, box); //Ceiling fillWithMetadataBlocks(world, box, 3, 4, 2, 4, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 4, 3, box); @@ -1168,31 +1170,31 @@ public class BunkerComponents extends ProceduralComponents { } @Override - public void buildComponent(ControlComponent original, List components, Random rand) { + public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { checkModifiers(original); - StructureComponent component = getNextComponentNormal(original, components, rand, 3, 1); + StructureComponent component = getNextComponentNormal(instance, original, components, rand, 3, 1); opensPZ = component != null; if(component instanceof Wide) { bulkheadPZ = false; - flipConstitutentBulkhead(component, rand); + flipConstituentBulkhead(component, rand); } - StructureComponent componentN = getNextComponentNX(original, components, rand, 3, 1); + StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 3, 1); opensNX = componentN != null; if(componentN instanceof Wide) { bulkheadNX = false; - flipConstitutentBulkhead(component, rand); + flipConstituentBulkhead(component, rand); } - StructureComponent componentP = getNextComponentPX(original, components, rand, 3, 1); + StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 3, 1); opensPX = componentP != null; if(componentP instanceof Wide) { bulkheadPX = false; - flipConstitutentBulkhead(component, rand); + flipConstituentBulkhead(component, rand); } } @@ -1212,12 +1214,12 @@ public class BunkerComponents extends ProceduralComponents { fillWithAir(world, box, 1, 1, 0, 7, 3, end); //Floor - fillWithBlocks(world, box, 3, 0, 0, 5, 0, 1, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 2, 0, start, 2, 0, 6, ModBlocks.tile_lab); - fillWithBlocks(world, box, 3, 0, 2, 5, 0, 2, ModBlocks.tile_lab); - fillWithBlocks(world, box, 3, 0, 6, 5, 0, 6, ModBlocks.tile_lab); - fillWithBlocks(world, box, 6, 0, start, 6, 0, 6, ModBlocks.tile_lab); - fillWithBlocks(world, box, 3, 0, 3, 5, 0, 5, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 3, 0, 0, 5, 0, 1, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 2, 0, start, 2, 0, 6, ModBlocks.vinyl_tile, 1); + fillWithMetadataBlocks(world, box, 3, 0, 2, 5, 0, 2, ModBlocks.vinyl_tile, 1); + fillWithMetadataBlocks(world, box, 3, 0, 6, 5, 0, 6, ModBlocks.vinyl_tile, 1); + fillWithMetadataBlocks(world, box, 6, 0, start, 6, 0, 6, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 3, 0, 3, 5, 0, 5, ModBlocks.vinyl_tile); //Wall if(!bulkheadNZ || (opensNX && !bulkheadNX)) { placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 1, 0, box); @@ -1256,11 +1258,11 @@ public class BunkerComponents extends ProceduralComponents { fillWithAir(world, box, 1, 1, 0, 7, 3, 0); if(opensPZ) { - fillWithBlocks(world, box, 1, 0, 7, 1, 0, end, ModBlocks.deco_titanium); //Floor - fillWithBlocks(world, box, 2, 0, 7, 2, 0, end, ModBlocks.tile_lab); - fillWithBlocks(world, box, 3, 0, 7, 5, 0, 8, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 6, 0, 7, 6, 0, end, ModBlocks.tile_lab); - fillWithBlocks(world, box, 7, 0, 7, 7, 0, end, ModBlocks.deco_titanium); + fillWithBlocks(world, box, 1, 0, 7, 1, 0, end, ModBlocks.vinyl_tile); //Floor + fillWithMetadataBlocks(world, box, 2, 0, 7, 2, 0, end, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 3, 0, 7, 5, 0, 8, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 6, 0, 7, 6, 0, end, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 7, 0, 7, 7, 0, end, ModBlocks.vinyl_tile); fillWithBlocks(world, box, 1, 4, 7, 1, 4, end, ModBlocks.reinforced_brick); //Ceiling fillWithMetadataBlocks(world, box, 2, 4, 7, 2, 4, end, ModBlocks.concrete_pillar, pillarMetaNS); fillWithBlocks(world, box, 3, 4, 5, 3, 4, 8, ModBlocks.reinforced_brick); @@ -1280,7 +1282,7 @@ public class BunkerComponents extends ProceduralComponents { } else fillWithAir(world, box, 1, 1, 8, 7, 3, 8); } else { - fillWithBlocks(world, box, 1, 0, 7, 7, 0, 7, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 1, 0, 7, 7, 0, 7, ModBlocks.vinyl_tile); //Floor fillWithBlocks(world, box, 1, 1, 8, 7, 1, 8, ModBlocks.reinforced_brick); //Wall fillWithBlocks(world, box, 1, 2, 8, 7, 2, 8, ModBlocks.reinforced_stone); fillWithBlocks(world, box, 1, 3, 8, 7, 3, 8, ModBlocks.reinforced_brick); @@ -1290,11 +1292,11 @@ public class BunkerComponents extends ProceduralComponents { } if(opensNX) { - fillWithBlocks(world, box, 1, 0, start, 1, 0, 1, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 1, 0, start, 1, 0, 1, ModBlocks.vinyl_tile); //Floor - fillWithBlocks(world, box, right, 0, 2, 1, 0, 2, ModBlocks.tile_lab); - fillWithBlocks(world, box, 0, 0, 3, 1, 0, 5, ModBlocks.deco_titanium); - fillWithBlocks(world, box, right, 0, 6, 1, 0, 6, ModBlocks.tile_lab); + fillWithMetadataBlocks(world, box, right, 0, 2, 1, 0, 2, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 0, 0, 3, 1, 0, 5, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, right, 0, 6, 1, 0, 6, ModBlocks.vinyl_tile, 1); //Ceiling fillWithMetadataBlocks(world, box, right, 4, 2, 1, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); @@ -1313,13 +1315,13 @@ public class BunkerComponents extends ProceduralComponents { fillWithAir(world, box, 0, 1, 3, 0, 3, 5); } else { fillWithAir(world, box, 0, 1, 1, 0, 3, 7); - placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 0, 0, 1, box); //outlier single-block placing operations - placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 0, 0, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 0, 0, 0, 1, box); //outlier single-block placing operations + placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 0, 0, 0, 7, box); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 1, box); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 7, box); } } else { - fillWithBlocks(world, box, 1, 0, start, 1, 0, 6, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 1, 0, start, 1, 0, 6, ModBlocks.vinyl_tile); //Floor fillWithBlocks(world, box, 0, 1, 1, 0, 1, 7, ModBlocks.reinforced_brick); //Wall fillWithBlocks(world, box, 0, 2, 1, 0, 2, 7, ModBlocks.reinforced_stone); fillWithBlocks(world, box, 0, 3, 1, 0, 3, 7, ModBlocks.reinforced_brick); @@ -1330,10 +1332,10 @@ public class BunkerComponents extends ProceduralComponents { if(opensPX) { //Floor - fillWithBlocks(world, box, 7, 0, start, 7, 0, 1, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 7, 0, 2, left, 0, 2, ModBlocks.tile_lab); - fillWithBlocks(world, box, 7, 0, 3, 8, 0, 5, ModBlocks.deco_titanium); - fillWithBlocks(world, box, 7, 0, 6, left, 0, 6, ModBlocks.tile_lab); + fillWithBlocks(world, box, 7, 0, start, 7, 0, 1, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 7, 0, 2, left, 0, 2, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 7, 0, 3, 8, 0, 5, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 7, 0, 6, left, 0, 6, ModBlocks.vinyl_tile, 1); //Ceiling fillWithMetadataBlocks(world, box, 7, 4, 2, left, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); fillWithBlocks(world, box, 6, 4, 3, 8, 4, 3, ModBlocks.reinforced_brick); @@ -1351,13 +1353,13 @@ public class BunkerComponents extends ProceduralComponents { fillWithAir(world, box, 8, 1, 3, 8, 3, 5); } else { fillWithAir(world, box, 8, 1, 1, 8, 3, 7); - placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 8, 0, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.deco_titanium, 0, 8, 0, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 0, 8, 0, 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 0, 8, 0, 7, box); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 4, 1, box); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 4, 7, box); } } else { - fillWithBlocks(world, box, 7, 0, start, 7, 0, 6, ModBlocks.deco_titanium); //Floor + fillWithBlocks(world, box, 7, 0, start, 7, 0, 6, ModBlocks.vinyl_tile); //Floor fillWithBlocks(world, box, 8, 1, 1, 8, 1, 7, ModBlocks.reinforced_brick); //Wall fillWithBlocks(world, box, 8, 2, 1, 8, 2, 7, ModBlocks.reinforced_stone); fillWithBlocks(world, box, 8, 3, 1, 8, 3, 7, ModBlocks.reinforced_brick); diff --git a/src/main/java/com/hbm/world/worldgen/components/Component.java b/src/main/java/com/hbm/world/worldgen/components/Component.java index 2b3f15868..a35d30662 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Component.java +++ b/src/main/java/com/hbm/world/worldgen/components/Component.java @@ -166,7 +166,7 @@ abstract public class Component extends StructureComponent { } /** - * Get orientation-offset metadata for BlockDecoModel + * Get orientation-offset metadata for BlockDecoModel; also suitable for trapdoors * @param metadata (0 for facing North, 1 for facing South, 2 for facing West, 3 for facing East) */ protected int getDecoModelMeta(int metadata) { @@ -254,6 +254,52 @@ abstract public class Component extends StructureComponent { ItemDoor.placeDoorBlock(world, posX, posY, posZ, meta, door); } + //N:0 W:1 S:2 E:3 + protected void placeBed(World world, StructureBoundingBox box, int meta, int featureX, int featureY, int featureZ) { + int xOffset = 0; + int zOffset = 0; + + switch(meta & 3) { + default: + zOffset = 1; break; + case 1: + xOffset = -1; break; + case 2: + zOffset = -1; break; + case 3: + xOffset = 1; break; + } + + switch(this.coordBaseMode) { + default: //S + break; + case 1: //W + meta = (meta + 1) % 4; break; + case 2: //N + meta ^= 2; break; + case 3: //E + meta = (meta - 1) % 4; break; + } + + placeBlockAtCurrentPosition(world, Blocks.bed, meta, featureX, featureY, featureZ, box); + placeBlockAtCurrentPosition(world, Blocks.bed, meta + 8, featureX + xOffset, featureY, featureZ + zOffset, box); + } + + /**Tripwire Hook: S:0 W:1 N:2 E:3 */ + protected int getTripwireMeta(int metadata) { + switch(this.coordBaseMode) { + default: + return metadata; + case 1: + return (metadata + 1) % 4; + case 2: + return metadata ^ 2; + case 3: + return (metadata - 1) % 4; + } + } + + /** Loot Methods **/ /** diff --git a/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java b/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java index 28d208394..4ad3dd640 100644 --- a/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java @@ -12,30 +12,22 @@ import net.minecraft.world.gen.structure.StructureComponent; public abstract class ProceduralComponents { - protected static List componentWeightList; - static int totalWeight; + protected List componentWeightList; - /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - * The two methods/fields below *must* be recreated in the subclasses. - * Due to poor language design, Java does not allow the overriding/creation of static abstract methods; - * due to reasonable language design, Java does not allow overriding abstract fields. - * getWeightArray() should contain an array with Weight(s) for your components. - */ + protected static Weight[] weightArray = new Weight[] { }; - //protected static final Weight[] weightArray = new Weight[] { }; - - /*public static void prepareComponents() { + public void prepareComponents() { componentWeightList = new ArrayList(); for(int i = 0; i < weightArray.length; i++) { weightArray[i].instancesSpawned = 0; componentWeightList.add(weightArray[i]); } - }*/ + } - protected static boolean canAddStructurePieces() { + protected int getTotalWeight() { boolean flag = false; - totalWeight = 0; + int totalWeight = 0; Weight weight; for(Iterator iterator = componentWeightList.iterator(); iterator.hasNext(); totalWeight += weight.weight) { //Iterates over the entire list to find the total weight @@ -45,12 +37,13 @@ public abstract class ProceduralComponents { flag = true; } - return flag; + return flag ? totalWeight : -1; } - protected static ProceduralComponent getWeightedComponent(ControlComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { + protected ProceduralComponent getWeightedComponent(ControlComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { + int totalWeight = getTotalWeight(); - if(!canAddStructurePieces()) + if(totalWeight < 0) return null; for(int i = 0; i < 5; i++) { @@ -83,12 +76,15 @@ public abstract class ProceduralComponents { return null; } - protected static ProceduralComponent getNextValidComponent(ControlComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { + protected int sizeLimit = 50; + protected int distanceLimit = 64; + + protected ProceduralComponent getNextValidComponent(ControlComponent original, List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { - if(components.size() > 50) //Hard limit on amount of components + if(components.size() > sizeLimit) //Hard limit on amount of components return null; - if(Math.abs(minX - original.getBoundingBox().minX) <= 64 && Math.abs(minZ - original.getBoundingBox().minZ) <= 64) { //Hard limit on spread of structure + if(Math.abs(minX - original.getBoundingBox().minX) <= distanceLimit && Math.abs(minZ - original.getBoundingBox().minZ) <= distanceLimit) { //Hard limit on spread of structure ProceduralComponent structure = getWeightedComponent(original, components, rand, minX, minY, minZ, coordMode, componentType + 1); //Returns null if all checks fail @@ -103,6 +99,21 @@ public abstract class ProceduralComponents { return null; } + public static StructureBoundingBox getComponentToAddBoundingBox(int posX, int posY, int posZ, int offsetX, int offsetY, int offsetZ, int maxX, int maxY, int maxZ, int coordMode) { + switch(coordMode) { + case 0: //South + return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); + case 1: //West + return new StructureBoundingBox(posX - maxZ + 1 - offsetZ, posY + offsetY, posZ + offsetX, posX - offsetZ, posY + maxY - 1 + offsetY, posZ + maxX - 1 + offsetX); + case 2: //North + return new StructureBoundingBox(posX - maxX + 1 - offsetX, posY + offsetY, posZ - maxZ + 1 - offsetZ, posX - offsetX, posY + maxY - 1 + offsetY, posZ + offsetZ); + case 3: //East + return new StructureBoundingBox(posX + offsetZ, posY + offsetY, posZ - maxX + 1 - offsetX, posX + maxZ - 1 + offsetZ, posY + maxY - 1 + offsetY, posZ - offsetX); + default: + return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); + } + } + /** StructureComponent that supports procedural generation */ public abstract static class ProceduralComponent extends Component { @@ -112,19 +123,19 @@ public abstract class ProceduralComponents { super(componentType); //Important to carry over. } - public void buildComponent(ControlComponent original, List components, Random rand) { } + public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { } /** Gets next component in the direction this component is facing.
'original' refers to the initial starting component (hard distance limits), 'components' refers to the StructureStart list. */ - protected ProceduralComponent getNextComponentNormal(ControlComponent original, List components, Random rand, int offset, int offsetY) { + protected ProceduralComponent getNextComponentNormal(ProceduralComponents instance, ControlComponent original, List components, Random rand, int offset, int offsetY) { switch(this.coordBaseMode) { case 0: //South - return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType()); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, this.coordBaseMode, this.getComponentType()); case 1: //West - return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, this.coordBaseMode, this.getComponentType()); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, this.coordBaseMode, this.getComponentType()); case 2: //North - return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType()); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, this.coordBaseMode, this.getComponentType()); case 3: //East - return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, this.coordBaseMode, this.getComponentType()); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, this.coordBaseMode, this.getComponentType()); default: return null; } @@ -132,51 +143,36 @@ public abstract class ProceduralComponents { //Keep in mind for these methods: a given room would have its *actual entrance* opposite the side it is facing. /** Gets next component, to the West (-X) relative to this component. */ - protected ProceduralComponent getNextComponentNX(ControlComponent original, List components, Random rand, int offset, int offsetY) { + protected ProceduralComponent getNextComponentNX(ProceduralComponents instance, ControlComponent original, List components, Random rand, int offset, int offsetY) { switch(this.coordBaseMode) { case 0: //South - return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 1, this.getComponentType()); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 1, this.getComponentType()); case 1: //West - return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 2, this.getComponentType()); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 2, this.getComponentType()); case 2: //North - return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 3, this.getComponentType()); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 3, this.getComponentType()); case 3: //East - return getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 0, this.getComponentType()); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 0, this.getComponentType()); default: return null; } } /** Gets next component, to the East (+X) relative to this component. */ - protected ProceduralComponent getNextComponentPX(ControlComponent original, List components, Random rand, int offset, int offsetY) { + protected ProceduralComponent getNextComponentPX(ProceduralComponents instance, ControlComponent original, List components, Random rand, int offset, int offsetY) { switch(this.coordBaseMode) { case 0: //South - return getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 1, this.getComponentType() + 1); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 1, this.getComponentType() + 1); case 1: //West - return getNextValidComponent(original, components, rand, this.boundingBox.minZ + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 2, this.getComponentType() + 1); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.minZ + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 2, this.getComponentType() + 1); case 2: //North - return getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 3, this.getComponentType() + 1); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 3, this.getComponentType() + 1); case 3: //East - return getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 0, this.getComponentType() + 1); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 0, this.getComponentType() + 1); default: return null; } } - - public static StructureBoundingBox getComponentToAddBoundingBox(int posX, int posY, int posZ, int offsetX, int offsetY, int offsetZ, int maxX, int maxY, int maxZ, int coordMode) { - switch(coordMode) { - case 0: //South - return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); - case 1: //West - return new StructureBoundingBox(posX - maxZ + 1 - offsetZ, posY + offsetY, posZ + offsetX, posX - offsetZ, posY + maxY - 1 + offsetY, posZ + maxX - 1 + offsetX); - case 2: //North - return new StructureBoundingBox(posX - maxX + 1 - offsetX, posY + offsetY, posZ - maxZ + 1 - offsetZ, posX - offsetX, posY + maxY - 1 + offsetY, posZ + offsetZ); - case 3: //East - return new StructureBoundingBox(posX + offsetZ, posY + offsetY, posZ - maxX + 1 - offsetX, posX + maxZ - 1 + offsetZ, posY + maxY - 1 + offsetY, posZ - offsetX); - default: - return new StructureBoundingBox(posX + offsetX, posY + offsetY, posZ + offsetZ, posX + maxX - 1 + offsetX, posY + maxY - 1 + offsetY, posZ + maxZ - 1 + offsetZ); - } - } } /** ProceduralComponent that can serve as a master "control component" for procedural generation and building of components. */ @@ -198,7 +194,6 @@ public abstract class ProceduralComponents { ProceduralComponent findValidPlacement(List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType); } - protected static class Weight { public final instantiateStructure lambda; //Read above diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 1d7c1ca58..00e0b8aa5 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -4434,6 +4434,8 @@ tile.vent_chlorine.name=Chlorine Vent tile.vent_chlorine_seal.name=Chlorine Seal tile.vent_cloud.name=Cloud Vent tile.vent_pink_cloud.name=Pink Cloud Vent +tile.vinyl_tile.large.name=Large Vinyl Tile +tile.vinyl_tile.small.name=Small Vinyl Tiles tile.vitrified_barrel.name=Vitrified Nuclear Waste Drum tile.volcanic_lava_block.name=Volcanic Lava tile.volcano_core.name=Volcano Core diff --git a/src/main/resources/assets/hbm/textures/blocks/vinyl_tile.large.png b/src/main/resources/assets/hbm/textures/blocks/vinyl_tile.large.png new file mode 100644 index 0000000000000000000000000000000000000000..b61db5d9c1dda17f3fadb6caa63ec26ee63d5bba GIT binary patch literal 1515 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|jKx9jP7LeL$-D$|rlm%Bruq6Z zXaU(A3~Y=-49p-UK*+!-#lQ+?GcbfPO2gT4j2ciiKrt0T75u@v%n*=n1O*? z7=#%aX3ddcU|`P342dX-@b$4u&d=3LOvz75)vL%Y0O?||sjvbvb5lza6)JLb@`|l0 zY?Z(&tblBgu)dN4SV>8?tx|+b0Y&F&^H8;Hed&$NF%%l(HenY zE3!1YR)o&byv!0iBdBd?!sxpEi!xJzF#>k0Ayf;p7?OHWFj;{UXQWGJZfagJ$bW`r zHu_j4uxgCJr4dO2Nh2`qt$cwgF(t7i(Iv4Y)y~KOn2Zb!bPdfy3@xlo4XunVv<(cc zKtYS47R?;zqEt|p3dzsUu|v;c5Z%Zspqg#;L1_^wZ9)=0SQMD@?YMwCVY$eTOStWS zJTM8?|RXPAE5D_v^^+5~ ze7=@(r}}l4sN5cgyYu};cZx1?(DhKVw%Zi`c1`Eq_1A^DZiH;xIzyQE;LNsl#tZy) zOdA54wq?8BpIbD~x%hAT+#UbtSo%(`mu~oXg;v#vW~a-pKZD{9xZ z`JNiAGjCl03($&8gv{ zy)~ghG^5Adp5wypwZadBGTsFmn-o5~ASLii;=Q9o{v8MA$NJ_g*Ju~pCp`z1Z=SAx JF6*2Ung9Z`-);Z^ literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/hbm/textures/blocks/vinyl_tile.small.png b/src/main/resources/assets/hbm/textures/blocks/vinyl_tile.small.png new file mode 100644 index 0000000000000000000000000000000000000000..728cd583413cf7e28ec7453831a38c162d94e221 GIT binary patch literal 1321 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|jKx9jP7LeL$-D$|rlm%Bruq6Z zXaU(A3~Y=-49p-UK*+!-#lQ+?GcbfPO2gT4j2ciiKrt0T75u@v%n*=n1O*? z7=#%aX3ddcU|`P342dX-@b$4u&d=3LOvz75)vL%Y0O?||sjvbvb5lza6)JLb@`|l0 zY?Z(&tblBgu)dN4SV>8?tx|+b0Y&F&^H8;Hed&$NF%%l(HenY zE3!1YR)o&byv!0iBdBd?!sxpEi!xJzF#>k0Ayf;p7?OHWFj;{UXQWGJZfagJ$bW`r zHu_j4uxgCJr4dO2Nh2`qt$cwgF(t7i(Iv4Y)y~KOn2Zb!bPdfy3@xlo%&d&ewG9ld zKtYS47R?;zqEt|p3dzsUu|v;c5Z%Zspqg#;L1_^wZ9)=0SQMD@?YMwCVY$eTOY&UP zVPMAE;pyTSq9OWr;%Po6MIKj1>AO~0X^+Bxsp|a=lx6jjkBdEgX>N;1(WT?L()!z1 z&n{m3bZT;s^eql^ORx+x|eQ>*NB}5Q##odD9OYm4CnR^uO(&6#o2~6Gf_K Date: Thu, 20 Oct 2022 15:00:50 -0700 Subject: [PATCH 15/30] ItemBookLore, GUIBookLore, instant pain story of my life https://cdn.discordapp.com/attachments/759183012494966795/1024516652278231110/trim.1B823851-DAB1-4A47-B5CE-BFB3B7062D4E_1.mov --- src/main/java/com/hbm/handler/GUIHandler.java | 7 + .../com/hbm/inventory/gui/GUIBookLore.java | 287 ++++++++++++++++++ src/main/java/com/hbm/items/ModItems.java | 3 + .../com/hbm/items/special/ItemBookLore.java | 135 ++++++++ src/main/resources/assets/hbm/lang/en_US.lang | 9 + 5 files changed, 441 insertions(+) create mode 100644 src/main/java/com/hbm/inventory/gui/GUIBookLore.java create mode 100644 src/main/java/com/hbm/items/special/ItemBookLore.java diff --git a/src/main/java/com/hbm/handler/GUIHandler.java b/src/main/java/com/hbm/handler/GUIHandler.java index 647b1112d..8492e2666 100644 --- a/src/main/java/com/hbm/handler/GUIHandler.java +++ b/src/main/java/com/hbm/handler/GUIHandler.java @@ -21,6 +21,7 @@ import com.hbm.wiaj.GuiWorldInAJar; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; @@ -847,6 +848,12 @@ public class GUIHandler implements IGuiHandler { return ((IGUIProvider) block).provideGUI(ID, player, world, x, y, z); } + Item item = player.getHeldItem().getItem(); + + if(item instanceof IGUIProvider) { + return ((IGUIProvider) item).provideGUI(ID, player, world, x, y, z); + } + //stop doing this unless you absolutely have to \/ if(entity instanceof TileEntityCrateIron) { return new GUICrateIron(player.inventory, (TileEntityCrateIron) entity); } diff --git a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java new file mode 100644 index 000000000..e0d2839fa --- /dev/null +++ b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java @@ -0,0 +1,287 @@ +package com.hbm.inventory.gui; + +import java.util.ArrayList; +import java.util.List; + +import org.lwjgl.opengl.GL11; + +import com.hbm.items.special.ItemBookLore.*; +import com.hbm.items.tool.ItemGuideBook.BookType; +import com.hbm.lib.RefStrings; +import com.hbm.util.I18nUtil; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.ResourceLocation; + +// and you may ask yourself: vaer, why do this? this is basically just a copy of GUIScreenGuide. +// and I would answer, shut the fuck up nerd, the guide book system is too involved for my small +// brain to use for god knows how many tidbits of lore. i'll settle for a text box and cool textures, thanks +public class GUIBookLore extends GuiScreen { + + protected int xSize; + protected int ySize; + protected int guiLeft; + protected int guiTop; + + private BookLoreType type; + private GUIAppearance setup; + + int page = 0; + int maxPage; + + public GUIBookLore(EntityPlayer player) { + + type = BookLoreType.getTypeFromStack(player.getHeldItem()); + setup = type.appearance; + + if(setup.mainPage.isTwoPages && type.pages <= 1) { + xSize = setup.auxPage.sizeX; + ySize = setup.auxPage.sizeY; + } else { + xSize = setup.mainPage.sizeX; + ySize = setup.mainPage.sizeY; + } + + maxPage = setup.mainPage.isTwoPages ? (int)Math.ceil(type.pages / 2D) - 1 : type.pages; + System.out.print((int)Math.ceil(type.pages / 2D) - 1); + } + + @Override + public void initGui() { + super.initGui(); + this.guiLeft = (this.width - this.xSize) / 2; + this.guiTop = (this.height - this.ySize) / 2; + } + + @Override + public void drawScreen(int mouseX, int mouseY, float f) { + this.drawDefaultBackground(); + this.drawGuiContainerBackgroundLayer(f, mouseX, mouseY); + GL11.glDisable(GL11.GL_LIGHTING); + this.drawGuiContainerForegroundLayer(mouseX, mouseY); + GL11.glEnable(GL11.GL_LIGHTING); + } + + protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + + if(page == maxPage && setup.mainPage.isTwoPages && this.page * 2 >= this.type.pages) //odd numbered pages + Minecraft.getMinecraft().getTextureManager().bindTexture(setup.auxPage.texture); + else + Minecraft.getMinecraft().getTextureManager().bindTexture(setup.mainPage.texture); + + func_146110_a(guiLeft, guiTop, 0, 0, xSize, ySize, 512, 512); + + if(page > 0) + setup.button.renderButton(this, xSize, guiLeft, guiTop, false, i, j); + + if(page < maxPage) + setup.button.renderButton(this, xSize, guiLeft, guiTop, true, i, j); + } + + protected void drawGuiContainerForegroundLayer(int x, int y) { + String key = "book_lore." + type.keyI18n + ".page."; + + if(setup.mainPage.isTwoPages) { + int defacto = this.page * 2 + 1; + + if((this.page + 1) * 2 <= this.type.pages) { //TODO: change this to make it accurate for odd-numbered max pages + setup.mainPage.renderText(key + defacto, fontRendererObj, guiLeft, guiTop, false); + setup.mainPage.renderText(key + (defacto + 1), fontRendererObj, guiLeft, guiTop, true); + } else + setup.auxPage.renderText(key + defacto, fontRendererObj, guiLeft, guiTop, false); + + } else { + setup.mainPage.renderText(key + page, fontRendererObj, guiLeft, guiTop, false); + } + + } + + @Override + protected void mouseClicked(int i, int j, int k) { + int q = 0; //if both buttons are somehow simultaneously clicked then obviously something's wrong already + + if(page > 0) + q = setup.button.handleInput(xSize, guiLeft, guiTop, false, i, j); + + if(page < maxPage && q == 0) + q = setup.button.handleInput(xSize, guiLeft, guiTop, true, i, j); + + if(q != 0) { + mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); + this.page += q; + } + } + + @Override + protected void keyTyped(char c, int key) { + if(key == 1 || key == this.mc.gameSettings.keyBindInventory.getKeyCode()) { + this.mc.thePlayer.closeScreen(); + } + } + + // turn page buttons, one-page, both page textures, sizes, positions, etc. + public enum GUIAppearance { + GUIDEBOOK(new GUIPage(272, 182, 20, 20, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/book.png")).setScale(2F), + new GUIPageButton(18, 10, 24, 155, 0, 0, 500, 200, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/starter6.png")), + 0); + + public int itemTexture; + + protected GUIPage mainPage; //"Main" page, usually two pages. GUI accounts for one-paged main pages. + protected GUIPage auxPage; //"Aux" page, AKA the final page if the max pages is oddly numbered. + //If two-sided, text will be positioned on the left page. Can be null if main page is one-sided. + protected GUIPageButton button; + + private GUIAppearance(GUIPage main, GUIPage aux, GUIPageButton button, int texture) { + this.mainPage = main; + this.auxPage = aux; + this.button = button; + this.itemTexture = texture; + } + + private GUIAppearance(GUIPage main, GUIPageButton button, int texture) { + this.mainPage = main; + this.auxPage = main; + this.button = button; + this.itemTexture = texture; + } + + } + + private static class GUIPage { + protected ResourceLocation texture; + + protected int sizeX; + protected int sizeY; + + //Text positioning + protected int marginX; //Boundaries of the textbook, relative to the pages' edges. + protected int marginY; //Mirrored on both sides if two-sided. + protected boolean isTwoPages = true; + protected float scale = 1.0F; + + protected GUIPage(int x, int y, int marX, int marY, ResourceLocation texture, boolean twoPages) { + this.sizeX = x; + this.sizeY = y; + this.marginX = marX; + this.marginY = marY; + this.texture = texture; + this.isTwoPages = twoPages; + } + + protected GUIPage(int x, int y, int marX, int marY, ResourceLocation texture) { + this.sizeX = x; + this.sizeY = y; + this.marginX = marX; + this.marginY = marY; + this.texture = texture; + } + + protected GUIPage setScale(float scale) { + this.scale = scale; + return this; + } + + protected void renderText(String key, FontRenderer renderer, int left, int top, boolean secondPage) { + String text = I18nUtil.resolveKey(key); + int width = isTwoPages ? (sizeX / 2) - (marginX * 2) : sizeX - (marginX * 2); + int widthScaled = (int) (width * scale); + + List lines = new ArrayList(); + String[] words = text.split(" "); + + lines.add(words[0]); + int indent = renderer.getStringWidth(words[0]); + + for(int w = 1; w < words.length; w++) { + + indent += renderer.getStringWidth(" " + words[w]); + + if(indent <= widthScaled) { + String last = lines.get(lines.size() - 1); + lines.set(lines.size() - 1, last += (" " + words[w])); + } else { + lines.add(words[w]); + indent = renderer.getStringWidth(words[w]); + } + } + + GL11.glPushMatrix(); + GL11.glScalef(1F/scale, 1F/scale, 1F); + + int sideOffset = secondPage ? sizeX - marginX - width : marginX; + + for(int l = 0; l < lines.size(); l++) { + renderer.drawString(lines.get(l), (int)((left + sideOffset) * scale), (int)((top + marginY) * scale + (12 * l)), 4210752); + } + + GL11.glPopMatrix(); + } + } + + private static class GUIPageButton { + protected ResourceLocation texture; + + protected int sizeX; //size of a single button; full texture is 2*sizeX : 2*sizeZ + protected int sizeY; + protected int x; //x position on page, relative to edge of the page it is on. + protected int y; //y position on page, relative to the top edge of the page. + + /* Left, Unsel | Right, Unsel + * Left, Sel | Right, Sel + */ + protected int u; //upper lefthand corner where the button textures lie. + protected int v; //assumes uniform size for each. + protected int sizeU; + protected int sizeV; + + protected GUIPageButton(int sizeX, int sizeY, int x, int y, int u, int v, int sizeU, int sizeV, ResourceLocation tex) { + this.sizeX = sizeX; + this.sizeY = sizeY; + this.x = x; + this.y = y; + this.u = u; + this.v = v; + this.texture = tex; + this.sizeU = sizeU; + this.sizeV = sizeV; + } + + protected void renderButton(GuiScreen screen, int width, int left, int top, boolean rightPage, int i, int j) { + Minecraft.getMinecraft().getTextureManager().bindTexture(texture); + boolean overY = j >= top + y && j < top + y + sizeY; + + if(!rightPage) { + if(i >= left + x && i < left + x + sizeX && overY) { + func_146110_a(left + x, top + y, u, v + sizeY, sizeX, sizeY, sizeX * 2, sizeY * 2); + } else { + func_146110_a(left + x, top + y, u, v, sizeX, sizeY, sizeX * 2, sizeY * 2); + } + } else { + if(i >= left + width - x - sizeX && i < left + width - x && overY) { + func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v + sizeY, sizeX, sizeY, sizeX * 2, sizeY * 2); + } else { + func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v, sizeX, sizeY, sizeX * 2, sizeY * 2); + } + } + } + + protected int handleInput(int width, int left, int top, boolean rightPage, int i, int j) { + boolean overY = j >= top + y && j < top + y + sizeY; + if(!rightPage) { + if(i >= left + x && i < left + x + sizeX && overY) + return -1; + } else { + if(i >= left + width - x - sizeX && i < left + width - x && overY) + return 1; + } + + return 0; + } + } +} \ No newline at end of file diff --git a/src/main/java/com/hbm/items/ModItems.java b/src/main/java/com/hbm/items/ModItems.java index 0be9a8f18..ac60a74f1 100644 --- a/src/main/java/com/hbm/items/ModItems.java +++ b/src/main/java/com/hbm/items/ModItems.java @@ -2450,6 +2450,7 @@ public class ModItems { public static Item record_glass; public static Item book_guide; + public static Item book_lore; public static Item holotape_image; public static Item holotape_damaged; @@ -5611,6 +5612,7 @@ public class ModItems { record_glass = new ItemModRecord("glass").setUnlocalizedName("record_glass").setCreativeTab(null).setTextureName(RefStrings.MODID + ":record_glass"); book_guide = new ItemGuideBook().setUnlocalizedName("book_guide").setCreativeTab(MainRegistry.consumableTab).setTextureName(RefStrings.MODID + ":book_guide"); + book_lore = new ItemBookLore().setUnlocalizedName("book_lore").setCreativeTab(null).setTextureName(RefStrings.MODID + ":holotape"); holotape_image = new ItemHolotapeImage().setUnlocalizedName("holotape_image").setCreativeTab(null).setTextureName(RefStrings.MODID + ":holotape"); holotape_damaged = new Item().setUnlocalizedName("holotape_damaged").setCreativeTab(null).setTextureName(RefStrings.MODID + ":holotape_damaged"); @@ -8179,6 +8181,7 @@ public class ModItems { //wow we're far down the item registry, is this the cellar? GameRegistry.registerItem(book_guide, book_guide.getUnlocalizedName()); + GameRegistry.registerItem(book_lore, book_lore.getUnlocalizedName()); GameRegistry.registerItem(holotape_image, holotape_image.getUnlocalizedName()); GameRegistry.registerItem(holotape_damaged, holotape_damaged.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/items/special/ItemBookLore.java b/src/main/java/com/hbm/items/special/ItemBookLore.java new file mode 100644 index 000000000..e4c6c78bd --- /dev/null +++ b/src/main/java/com/hbm/items/special/ItemBookLore.java @@ -0,0 +1,135 @@ +package com.hbm.items.special; + +import java.util.List; + +import com.hbm.inventory.gui.GUIBookLore; +import com.hbm.inventory.gui.GUIBookLore.GUIAppearance; +import com.hbm.items.tool.ItemGuideBook.BookType; +import com.hbm.lib.RefStrings; +import com.hbm.main.MainRegistry; +import com.hbm.tileentity.IGUIProvider; +import com.hbm.util.I18nUtil; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; + +/*players can have a lil lore, as a treat. + * nothing super complex like the guidebooks, just some NBT IDs, a bit of I18n and a centered textbox. + * oh, and also different textures for both the book, the gui, and maybe the 'turn page' button based on what type of 'book' it is. + * no metadata, i want it to be fairly flexible. probably like the assembly templates + */ +public class ItemBookLore extends Item implements IGUIProvider { + + public ItemBookLore() { + this.setMaxStackSize(1); + } + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { + + if(world.isRemote) + player.openGui(MainRegistry.instance, 0, world, 0, 0, 0); + + return stack; + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { + BookLoreType type = BookLoreType.getTypeFromStack(stack); + + if(type.hasAuthor) { + String unloc = I18nUtil.resolveKey("book_lore.author", I18nUtil.resolveKey("book_lore." + type.keyI18n + ".author")); + + list.add(unloc); + } + } + + @Override + public String getUnlocalizedName(ItemStack stack) { + BookLoreType type = BookLoreType.getTypeFromStack(stack); + + return "book_lore." + type.keyI18n; + } + + protected IIcon[] icons; + //fuck you, fuck enums, fuck guis, fuck this shitty ass fork. shove that string array up your ass. + public static String[] itemTextures = new String[] { ":book_guide" }; + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister reg) { + String[] iconStrings = itemTextures; + this.icons = new IIcon[itemTextures.length]; + + for(int i = 0; i < icons.length; i++) { + this.icons[i] = reg.registerIcon(RefStrings.MODID + itemTextures[i]); + } + } + + @Override + public IIcon getIconIndex(ItemStack stack) { + return this.getIcon(stack, 1); + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + BookLoreType type = BookLoreType.getTypeFromStack(stack); + + return this.icons[type.appearance.itemTexture]; + } + + @Override + public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { + return null; + } + + @Override + public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { + return new GUIBookLore(player); + } + + public enum BookLoreType { + TEST(true, "test", 5, GUIAppearance.GUIDEBOOK); + + //Why? it's quite simple; i am too burnt out and also doing it the other way + //is too inflexible for my taste + public final GUIAppearance appearance; //gui and item texture appearance + + public boolean hasAuthor = false; + public final String keyI18n; + public final int pages; + + private BookLoreType(Boolean author, String key, int max, GUIAppearance appearance) { + this.hasAuthor = author; + this.keyI18n = key; + this.pages = max; + this.appearance = appearance; + } + + private BookLoreType(String key, int max, GUIAppearance appearance) { + this.keyI18n = key; + this.pages = max; + this.appearance = appearance; + } + + public static BookLoreType getTypeFromStack(ItemStack stack) { + if(!stack.hasTagCompound()) { + stack.stackTagCompound = new NBTTagCompound(); + } + + NBTTagCompound tag = stack.getTagCompound(); + int ordinal = tag.getInteger("bookLoreOrdinal"); + + return BookLoreType.values()[Math.abs(ordinal) % BookType.values().length]; + } + } +} diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 00e0b8aa5..0c5288be7 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -314,6 +314,15 @@ book.starter.page18=vær is just a guy who has been trapped in the grey void fea #book.rbmk.title16=Meltdown #book.rbmk.page16=§4§lAvoid. +book_lore.author=By %s +book_lore.test.name=Test +book_lore.test.author=the dude +book_lore.test.page.1=>hello anons before i begin let me clarify that i'm not gay. >Be me >This night >18 > At hanging out with my best friend with my parents gone for a few days >We've been best friends for a year now >Been drinking a bit and playing lots of video games and ordered a pizza >We were having a blast >At a certain point in the night like around 9:00 he makes a really funny joke that I don't remember but I know that it made us both laugh really hard > With out thinking I brush my right hand through his semi-curly black hair and call him a funny boy >He blushes >I realize I'm feeling flustered >We're kinda close >All of the sudden he kisses me and for some reason I kiss him back >We make love >Cuddle together and fall asleep >Wake up in the middle of the night with his head snuggled up on my chest and neck area >It feels nice but I'm not a homosexual +book_lore.test.page.2=I'm typing this as he's asleep in my arms. How do I let my best friend down nicely? I don't want to be a [redacted] /b/ +book_lore.test.page.3=3 +book_lore.test.page.4=4 +book_lore.test.page.5=5 + cannery.f1=[ Press F1 for help ] cannery.centrifuge=Gas Centrifuge From 77c1b53e31c85fc3980560b605831540ebc9c091 Mon Sep 17 00:00:00 2001 From: Vaern Date: Thu, 20 Oct 2022 21:06:00 -0700 Subject: [PATCH 16/30] Loose Paper appearance type, fixes, new page textures --- .../com/hbm/inventory/gui/GUIBookLore.java | 67 ++++++++++++------ .../com/hbm/items/special/ItemBookLore.java | 4 +- .../worldgen/components/BunkerComponents.java | 3 + .../textures/gui/book/notebook_and_papers.png | Bin 0 -> 13308 bytes .../hbm/textures/items/papers_loose.png | Bin 0 -> 263 bytes 5 files changed, 51 insertions(+), 23 deletions(-) create mode 100644 src/main/resources/assets/hbm/textures/gui/book/notebook_and_papers.png create mode 100644 src/main/resources/assets/hbm/textures/items/papers_loose.png diff --git a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java index e0d2839fa..fef6a8986 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java +++ b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java @@ -46,7 +46,7 @@ public class GUIBookLore extends GuiScreen { ySize = setup.mainPage.sizeY; } - maxPage = setup.mainPage.isTwoPages ? (int)Math.ceil(type.pages / 2D) - 1 : type.pages; + maxPage = setup.mainPage.isTwoPages ? (int)Math.ceil(type.pages / 2D) - 1 : type.pages - 1; System.out.print((int)Math.ceil(type.pages / 2D) - 1); } @@ -69,18 +69,21 @@ public class GUIBookLore extends GuiScreen { protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - if(page == maxPage && setup.mainPage.isTwoPages && this.page * 2 >= this.type.pages) //odd numbered pages + if(page == maxPage && (page + 1) * 2 > type.pages) { //odd numbered pages Minecraft.getMinecraft().getTextureManager().bindTexture(setup.auxPage.texture); - else + func_146110_a(guiLeft, guiTop, setup.auxPage.u, setup.auxPage.v, setup.auxPage.sizeX, setup.auxPage.sizeY, 512, 512); + } else { Minecraft.getMinecraft().getTextureManager().bindTexture(setup.mainPage.texture); + func_146110_a(guiLeft, guiTop, setup.mainPage.u, setup.mainPage.v, setup.mainPage.sizeX, setup.mainPage.sizeY, 512, 512); + } - func_146110_a(guiLeft, guiTop, 0, 0, xSize, ySize, 512, 512); + int width = page == maxPage && (page + 1) * 2 > type.pages ? setup.auxPage.sizeX : setup.mainPage.sizeX; if(page > 0) - setup.button.renderButton(this, xSize, guiLeft, guiTop, false, i, j); + setup.button.renderButton(this, width, guiLeft, guiTop, false, i, j); if(page < maxPage) - setup.button.renderButton(this, xSize, guiLeft, guiTop, true, i, j); + setup.button.renderButton(this, width, guiLeft, guiTop, true, i, j); } protected void drawGuiContainerForegroundLayer(int x, int y) { @@ -96,7 +99,11 @@ public class GUIBookLore extends GuiScreen { setup.auxPage.renderText(key + defacto, fontRendererObj, guiLeft, guiTop, false); } else { - setup.mainPage.renderText(key + page, fontRendererObj, guiLeft, guiTop, false); + + if(page < maxPage) + setup.mainPage.renderText(key + (page + 1), fontRendererObj, guiLeft, guiTop, false); + else + setup.auxPage.renderText(key + (page + 1), fontRendererObj, guiLeft, guiTop, false); } } @@ -127,14 +134,18 @@ public class GUIBookLore extends GuiScreen { // turn page buttons, one-page, both page textures, sizes, positions, etc. public enum GUIAppearance { GUIDEBOOK(new GUIPage(272, 182, 20, 20, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/book.png")).setScale(2F), - new GUIPageButton(18, 10, 24, 155, 0, 0, 500, 200, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/starter6.png")), - 0); + new GUIPageButton(18, 10, 24, 155, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/starter6.png")).setUV(0, 0, 500, 200), + 0), + LOOSEPAPER(new GUIPage(133, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F), + new GUIPage(130, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F).setUV(133, 0), + new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512), + 1); public int itemTexture; protected GUIPage mainPage; //"Main" page, usually two pages. GUI accounts for one-paged main pages. protected GUIPage auxPage; //"Aux" page, AKA the final page if the max pages is oddly numbered. - //If two-sided, text will be positioned on the left page. Can be null if main page is one-sided. + //If two-sided, text will be positioned on the left page. protected GUIPageButton button; private GUIAppearance(GUIPage main, GUIPage aux, GUIPageButton button, int texture) { @@ -156,6 +167,10 @@ public class GUIBookLore extends GuiScreen { private static class GUIPage { protected ResourceLocation texture; + //UV positioning + protected int u = 0; + protected int v = 0; + protected int sizeX; protected int sizeY; @@ -164,7 +179,7 @@ public class GUIBookLore extends GuiScreen { protected int marginY; //Mirrored on both sides if two-sided. protected boolean isTwoPages = true; protected float scale = 1.0F; - + //TODO: split marginX into a left and right margin protected GUIPage(int x, int y, int marX, int marY, ResourceLocation texture, boolean twoPages) { this.sizeX = x; this.sizeY = y; @@ -182,6 +197,12 @@ public class GUIBookLore extends GuiScreen { this.texture = texture; } + protected GUIPage setUV(int u, int v) { + this.u = u; + this.v = v; + return this; + } + protected GUIPage setScale(float scale) { this.scale = scale; return this; @@ -235,21 +256,25 @@ public class GUIBookLore extends GuiScreen { /* Left, Unsel | Right, Unsel * Left, Sel | Right, Sel */ - protected int u; //upper lefthand corner where the button textures lie. - protected int v; //assumes uniform size for each. - protected int sizeU; - protected int sizeV; + protected int u = 0; //upper lefthand corner where the button textures lie. + protected int v = 0; //assumes uniform size for each. + protected int sizeU = sizeX * 2; //Size of UV texture + protected int sizeV = sizeY * 2; - protected GUIPageButton(int sizeX, int sizeY, int x, int y, int u, int v, int sizeU, int sizeV, ResourceLocation tex) { + protected GUIPageButton(int sizeX, int sizeY, int x, int y, ResourceLocation tex) { this.sizeX = sizeX; this.sizeY = sizeY; this.x = x; this.y = y; + this.texture = tex; + } + + protected GUIPageButton setUV(int u, int v, int sizeU, int sizeV) { this.u = u; this.v = v; - this.texture = tex; this.sizeU = sizeU; this.sizeV = sizeV; + return this; } protected void renderButton(GuiScreen screen, int width, int left, int top, boolean rightPage, int i, int j) { @@ -258,15 +283,15 @@ public class GUIBookLore extends GuiScreen { if(!rightPage) { if(i >= left + x && i < left + x + sizeX && overY) { - func_146110_a(left + x, top + y, u, v + sizeY, sizeX, sizeY, sizeX * 2, sizeY * 2); + func_146110_a(left + x, top + y, u, v + sizeY, sizeX, sizeY, sizeU, sizeV); } else { - func_146110_a(left + x, top + y, u, v, sizeX, sizeY, sizeX * 2, sizeY * 2); + func_146110_a(left + x, top + y, u, v, sizeX, sizeY, sizeU, sizeV); } } else { if(i >= left + width - x - sizeX && i < left + width - x && overY) { - func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v + sizeY, sizeX, sizeY, sizeX * 2, sizeY * 2); + func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v + sizeY, sizeX, sizeY, sizeU, sizeV); } else { - func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v, sizeX, sizeY, sizeX * 2, sizeY * 2); + func_146110_a(left + width - x - sizeX, top + y, u + sizeX, v, sizeX, sizeY, sizeU, sizeV); } } } diff --git a/src/main/java/com/hbm/items/special/ItemBookLore.java b/src/main/java/com/hbm/items/special/ItemBookLore.java index e4c6c78bd..2df994562 100644 --- a/src/main/java/com/hbm/items/special/ItemBookLore.java +++ b/src/main/java/com/hbm/items/special/ItemBookLore.java @@ -63,7 +63,7 @@ public class ItemBookLore extends Item implements IGUIProvider { protected IIcon[] icons; //fuck you, fuck enums, fuck guis, fuck this shitty ass fork. shove that string array up your ass. - public static String[] itemTextures = new String[] { ":book_guide" }; + public static String[] itemTextures = new String[] { ":book_guide", ":papers_loose" }; @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister reg) { @@ -98,7 +98,7 @@ public class ItemBookLore extends Item implements IGUIProvider { } public enum BookLoreType { - TEST(true, "test", 5, GUIAppearance.GUIDEBOOK); + TEST(true, "test", 5, GUIAppearance.LOOSEPAPER); //Why? it's quite simple; i am too burnt out and also doing it the other way //is too inflexible for my taste diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index e4763a446..584298485 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -23,6 +23,9 @@ import net.minecraftforge.common.util.ForgeDirection; public class BunkerComponents extends ProceduralComponents { public BunkerComponents() { + //TODO: + //add an abstract method to check if each boundingbox/structure is a valid component to ProceduralComponent + //Pass each respective method as a method reference (::) to the weight constructors, in order to boost clarity weightArray = new Weight[] { new Weight(30, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 15, mode); //Corridor and Wide version if(box.minY > 10 && StructureComponent.findIntersecting(list, box) == null) return new WideCorridor(type, rand, box, mode); diff --git a/src/main/resources/assets/hbm/textures/gui/book/notebook_and_papers.png b/src/main/resources/assets/hbm/textures/gui/book/notebook_and_papers.png new file mode 100644 index 0000000000000000000000000000000000000000..057b9ec59d00109004a9b383e2529c4545e9c7cc GIT binary patch literal 13308 zcmeI3XH-*Nx9@iX0W>s435qmPP$@xu6cq^gfTDsRqEe;UP*Fgnr;3H90-|CiC@6|0 z^qvHX2#C@Y2sKn`2?PisA?@zybMCn3zURF6+r3{dV=w|^Z`NLG&AI+_&fnZ59C5N& zTE2EU002q{57-?A04Vq)6i|=>KWMKv)Po<8t4Hns20k{en*e{24cL2lF975x!-f7Z z@LJFj$7B2Mhk5d+TfUV)k}OTPQeOPc1ie537;kAF~z(o(c-v>Hz}C!Sz^;gi<9lN>?L-Gh&Lr%{KcR7 zA)N0MEso6&l?mqi`W&^G1J$F6rX2ZrN5Y?)h&(7+Vz*UiG9&kk`AlX6 zO2VI(EX{~`Ebdg}L~n(VGbH2;2!y5Kiw0AOqCLA$-jqI_6=Nkp&qaPAeY zlQ!B8n@tD4?b`qG%jtE!daof~pKi%o{8jY1_VU)2zp^8s(@F=Bl#%BWF}B0Ad3V6f z)mHDkfJz_1;)UVzO<50Sj1StUKVHK;czsA?tul8%=EvG(!`hLX2!lO;SLkuR`4(|l zCjzbccuNn$=~R2#-ZR!(cajcn#SDJlz*3!L58aA5%D52LhFa`3CA2i(9^Py|LhZP( znF&t`Rk)G|+eDQJebO1BJ%q7vh+HiOH8mmMM!bN0&=uela}X82qsj{+7R{6yFz`Wy*F@uFRU(Ob zg<$om^DKjYWOs$bvC`X=&%yLM-padQx1ceICZaX<&ZcBp{2O>mOuQAJoAJ{K^LZwm zBcA7r(gO)y%1q>aPNH+fok{hH1QpL*FS#Z*W!=Lh+>sl}J&cK;({kzwab|bYzV!!E zCF=~}W<6bxeRZo=wdyqV_wQJuqrUjweqGD{9D)?7lDv*xDB`9`>VCkgS;#JvT(4uL zThO)g?>85!YKOO~QAc!6u1klfgvFCP@$bodAHFeXUTvO%dY9!jp=y#@PkCF(U9Oh( z%v5jD-LJ3%7P5#;p?DsB64!WHCZh+Yx^%r;O*_1cy7uc+D>BVARhzc}-JlJHv(xb& zpaYa1j?(AZu)D^LjH|y)#|RW8t0pXF8JM(S_dbqS`bFVoIwDQYo$%Rqz)P4$6y9K* zt}@YN%ZcBjj$r4a-&JWI2)~^6EBuB%TamSo*p}6LR_yg9?OxTE5`5q_*a4I*r4D}+ z_g)@7_bZtZWh;4$BAD;~HNW~JBw|!sqs#nf+K_*?wa9fq^KC}x)%o7thmuXrSqo=Y zwtCb-H|T&9UD6~`MJ4@os)*Y|YTN9Xb8r~Y`dVPm!IB^VgCqU~{{TWvdQzX5>VQUX49q`KV)AfEmN*5d#?b&@@ zEHJTY(_{C^ebJ1$nam^K?Z>02l38d<;qc_5))~%fl=E_rE9y%!Lox|ll7O>s`n$DPb;!5k6qOy?=Vm0{f!Uv;f9)o0cI1%OeZ z;pkEjbietYrBY(`N7o= zr$Fa~r(hI9c@79aif0jvb_z}AT%OH7EC7hTE_pc>wXl>c+Cz{w4n8%P)F za2yGH)0ws3YwXI2hb>njC-$XAfI}piL-MHmBkgAQw5a_|B;oW9MI;$+n>y#^b>Dsg z%6y+#WSc_sy-p?v?gCUu*ir@UpP2}u>%vL1_@mFeE_|!-I8W7+AAlQI_xC$>>nYMs zm&v8zp#tTlasF{7?&vFL5-uTVb};Icc_P!?&sR}ymx80^jc4TMJV3M4&ElF>Iqlmv zN9L5KU&_6{f*+5<3*&LN8Opd|XYFNTg zg!6n%Ku%Hcfaa-y^?{K!KPgi$csp@v6i>oW=_3k&!mcX1!TuZ0w5C-jSkVh!J@c!y z%&RSvD`FsR%6paKl)g|OU5>{l=&Xx%&9f+0F~y$b9v1TY5hLLc1NT3pT%Qd^qfM=m z4j6ZwUn?o+HE4LX^Pw-dM9Yf5n=^{$Q%6?wOMtg=nYUnrSBHyLde|+>ise3N|n8e$+Kh7_2}*0bw0=WPmC*A_Q?6i!7c!t=-{$7c}&RjuzCIy3N`qk^@*%q!+c)OA^^pV@RjMQ**=fXTow z=kEH@>c;D7hca1xWvQVGg&}LyZE&WUCDgavSm#3V7U6ZeJSP!3w%V9*KS)7&V57f_dSN zlLwfLC(j-+Uunl`Xw#s^4;u%5xiN2Q^TMVMXWX%RM1JNpUVCyV8U{~^09W9sZo_{2 zf~)gbgi5CA)My)8z+!6jGty0~Thu{$`OF420Of1P)xmDyjWw|r9Tl0^e0zvPaXpW% z`Zi{y(^VECWj9Knl@>^7znD|8bUcP`dsQ+vqrJSo6{i?}TH0LA1TI?GQiC8MCP zyGgadbl=gqo@=P8@pi7Osm-L`E<#<1lB$(rFvshGXb*-iBLTRfd-#c-w0=-ZN91kW zl)xdBzSI^^EzsBzT|LX0!|@GJG@aYsxOkxJL!u8WDZ$ugNH2ac|BLOXi^$0P{&v%5 zrykzqk`bs>6(nY?X|^iGQtN%BjGELV!i@zI%N0ceRJ%r@RlCsV{&#lppo5FIpAUUfkC>h!r2xp`J&2RUD6kf4ChRX@z+@Fd^ zJ50z_Q;rrlba^)S7I>pLEX)PJtsZB8q(-U=?u6rPGmM|}?4D4$%~N~OyCK__lm(Zg z52jQZTP}d7OhbL3dwP8p|CQCJ>*H$-J_a&ZQ(n##r1t>Pdk;+Ny&24-z%nB>_R{Pg za_0=JJvZvuX3ykxT5Ezcwj4IYjhgLFnvv>7hd1HrIp^t3v9}VK>g-C^sBQdQoI7Dy z2Na1k7+}Q;eu-Kt=EjWnTy~E7Swj2@brkQHIxKk70ZGr4Oi1)vZXP#O5SUKRLJ}T? zC^!w6dCSN)!|rpBPMK=#yZ-Twi77UaIbqt)nS~A*_^s|$a@_hysVcY3TuZ!3$Q&`s?OttDNR=1ian0!GjG-Q633du>h zAMX@Z1$Tkk9_SqYZXZddhTK7xT0}ZT3S-5po^&2hC3pMFhsU`QLNd{6R3^roKlwj( zEIyffN>I!@rQ%9A!uIrkTQh26Ws&b&Wza0QQw5qF{rk`!sZai;i917WFEQLwS&&So zD3TJ#_x89(YxwxCeiox}ahD?k*o?hEnmey10loOOBXeJIC+c%fS+yuA7HztL4Vw8T)m})q;oSG%Kbd^ zx)i37Q4M8+iVdC^SW5bcJU8@tpcMrDsm@I=LOpwB-YM+lqn=5Gdnnv^%K% zsN6@T+Uze@>ppyI98Ou4Rp0d!&rE zisrwn*Ww1{0iHE_mw@!awKmGsEdq!1Lm!=%6s+^iF*xr+*L2_8{d+UVpo-RCz-%2< zvOHjElhElP{$PvAaG;&%<{~#NZr$u>(xr)c`ZQn9@*`2T!#Ld@IGt!{r5MFUTP6>5*$BtK4;#4?e(;i6Mj{`;K z!fwi=`aTa-_V;kNkV`k?Nqhg=SVVlL`;GuLb{1_4} zT%_6umF4}sTXA#KmV_}eR|!*yh|VWEcEdx2(lxsS!T=X<1*Q_QHyo81w=$A-2 zVHUDlO}f`c2!iuxt#3FTOuou&gXuDnAu%4)3EiOij~$};!)-Two$-MzorM!ifN#+A z)nYEIhj{*+its;HIOPSbU)+GFYssJceA!O0QZm_Is4%@6dm3U;CYM)vtwCz4JYX(S zIN%?3=LZNHJpJW%EJ+qcPm_{iF<^qR)hqMQE03%7eAETc_4drj^M^3Pir_6tq+geGmRjQ=sEMcW5SI-2K-yl*G2M&+Bhe&NAdTnXP|+H(ajg}pPYOii z{=S30=YRA-$5rBfA5o)ZNK=bNV)vC>7hNp2WUH`|-e#EGKnHNSMMPz%J)mB2ix8Qg z<;g>?C%q=06Tondl}Z!1Lu<;j-e}poCUm>(_wCW7w8;=ByH}=@TZJE-!y#aH3Ffv; z^IFtabelXk%OWzjkr7^y6=^MC7GC_vLTOI{tVTw!%g?)6Z|r8w+Ty_b)+2eHwHYea zk3>2Z%o19e}CqsH9CSNtsH*Gp($VN7E0^m?E&3jep~x)6XP(67nXkB`tdVRPNmzk zlWsK9EH_CS(~CZCj`d?iDc+q+pYrOD_hC<%K7g~G7p_7YZskF|Zv_Hm%{NqH!Y@Vk zNe%>e$vL`3-sO2Q%di5#nCf=@R`JZKfNd#lk=>EQuG((oGwJ7jI`W9guMu(7*3)1y z4kiNbgv-6a{6_v|%tiC{R%{1sjedEPiGK9zt{r6N;kY!0uTgeJfcp5?V6(~F}HM!K?5_f~? z45R6k3+1wNSj2fjPideqy68Uwn!~1bpECyb+UHTVdXmSg5TNLJmN|ZeJZ!|Fhtw)t z{aJhQf}InZQZ)oGsM|~y%cEZPgm=SH6PnyZ_)1}_VoM|Ro8erJ?GNR>@N^{(9=q^v zY0W6BJH16Kyk~JxQ^cB!3;ih`8mj4@Matsak@$co`_#Kl8eb1ls3x1$J8%F5I#;wqXaqUX)#KgZTHksr zQ?z+duYfi)!id*swUMC zcR_bL)3dbFZi-S;V(LPU=yd4k`AS#}$uMW4axo7mlLM;)=`Ncw9-MD_6SPpRzjiSK z_Y_PFeZ^zEr@~a)lwN<>9ie9mg_LT`<5i(X^&rlWy0CM2jent{E$P- z*rnS3HAJ;f;xPIo!Cr*>wyHIOJO+M)P#;qn`(=i_*axIbB&jf-yU*%pmlRI3pF$KQ zFDmdn$su2=z!#^+6MsUlw55Ak+=W-eYh5qzq9>6G>xK_*jUK!?SIV)9s!q24&eg0r zSpd|{v80Thgj6uTg?#pCTvbJf$yReNF1FpJC@CBjSZ}|Z)0-mki z+Jg{o8>P4iO&p(1-$XVS1#~-{MA!dTCrCv5>vrB~ z97*5TXq$J3IlBWZX0`vXSbZ+veCmO#*AgQ;s^#%E$e8uRlS^TcUs~{xUfZ%uW)ElZ zRe&C5U-QT;|NHmDFM@}*Cw8u>vYXrHv*c8@Q^PvO3@_C61O%s^4Z7dTj4#}yUahd1 z;g6qwR_2gXAJm0+&Z;OXUO*iGV1JGVi&}M3hTb`-P`6!n-?Mff;D^5D`ifUz`Tf>M zn20wjkQYa=d*5rvPCy5SbW8|XB_~1@x5IU9?E0n}=(k@gIt_Ac5BCRIm3HBc;|{`G z*xSg#H}4DTA_s;1`8hZsMdh2|1f?jDmxm}M?s8D~lZS`Az!_+tJJb0lC^dtZ`KsdV zfZ|M}fBCrlK3awQ{h_%MzUw5N!2I5A(Vc2t?@qDw*=YROOKU_C*UzE6eR%LLz7oqL}Ip(P4ZB7n;IYz(TH7F>< z!hXU<*jbU9;kbTJ4<5pS&)=r)qPecE2`B*O3i*1XU%O-F$*$dQyojT8HObcpM%?`m zo_&2;(O#qj!fikkls@7F^q4vIKk@8F2J46U&t}6=yPt=6Z7#m#`S0S~oq&s+oljn-%P__Tvkf0>xu-4U zqU3I|9~)PHRfZ;Pu2uOACwFU(x4(;Rc1^TW{&bKLheWvj^tZk#YCZ#Lla2>W!zTCY zZhhsp9)rz!X^3*}DoUOWjOZw;do?q31O#S<`YyQR6J>GIQE4AxZ)W)s`;c5WeSxbL zS1IZsv*F`$xS8*VmEd3}33V1pC0O@Mq;!f&M$rYGfi#Qd++(Gauty~6bz_1h!UoOX zz6E+{F83CBU=iG}pFu_8+5u;mVe6pT;C5C3$!8!RTeV!OlsU4+L+^a!@AVBOe5>f{ zP#<+E0*pLB!2w+?M9KczVDXIlr|X{7Bo*#|BG@nF2P%N(YE@7a>uKz3Sa~c*m@6lk zYs+z?+LiJ`Eb}$@aW(Uhax&n2^irb~hz(G0-<$H+MwGWVn&p#%340GkG&-H`_`ZHg zDcXQbw(=lMS>W%DL3ul(zxZ?a(K6Vos5H=}eCnYZsPgNM1uK|S4m$m>E6y6aOrAL8 zvynU3Q?vDkiA{|jM%}b}enHG0u5eeM2Q&Sl%{KOlZvpI5sQEmRY$*yDi z##?Ns?d)Zt0k#;hCN}CQkI1Vj4Q}@!SX+6nZf7tRXD`qn*W_A}aDnKIm&0<8#$4Qx z)t7cUTi$2}5iA{gpZ7^`7p&4%Fwh3}+&(AIVE6j44BZL7-*%pX+ymY7Q&fU2-~kNL z=46s^Ry$aMm<*dVwc`!?>|hH2_4DKnr20~rdr)xmLUUb@;XOs^Y0}Cs4eGDrf09?d zSXD(i?x*7;nkzgWx+TJideMf&twoN$7#Q7u?KE&V<-7t>=?mT@xn@82Tv0MPcW#GA z#6piAV?|eS4CG9_eL@`DBM?#&jEnk9;41%uk*Ix>csE8}w?P%9c{}(L^CL%tp!E|~ zZJlQ|Zi}HiC;qK&b1RA+ua>#$w=n$%+-cUO_`lG&D&(_6;QaIJtjs(JELJ?D_l8K|{7E}!$I^0qr4R5-;#3A~zQtYxc9A5mVZx37JLs;yq^*-+0RDLa za7QKtOn_UL;H+!Z4j-q3yvfC@Ej~C?n_K6R)w9w~68*I>FIH?0fi&Dn+t$Fge z%lJf{pa5=IdX>z|AjoOgW83KN@HJ&XZdw+`4yX`^XB5m+N4HPE?UmfQ2G=izzo zAC5|ounlL^`!+mhg;_h!1Vf$*R2U60d;L&(iOqc?hzgE0j z?7T^#`8Zws+0O=VB;Gacc9z@M4BG&Tlskc4PN>cp3LgPcc{n!|dIn_WJ#!b=odm(S zx6Mmwz^Ohh!jCZE z2X@>5dv>3$LSB)7R>1eSW*S{ga$u}QS2*mzUP78fz${k-F%hJR!fP5Y@$lpT1tM4{r`phxnWf!ayR&ZG{Lb{j<14JrqqnHgrryO~(JxAi zk=_*2W#qfU4*kIXDG#6P_1D=`$Xqg44@J)ML*n1ps%OsI$ZGX~uJC_E;s>_fXa*bC zF`LS8t9~t`t5Ki!Gvf@;Ku*j;r3Ti5>vooRsO2FrnANAuR|+<{^MpVm+mKRj)?sluJ{hYXEDrGn}~ z=$mYJw=bl22P47e^+oGcD&oi`OJPQ-EdwuIUu;|~46h`5!SdZqRm~snUoD_Mf41uy zjQ$a!+YYV^Nw{**WJwNp*%^bYnq1u-9NtY0z{P2_K6~a>-WvCS^PUkcvQoIcY_aDmOzN4lj3j55!*;dLl4)~UcYdA>q$6u!Wu|VB3vpn4(Zy`i z04E;Y_wtQFrl8w=)8lHkiRn&sqtH1)r_ZZgsWD#NG(zCMG{+ z#6Ut+AA$L)KSWHlL{$G9B+lFQN8D06Z|r2XniSZxSMGj1NJBGOENW!HiXp>hL< zh*>{(QrgD>C&%%z`8Py7=C`+j7Df9VM*o*goQ7+w1T0H4GC03IJQ*gdLJRzB+JU(u z{L^>*#;^L=&T%Co=P;UY;$KS7a?R zaxiDC*E*w0++f27fBZ{GUWadRm{SSKFH}CDg04uyC##zQ2g>o_0f6HM~28 zelb%(bSejy5;MUqR)ilxt&H-Ep{qShwQw8{M86_2H|rn)qT-=lQpsc<|0JIi+?{6O zIAMg&n#n_c7VB^{Yz|r6Xs&^!ys30fwJOhAk8UevAzZ961SlXKU%}K<;%y0L8AJPTT+{tOp}bu zz5Y_S_8WTv=Kgbg_C%f;?>KwW{x~N~W%QHV_uh>a4l!LnV0mNEsE%;Uy1Sg-uCz7M zG^&qF=3Q*!zRGGcy*fj2eU!!r&9|F-lC`<3#W#17yQWm)xvv1Y*PMDX2!e)BY#X6T`FC#TTp4Y0CiV#knYL@r=hO-p+s#oL8Zj5Qx7Ty_l zdl>b_|Jh)Q)cpw^r_ELtPZ66^6t=Wl#LwkXuiE>>ZSHH0JLNB_T|k0dPF&b}UicR5 zUn<*yOW5uKU`+|VE+;wig@%=9IMotp>&ca1O9dr5rla8bRZeQO_QN*A{!t&2a38Ej zE61BNPF4aHQvdcK1DA!{1Dc8^Y%z&$E|jM}vlFJRxNW;%z;(@`zvakArFyh;KBX%6 zDJn16QqG>=xL^`&hXjH8ApyP(_~wMv zV3||$w*L(whtd0@=}Vtf!S|>@cg{0etiDaT1HRalEsuNa9JQgd{OktO`pVbo7=e%CA#MhNu?}L+Yfx81&1zg>|@-TRMz&@1C5!KNiu3bP}2^CxUg=h~y^6iT5 zJ#Z_uPC*p3!(;_L`J$*MG{m9m>2II<8W($glgfYQM!v9^ESaI1FZGP7jJ^@oHkbdF2=IkOtGv0z?H+Q}2H*BW6L%{> z27M4|{miAy8Hw{zbUyZvg4T>dAAL#(&($Hk4d$yk3%^XT3=BA?1g%A>BpRzH4ZQHX zaGExvNqt|Q$PsZ5V+sO`>JE#G-XQ$++#r_dDLUvi2!51hrb+o^C4+-2PFGZTU~i%vz$a3lRmi_npBuy+L3|NoYidlKZ6 zK@0#wq0sWe!k)n7rj->RmwZwz?#{)7O#MJ|WB(n^MKN1YnWiRVT)h&W7j*0N?;6!2 zS?9EjLZ4%Xz5ZW6j85-o?Y~dO@QsQMEB5h6=cY&?X&#&woti5Qh3uJ@%{vV$a;R$A z{J4J|RAG<)p7qhI^Pi@Q=iGd2IdUpX`4OJXxJ+c+fJf&QAVEzxBXV_f(VBo=zcEP^ zXJD@;@!t@1KT;>KQ?|J>ag1cO@Y@Q!PqYr`k-o`m_J2*YggeRCZK%TLS#t(Xz*3p% zC#ma-r0!~o({-a>ed%RqEszO|xZZNIwT$F-8T~?D%@dvNcO+IHic@nu!@?yx~QxLd-S(+ol#uR_m19mSiN_?9?tFF4z;TKHMwj5Cj&?;LYvGUB8 zOpEb9#E&&<&Xx^b7uk9P4WZR?!o~A<80eWwh-r*OpR3ad4<#n(S)MD!T$fiF*%rl~ zo;u4-;8aRRKg?|3dZV&RJkyk41vE9n2de)6$N%4g|Epf`v8P8MX)W~dC<;2e2KNS%G}f0G|-o-(Md5|Mkwn!Qs#6yL0Q(r<6niWujQZt^+Cdk|4j}|6sr%<<0B{ z6yhxKh%9Dc;5!V$jK}j=qyPmoJY5_^G=gpWxP=%LIh;(d{Fbjgc-}0`#z1{_?6y}t z#qyQ=?0byai}$>IXtp@5^81a2Tn>>wt7JMJOlGKJO7@CS)mQqhX=Lf#m-O+>1Z9_d wJY0##{w$8}6!`A{RABb)37dDg{f+p__}Y>AF2f^jkY^Y?UHx3vIVCg!07hY4JOBUy literal 0 HcmV?d00001 From a0332d42415186cfe7b0e8fc374c90cb8262e1d2 Mon Sep 17 00:00:00 2001 From: Vaern Date: Fri, 21 Oct 2022 14:52:33 -0700 Subject: [PATCH 17/30] mh --- .../com/hbm/inventory/gui/GUIBookLore.java | 17 ++++++---- .../com/hbm/items/special/ItemBookLore.java | 31 +++++++++++++++--- .../java/com/hbm/items/tool/ItemWandD.java | 12 +++++-- .../assets/hbm/textures/items/paper_loose.png | Bin 0 -> 239 bytes 4 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 src/main/resources/assets/hbm/textures/items/paper_loose.png diff --git a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java index fef6a8986..85f3bd5cd 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java +++ b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java @@ -16,17 +16,19 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; // and you may ask yourself: vaer, why do this? this is basically just a copy of GUIScreenGuide. // and I would answer, shut the fuck up nerd, the guide book system is too involved for my small // brain to use for god knows how many tidbits of lore. i'll settle for a text box and cool textures, thanks public class GUIBookLore extends GuiScreen { - + //TODO: refactor some of these variables protected int xSize; protected int ySize; protected int guiLeft; protected int guiTop; + private World world; //Used for save-dependent information, like the MKU recipe private BookLoreType type; private GUIAppearance setup; @@ -35,6 +37,7 @@ public class GUIBookLore extends GuiScreen { public GUIBookLore(EntityPlayer player) { + world = player.worldObj; type = BookLoreType.getTypeFromStack(player.getHeldItem()); setup = type.appearance; @@ -134,12 +137,14 @@ public class GUIBookLore extends GuiScreen { // turn page buttons, one-page, both page textures, sizes, positions, etc. public enum GUIAppearance { GUIDEBOOK(new GUIPage(272, 182, 20, 20, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/book.png")).setScale(2F), - new GUIPageButton(18, 10, 24, 155, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/starter6.png")).setUV(0, 0, 500, 200), - 0), - LOOSEPAPER(new GUIPage(133, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F), - new GUIPage(130, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F).setUV(133, 0), new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512), - 1); + 0), + LOOSEPAPER(new GUIPage(130, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F).setUV(133, 0), + new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512), + 1), //Singular loose page + LOOSEPAPERS(new GUIPage(133, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F), + new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512), + 2); public int itemTexture; diff --git a/src/main/java/com/hbm/items/special/ItemBookLore.java b/src/main/java/com/hbm/items/special/ItemBookLore.java index 2df994562..403786a39 100644 --- a/src/main/java/com/hbm/items/special/ItemBookLore.java +++ b/src/main/java/com/hbm/items/special/ItemBookLore.java @@ -12,6 +12,7 @@ import com.hbm.util.I18nUtil; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -62,8 +63,8 @@ public class ItemBookLore extends Item implements IGUIProvider { } protected IIcon[] icons; - //fuck you, fuck enums, fuck guis, fuck this shitty ass fork. shove that string array up your ass. - public static String[] itemTextures = new String[] { ":book_guide", ":papers_loose" }; + + public final static String[] itemTextures = new String[] { ":book_guide", ":paper_loose", ":papers_loose" }; @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister reg) { @@ -98,7 +99,9 @@ public class ItemBookLore extends Item implements IGUIProvider { } public enum BookLoreType { - TEST(true, "test", 5, GUIAppearance.LOOSEPAPER); + TEST(true, "test", 5, GUIAppearance.GUIDEBOOK), + REL_RAMBLINGS("rel_ramblings", 3, GUIAppearance.LOOSEPAPERS); + //Why? it's quite simple; i am too burnt out and also doing it the other way //is too inflexible for my taste @@ -121,15 +124,35 @@ public class ItemBookLore extends Item implements IGUIProvider { this.appearance = appearance; } + //TODO: actually shove this into the gui + /** Function to resolve I18n keys using potential save-dependent information, a la format specifiers. */ + public String resolveKey(String key, World world) { + return I18nUtil.resolveKey(key); + } + public static BookLoreType getTypeFromStack(ItemStack stack) { if(!stack.hasTagCompound()) { stack.stackTagCompound = new NBTTagCompound(); } NBTTagCompound tag = stack.getTagCompound(); - int ordinal = tag.getInteger("bookLoreOrdinal"); + int ordinal = tag.getInteger("Book_Lore_Type"); return BookLoreType.values()[Math.abs(ordinal) % BookType.values().length]; } + + public static ItemStack setTypeForStack(ItemStack stack, BookLoreType num) { + + if(stack.getItem() instanceof ItemBookLore) { + if(!stack.hasTagCompound()) { + stack.stackTagCompound = new NBTTagCompound(); + } + + NBTTagCompound tag = stack.getTagCompound(); + tag.setInteger("Book_Lore_Type", num.ordinal()); + } + + return stack; + } } } diff --git a/src/main/java/com/hbm/items/tool/ItemWandD.java b/src/main/java/com/hbm/items/tool/ItemWandD.java index 6260e9ec2..cb1308cca 100644 --- a/src/main/java/com/hbm/items/tool/ItemWandD.java +++ b/src/main/java/com/hbm/items/tool/ItemWandD.java @@ -6,6 +6,8 @@ import com.hbm.blocks.ModBlocks; import com.hbm.entity.effect.EntityNukeTorex; import com.hbm.entity.mob.siege.EntitySiegeTunneler; import com.hbm.items.ModItems; +import com.hbm.items.special.ItemBookLore; +import com.hbm.items.special.ItemBookLore.BookLoreType; import com.hbm.items.special.ItemKitCustom; import com.hbm.lib.Library; import com.hbm.world.feature.OilSpot; @@ -34,12 +36,18 @@ public class ItemWandD extends Item { if(pos != null) { - //use sparingly + ItemStack itemStack = new ItemStack(ModItems.book_lore); + BookLoreType.setTypeForStack(itemStack, BookLoreType.REL_RAMBLINGS); + + player.inventory.addItemStackToInventory(itemStack); + player.inventoryContainer.detectAndSendChanges(); + + /*//use sparingly int k = ((pos.blockX >> 4) << 4) + 8; int l = ((pos.blockZ >> 4) << 4) + 8; Start start = new Start(world, world.rand, pos.blockX >> 4, pos.blockZ >> 4); - start.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124)); + start.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124));*/ /*OilSpot.generateOilSpot(world, pos.blockX, pos.blockZ, 20, 500);*/ diff --git a/src/main/resources/assets/hbm/textures/items/paper_loose.png b/src/main/resources/assets/hbm/textures/items/paper_loose.png new file mode 100644 index 0000000000000000000000000000000000000000..446c7207111f7ff44fa3be5491f4f4d98eba71cd GIT binary patch literal 239 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf_<+T`&Lu literal 0 HcmV?d00001 From 3526af3bdbf0ead9a6b767923db794d36da90869 Mon Sep 17 00:00:00 2001 From: Vaern Date: Fri, 21 Oct 2022 22:32:43 -0700 Subject: [PATCH 18/30] changes to the gui; save-dependent info and i18n --- .../com/hbm/inventory/gui/GUIBookLore.java | 88 +++++++++++------- .../com/hbm/items/special/ItemBookLore.java | 14 ++- .../java/com/hbm/items/tool/ItemWandD.java | 2 +- src/main/resources/assets/hbm/lang/en_US.lang | 6 ++ .../assets/hbm/textures/items/notebook.png | Bin 0 -> 265 bytes 5 files changed, 71 insertions(+), 39 deletions(-) create mode 100644 src/main/resources/assets/hbm/textures/items/notebook.png diff --git a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java index 85f3bd5cd..ad693d381 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java +++ b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java @@ -30,7 +30,12 @@ public class GUIBookLore extends GuiScreen { private World world; //Used for save-dependent information, like the MKU recipe private BookLoreType type; - private GUIAppearance setup; + + public int itemTexture; + + protected GUIPage mainPage; + protected GUIPage auxPage; + protected GUIPageButton button; int page = 0; int maxPage; @@ -39,18 +44,22 @@ public class GUIBookLore extends GuiScreen { world = player.worldObj; type = BookLoreType.getTypeFromStack(player.getHeldItem()); - setup = type.appearance; + GUIAppearance setup = type.appearance; - if(setup.mainPage.isTwoPages && type.pages <= 1) { - xSize = setup.auxPage.sizeX; - ySize = setup.auxPage.sizeY; + mainPage = setup.mainPage; + auxPage = setup.auxPage; + button = setup.button; + itemTexture = setup.itemTexture; + + if(type.pages <= 1) { + xSize = auxPage.sizeX; + ySize = auxPage.sizeY; } else { - xSize = setup.mainPage.sizeX; - ySize = setup.mainPage.sizeY; + xSize = mainPage.sizeX; + ySize = mainPage.sizeY; } - maxPage = setup.mainPage.isTwoPages ? (int)Math.ceil(type.pages / 2D) - 1 : type.pages - 1; - System.out.print((int)Math.ceil(type.pages / 2D) - 1); + maxPage = mainPage.isTwoPages ? (int)Math.ceil(type.pages / 2D) - 1 : type.pages - 1; } @Override @@ -73,40 +82,44 @@ public class GUIBookLore extends GuiScreen { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); if(page == maxPage && (page + 1) * 2 > type.pages) { //odd numbered pages - Minecraft.getMinecraft().getTextureManager().bindTexture(setup.auxPage.texture); - func_146110_a(guiLeft, guiTop, setup.auxPage.u, setup.auxPage.v, setup.auxPage.sizeX, setup.auxPage.sizeY, 512, 512); + Minecraft.getMinecraft().getTextureManager().bindTexture(auxPage.texture); + func_146110_a(guiLeft, guiTop, auxPage.u, auxPage.v, auxPage.sizeX, auxPage.sizeY, 512, 512); } else { - Minecraft.getMinecraft().getTextureManager().bindTexture(setup.mainPage.texture); - func_146110_a(guiLeft, guiTop, setup.mainPage.u, setup.mainPage.v, setup.mainPage.sizeX, setup.mainPage.sizeY, 512, 512); + Minecraft.getMinecraft().getTextureManager().bindTexture(mainPage.texture); + func_146110_a(guiLeft, guiTop, mainPage.u, mainPage.v, mainPage.sizeX, mainPage.sizeY, 512, 512); } - int width = page == maxPage && (page + 1) * 2 > type.pages ? setup.auxPage.sizeX : setup.mainPage.sizeX; + int width = page == maxPage && (page + 1) * 2 > type.pages ? auxPage.sizeX : mainPage.sizeX; if(page > 0) - setup.button.renderButton(this, width, guiLeft, guiTop, false, i, j); + button.renderButton(this, width, guiLeft, guiTop, false, i, j); if(page < maxPage) - setup.button.renderButton(this, width, guiLeft, guiTop, true, i, j); + button.renderButton(this, width, guiLeft, guiTop, true, i, j); } protected void drawGuiContainerForegroundLayer(int x, int y) { String key = "book_lore." + type.keyI18n + ".page."; - if(setup.mainPage.isTwoPages) { - int defacto = this.page * 2 + 1; + if(mainPage.isTwoPages) { + int defacto = page * 2 + 1; + String text = type.resolveKey(key + defacto, world); - if((this.page + 1) * 2 <= this.type.pages) { //TODO: change this to make it accurate for odd-numbered max pages - setup.mainPage.renderText(key + defacto, fontRendererObj, guiLeft, guiTop, false); - setup.mainPage.renderText(key + (defacto + 1), fontRendererObj, guiLeft, guiTop, true); + if((page + 1) * 2 <= type.pages) { //Checks if text should be rendered as an aux or a main page + mainPage.renderText(text, fontRendererObj, guiLeft, guiTop, false); + + text = type.resolveKey(key + (defacto + 1), world); //kinda awkward, but no way around it + mainPage.renderText(text, fontRendererObj, guiLeft, guiTop, true); } else - setup.auxPage.renderText(key + defacto, fontRendererObj, guiLeft, guiTop, false); + auxPage.renderText(text, fontRendererObj, guiLeft, guiTop, false); } else { + String text = type.resolveKey(key + (page + 1), world); if(page < maxPage) - setup.mainPage.renderText(key + (page + 1), fontRendererObj, guiLeft, guiTop, false); + mainPage.renderText(text, fontRendererObj, guiLeft, guiTop, false); else - setup.auxPage.renderText(key + (page + 1), fontRendererObj, guiLeft, guiTop, false); + auxPage.renderText(text, fontRendererObj, guiLeft, guiTop, false); } } @@ -116,10 +129,10 @@ public class GUIBookLore extends GuiScreen { int q = 0; //if both buttons are somehow simultaneously clicked then obviously something's wrong already if(page > 0) - q = setup.button.handleInput(xSize, guiLeft, guiTop, false, i, j); + q = button.handleInput(xSize, guiLeft, guiTop, false, i, j); if(page < maxPage && q == 0) - q = setup.button.handleInput(xSize, guiLeft, guiTop, true, i, j); + q = button.handleInput(xSize, guiLeft, guiTop, true, i, j); if(q != 0) { mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F)); @@ -138,13 +151,17 @@ public class GUIBookLore extends GuiScreen { public enum GUIAppearance { GUIDEBOOK(new GUIPage(272, 182, 20, 20, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/book.png")).setScale(2F), new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512), - 0), - LOOSEPAPER(new GUIPage(130, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F).setUV(133, 0), + 0), //Guide Book + LOOSEPAPER(new GUIPage(130, 165, 10, 10, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(1F).setUV(133, 0), new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512), 1), //Singular loose page - LOOSEPAPERS(new GUIPage(133, 165, 10, 24, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(2F), + LOOSEPAPERS(new GUIPage(133, 165, 10, 10, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(1F), new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512), - 2); + 2), //Collection of loose pages + NOTEBOOK(new GUIPage(133, 165, 10, 20, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(1F).setUV(0, 165), + new GUIPage(133, 165, 10, 20, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(1F).setUV(133, 165), + new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512), + 3); public int itemTexture; @@ -184,6 +201,7 @@ public class GUIBookLore extends GuiScreen { protected int marginY; //Mirrored on both sides if two-sided. protected boolean isTwoPages = true; protected float scale = 1.0F; + protected int spacing = 9; //12 //TODO: split marginX into a left and right margin protected GUIPage(int x, int y, int marX, int marY, ResourceLocation texture, boolean twoPages) { this.sizeX = x; @@ -213,8 +231,12 @@ public class GUIBookLore extends GuiScreen { return this; } - protected void renderText(String key, FontRenderer renderer, int left, int top, boolean secondPage) { - String text = I18nUtil.resolveKey(key); + protected GUIPage setSpacing(int spacing) { + this.spacing = spacing; + return this; + } + + protected void renderText(String text, FontRenderer renderer, int left, int top, boolean secondPage) { int width = isTwoPages ? (sizeX / 2) - (marginX * 2) : sizeX - (marginX * 2); int widthScaled = (int) (width * scale); @@ -243,7 +265,7 @@ public class GUIBookLore extends GuiScreen { int sideOffset = secondPage ? sizeX - marginX - width : marginX; for(int l = 0; l < lines.size(); l++) { - renderer.drawString(lines.get(l), (int)((left + sideOffset) * scale), (int)((top + marginY) * scale + (12 * l)), 4210752); + renderer.drawString(lines.get(l), (int)((left + sideOffset) * scale), (int)((top + marginY) * scale + (spacing * l)), 4210752); } GL11.glPopMatrix(); diff --git a/src/main/java/com/hbm/items/special/ItemBookLore.java b/src/main/java/com/hbm/items/special/ItemBookLore.java index 403786a39..ae3388d95 100644 --- a/src/main/java/com/hbm/items/special/ItemBookLore.java +++ b/src/main/java/com/hbm/items/special/ItemBookLore.java @@ -4,11 +4,13 @@ import java.util.List; import com.hbm.inventory.gui.GUIBookLore; import com.hbm.inventory.gui.GUIBookLore.GUIAppearance; +import com.hbm.items.ModItems; import com.hbm.items.tool.ItemGuideBook.BookType; import com.hbm.lib.RefStrings; import com.hbm.main.MainRegistry; import com.hbm.tileentity.IGUIProvider; import com.hbm.util.I18nUtil; +import com.hbm.world.generator.room.TestDungeonRoom8; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -64,7 +66,7 @@ public class ItemBookLore extends Item implements IGUIProvider { protected IIcon[] icons; - public final static String[] itemTextures = new String[] { ":book_guide", ":paper_loose", ":papers_loose" }; + public final static String[] itemTextures = new String[] { ":book_guide", ":paper_loose", ":papers_loose", ":notebook" }; @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister reg) { @@ -99,9 +101,12 @@ public class ItemBookLore extends Item implements IGUIProvider { } public enum BookLoreType { - TEST(true, "test", 5, GUIAppearance.GUIDEBOOK), - REL_RAMBLINGS("rel_ramblings", 3, GUIAppearance.LOOSEPAPERS); - + TEST(true, "test", 5, GUIAppearance.NOTEBOOK), + BOOK_IODINE(true, "book_iodine", 3, GUIAppearance.LOOSEPAPERS) { + public String resolveKey(String key, World world) { + int slot = TestDungeonRoom8.getSlot(world, ModItems.powder_iodine); + return I18nUtil.resolveKey(key, slot); }} + ; //Why? it's quite simple; i am too burnt out and also doing it the other way //is too inflexible for my taste @@ -124,7 +129,6 @@ public class ItemBookLore extends Item implements IGUIProvider { this.appearance = appearance; } - //TODO: actually shove this into the gui /** Function to resolve I18n keys using potential save-dependent information, a la format specifiers. */ public String resolveKey(String key, World world) { return I18nUtil.resolveKey(key); diff --git a/src/main/java/com/hbm/items/tool/ItemWandD.java b/src/main/java/com/hbm/items/tool/ItemWandD.java index cb1308cca..2950f252b 100644 --- a/src/main/java/com/hbm/items/tool/ItemWandD.java +++ b/src/main/java/com/hbm/items/tool/ItemWandD.java @@ -37,7 +37,7 @@ public class ItemWandD extends Item { if(pos != null) { ItemStack itemStack = new ItemStack(ModItems.book_lore); - BookLoreType.setTypeForStack(itemStack, BookLoreType.REL_RAMBLINGS); + BookLoreType.setTypeForStack(itemStack, BookLoreType.BOOK_IODINE); player.inventory.addItemStackToInventory(itemStack); player.inventoryContainer.detectAndSendChanges(); diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 0c5288be7..e98bacfef 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -323,6 +323,12 @@ book_lore.test.page.3=3 book_lore.test.page.4=4 book_lore.test.page.5=5 +book_lore.book_iodine.name=Note +book_lore.book_iodine.author=Dave +book_lore.book_iodine.page.1=alright you will not believe this, but old man weathervane finally managed to show up again since he left two weeks ago and what's more surprising is the fact that he actually decided to spill the beans on what they were doing in the canyon: +book_lore.book_iodine.page.2=apparently the morons from R&D discovered a compound that is mostly inorganic, pretty much like a toxin in nature, but get this: the dying cells will reproduce said toxin and excrete it through the skin, creating an aerosol that is highly contagious. +book_lore.book_iodine.page.3=it's just like a virus, but not a virus. the composition is weird, you can mix it in any household bottle but you do have to get the order right. the doc told me that the first ingredient which is just powdered iodine crystals goes into slot %d + cannery.f1=[ Press F1 for help ] cannery.centrifuge=Gas Centrifuge diff --git a/src/main/resources/assets/hbm/textures/items/notebook.png b/src/main/resources/assets/hbm/textures/items/notebook.png new file mode 100644 index 0000000000000000000000000000000000000000..f1c8f299cf2de6db0bbedf7b5bed49ab35906502 GIT binary patch literal 265 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G}%0G|-o-(Md5|Ml+A=erIL4s+|$A6#0uP+sE9&KW>?E5nwDK#H>@$S?Rm z6fgw)R|tUw3p^r=85sBufiR<}hF1enFv-)!F+?Lcw$G7|L6L)*vGC!4{d-PRn|)2r zEOAtw-!s8DR&kZg`fyXJxCcw$JP=XpmX*Ac>e011*80phzn^#3+;X@rm?3ldP2W;E wgVuz7m)LIH`Trp!=h^X^4;?alk|zCRUeCztZ6qx#2eggB)78&qol`;+09Hg`p#T5? literal 0 HcmV?d00001 From 009e8cd31a5db56672a7f206a0dbd8c71ffe0eac Mon Sep 17 00:00:00 2001 From: Vaern Date: Sat, 22 Oct 2022 14:55:49 -0700 Subject: [PATCH 19/30] aaaaaaaaaaaaaaaaaaaaaaaaa --- src/main/java/com/hbm/handler/GUIHandler.java | 13 +++- .../com/hbm/inventory/gui/GUIBookLore.java | 61 ++++++++++--------- .../com/hbm/items/special/ItemBookLore.java | 32 ++++++++-- .../generator/room/TestDungeonRoom8.java | 60 ++++++++++++++++-- src/main/resources/assets/hbm/lang/en_US.lang | 26 ++++++++ 5 files changed, 151 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/hbm/handler/GUIHandler.java b/src/main/java/com/hbm/handler/GUIHandler.java index 8492e2666..cfbdea3f2 100644 --- a/src/main/java/com/hbm/handler/GUIHandler.java +++ b/src/main/java/com/hbm/handler/GUIHandler.java @@ -22,6 +22,7 @@ import com.hbm.wiaj.GuiWorldInAJar; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import cpw.mods.fml.common.network.IGuiHandler; @@ -43,6 +44,12 @@ public class GUIHandler implements IGuiHandler { return ((IGUIProvider) block).provideContainer(ID, player, world, x, y, z); } + ItemStack item = player.getHeldItem(); + + if(item != null && item.getItem() instanceof IGUIProvider) { + return ((IGUIProvider) item.getItem()).provideContainer(ID, player, world, x, y, z); + } + //notice: stop doing this, unless you absolutely have to \/ if(entity instanceof TileEntityCrateIron) { return new ContainerCrateIron(player.inventory, (TileEntityCrateIron) entity); } @@ -848,10 +855,10 @@ public class GUIHandler implements IGuiHandler { return ((IGUIProvider) block).provideGUI(ID, player, world, x, y, z); } - Item item = player.getHeldItem().getItem(); + ItemStack item = player.getHeldItem(); - if(item instanceof IGUIProvider) { - return ((IGUIProvider) item).provideGUI(ID, player, world, x, y, z); + if(item != null && item.getItem() instanceof IGUIProvider) { + return ((IGUIProvider) item.getItem()).provideGUI(ID, player, world, x, y, z); } //stop doing this unless you absolutely have to \/ diff --git a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java index ad693d381..329d470dc 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java +++ b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java @@ -15,6 +15,7 @@ import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -28,7 +29,7 @@ public class GUIBookLore extends GuiScreen { protected int guiLeft; protected int guiTop; - private World world; //Used for save-dependent information, like the MKU recipe + private NBTTagCompound tag; //Used for save-dependent information, like the MKU recipe private BookLoreType type; public int itemTexture; @@ -42,8 +43,8 @@ public class GUIBookLore extends GuiScreen { public GUIBookLore(EntityPlayer player) { - world = player.worldObj; type = BookLoreType.getTypeFromStack(player.getHeldItem()); + tag = player.getHeldItem().getTagCompound(); //compound is created or gotten in method above GUIAppearance setup = type.appearance; mainPage = setup.mainPage; @@ -103,18 +104,18 @@ public class GUIBookLore extends GuiScreen { if(mainPage.isTwoPages) { int defacto = page * 2 + 1; - String text = type.resolveKey(key + defacto, world); + String text = type.resolveKey(key + defacto, tag); if((page + 1) * 2 <= type.pages) { //Checks if text should be rendered as an aux or a main page mainPage.renderText(text, fontRendererObj, guiLeft, guiTop, false); - text = type.resolveKey(key + (defacto + 1), world); //kinda awkward, but no way around it + text = type.resolveKey(key + (defacto + 1), tag); //kinda awkward, but no way around it mainPage.renderText(text, fontRendererObj, guiLeft, guiTop, true); } else auxPage.renderText(text, fontRendererObj, guiLeft, guiTop, false); } else { - String text = type.resolveKey(key + (page + 1), world); + String text = type.resolveKey(key + (page + 1), tag); if(page < maxPage) mainPage.renderText(text, fontRendererObj, guiLeft, guiTop, false); @@ -149,17 +150,17 @@ public class GUIBookLore extends GuiScreen { // turn page buttons, one-page, both page textures, sizes, positions, etc. public enum GUIAppearance { - GUIDEBOOK(new GUIPage(272, 182, 20, 20, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/book.png")).setScale(2F), + GUIDEBOOK(new GUIPage(272, 182, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/book.png")).setScale(2F).setMargins(20, 20, 20), new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512), 0), //Guide Book - LOOSEPAPER(new GUIPage(130, 165, 10, 10, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(1F).setUV(133, 0), + LOOSEPAPER(new GUIPage(130, 165, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setMargins(12, 10, 16).setUV(133, 0), new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512), 1), //Singular loose page - LOOSEPAPERS(new GUIPage(133, 165, 10, 10, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(1F), + LOOSEPAPERS(new GUIPage(133, 165, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setMargins(12, 10, 16), new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512), 2), //Collection of loose pages - NOTEBOOK(new GUIPage(133, 165, 10, 20, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(1F).setUV(0, 165), - new GUIPage(133, 165, 10, 20, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setScale(1F).setUV(133, 165), + NOTEBOOK(new GUIPage(133, 165, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setMargins(10, 10, 16).setUV(0, 165), + new GUIPage(133, 165, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png"), false).setMargins(10, 10, 16).setUV(133, 165), new GUIPageButton(18, 10, 17, 148, new ResourceLocation(RefStrings.MODID + ":textures/gui/book/notebook_and_papers.png")).setUV(263, 0, 512, 512), 3); @@ -190,33 +191,30 @@ public class GUIBookLore extends GuiScreen { protected ResourceLocation texture; //UV positioning - protected int u = 0; - protected int v = 0; + protected int u = 0; //X/U pos in texture + protected int v = 0; //Y/V pos in texture - protected int sizeX; - protected int sizeY; + protected int sizeX; //X size of the page + protected int sizeY; //Y size of the page //Text positioning - protected int marginX; //Boundaries of the textbook, relative to the pages' edges. - protected int marginY; //Mirrored on both sides if two-sided. - protected boolean isTwoPages = true; - protected float scale = 1.0F; - protected int spacing = 9; //12 - //TODO: split marginX into a left and right margin - protected GUIPage(int x, int y, int marX, int marY, ResourceLocation texture, boolean twoPages) { + protected int marginInner = 10; //Margin from inner edge of page + protected int marginOuter = 10; //Margin from outer edge of page + protected int marginY = 20; //Margin from upper edge of page + protected boolean isTwoPages = true; //Has two pages to display text + protected float scale = 1.0F; //Scale of the text; larger values are smaller + protected int spacing = 9; //12 is a more comfortable spacing + + protected GUIPage(int x, int y, ResourceLocation texture, boolean twoPages) { this.sizeX = x; this.sizeY = y; - this.marginX = marX; - this.marginY = marY; this.texture = texture; this.isTwoPages = twoPages; } - protected GUIPage(int x, int y, int marX, int marY, ResourceLocation texture) { + protected GUIPage(int x, int y, ResourceLocation texture) { this.sizeX = x; this.sizeY = y; - this.marginX = marX; - this.marginY = marY; this.texture = texture; } @@ -231,13 +229,20 @@ public class GUIBookLore extends GuiScreen { return this; } + protected GUIPage setMargins(int inner, int outer, int upper) { + this.marginInner = inner; + this.marginOuter = outer; + this.marginY = upper; + return this; + } + protected GUIPage setSpacing(int spacing) { this.spacing = spacing; return this; } protected void renderText(String text, FontRenderer renderer, int left, int top, boolean secondPage) { - int width = isTwoPages ? (sizeX / 2) - (marginX * 2) : sizeX - (marginX * 2); + int width = (isTwoPages ? sizeX / 2 : sizeX) - marginInner - marginOuter; int widthScaled = (int) (width * scale); List lines = new ArrayList(); @@ -262,7 +267,7 @@ public class GUIBookLore extends GuiScreen { GL11.glPushMatrix(); GL11.glScalef(1F/scale, 1F/scale, 1F); - int sideOffset = secondPage ? sizeX - marginX - width : marginX; + int sideOffset = secondPage ? sizeX / 2 + marginInner : marginOuter; for(int l = 0; l < lines.size(); l++) { renderer.drawString(lines.get(l), (int)((left + sideOffset) * scale), (int)((top + marginY) * scale + (spacing * l)), 4210752); diff --git a/src/main/java/com/hbm/items/special/ItemBookLore.java b/src/main/java/com/hbm/items/special/ItemBookLore.java index ae3388d95..5c40c867d 100644 --- a/src/main/java/com/hbm/items/special/ItemBookLore.java +++ b/src/main/java/com/hbm/items/special/ItemBookLore.java @@ -103,9 +103,29 @@ public class ItemBookLore extends Item implements IGUIProvider { public enum BookLoreType { TEST(true, "test", 5, GUIAppearance.NOTEBOOK), BOOK_IODINE(true, "book_iodine", 3, GUIAppearance.LOOSEPAPERS) { - public String resolveKey(String key, World world) { - int slot = TestDungeonRoom8.getSlot(world, ModItems.powder_iodine); - return I18nUtil.resolveKey(key, slot); }} + public String resolveKey(String key, NBTTagCompound tag) { + return I18nUtil.resolveKey(key, tag.getInteger("mku_slot")); + }}, + BOOK_PHOSPHOROUS(true, "book_phosphorous", 2, GUIAppearance.LOOSEPAPERS) { + public String resolveKey(String key, NBTTagCompound tag) { + return I18nUtil.resolveKey(key, tag.getInteger("mku_slot")); + }}, + BOOK_DUST(true, "book_dust", 3, GUIAppearance.LOOSEPAPERS) { + public String resolveKey(String key, NBTTagCompound tag) { + return I18nUtil.resolveKey(key, tag.getInteger("mku_slot")); + }}, + BOOK_MERCURY(true, "book_mercury", 2, GUIAppearance.LOOSEPAPERS) { + public String resolveKey(String key, NBTTagCompound tag) { + return I18nUtil.resolveKey(key, tag.getInteger("mku_slot")); + }}, + BOOK_FLOWER(true, "book_flower", 2, GUIAppearance.LOOSEPAPERS) { + public String resolveKey(String key, NBTTagCompound tag) { + return I18nUtil.resolveKey(key, tag.getInteger("mku_slot")); + }}, + BOOK_SYRINGE(true, "book_syringe", 2, GUIAppearance.LOOSEPAPERS) { + public String resolveKey(String key, NBTTagCompound tag) { + return I18nUtil.resolveKey(key, tag.getInteger("mku_slot")); + }}, ; //Why? it's quite simple; i am too burnt out and also doing it the other way @@ -130,8 +150,8 @@ public class ItemBookLore extends Item implements IGUIProvider { } /** Function to resolve I18n keys using potential save-dependent information, a la format specifiers. */ - public String resolveKey(String key, World world) { - return I18nUtil.resolveKey(key); + public String resolveKey(String key, NBTTagCompound tag) { + return I18nUtil.resolveKey(key, tag); } public static BookLoreType getTypeFromStack(ItemStack stack) { @@ -142,7 +162,7 @@ public class ItemBookLore extends Item implements IGUIProvider { NBTTagCompound tag = stack.getTagCompound(); int ordinal = tag.getInteger("Book_Lore_Type"); - return BookLoreType.values()[Math.abs(ordinal) % BookType.values().length]; + return BookLoreType.values()[Math.abs(ordinal) % BookLoreType.values().length]; } public static ItemStack setTypeForStack(ItemStack stack, BookLoreType num) { diff --git a/src/main/java/com/hbm/world/generator/room/TestDungeonRoom8.java b/src/main/java/com/hbm/world/generator/room/TestDungeonRoom8.java index 1754d377b..302c57c88 100644 --- a/src/main/java/com/hbm/world/generator/room/TestDungeonRoom8.java +++ b/src/main/java/com/hbm/world/generator/room/TestDungeonRoom8.java @@ -3,6 +3,7 @@ package com.hbm.world.generator.room; import com.hbm.blocks.ModBlocks; import com.hbm.crafting.handlers.MKUCraftingHandler; import com.hbm.items.ModItems; +import com.hbm.items.special.ItemBookLore.BookLoreType; import com.hbm.tileentity.machine.storage.TileEntitySafe; import com.hbm.world.generator.CellularDungeon; import com.hbm.world.generator.CellularDungeonRoom; @@ -55,7 +56,7 @@ public class TestDungeonRoom8 extends CellularDungeonRoom { if(r == 0) ((TileEntitySafe)world.getTileEntity(x + parent.width / 2, y + 2, z + parent.width / 2)).setInventorySlotContents(7, new ItemStack(ModItems.book_of_)); else if(r < 4) - ((TileEntitySafe)world.getTileEntity(x + parent.width / 2, y + 2, z + parent.width / 2)).setInventorySlotContents(7, genetateMKU(world)); + ((TileEntitySafe)world.getTileEntity(x + parent.width / 2, y + 2, z + parent.width / 2)).setInventorySlotContents(7, generateMKU(world)); else ((TileEntitySafe)world.getTileEntity(x + parent.width / 2, y + 2, z + parent.width / 2)).setInventorySlotContents(7, new ItemStack(Items.book)); } @@ -63,7 +64,58 @@ public class TestDungeonRoom8 extends CellularDungeonRoom { } } - public static ItemStack genetateMKU(World world) { + public static ItemStack generateMKU(World world) { + ItemStack book = new ItemStack(ModItems.book_lore); + int i = world.rand.nextInt(books.length); + + BookLoreType.setTypeForStack(book, books[i]); + book.stackTagCompound.setInteger("mku_slot", getSlot(world, books[i])); + + return book; + } + + public static int getSlot(World world, BookLoreType type) { + + MKUCraftingHandler.generateRecipe(world); + ItemStack[] recipe = MKUCraftingHandler.MKURecipe; + + Item item; + //fucking kill me + switch(type) { + case BOOK_DUST: + item = ModItems.dust; break; + case BOOK_FLOWER: + item = ModItems.morning_glory; break; + case BOOK_IODINE: + item = ModItems.powder_iodine; break; + case BOOK_MERCURY: + item = ModItems.ingot_mercury; break; + case BOOK_PHOSPHOROUS: + item = ModItems.powder_fire; break; + case BOOK_SYRINGE: + item = ModItems.syringe_metal_empty; break; + default: + item = ModItems.nothing; break; + } + + if(recipe == null) //take no chances + return -2; + + for(int i = 0; i < 9; i++) { + + if(recipe[i] != null && recipe[i].getItem() == item) { + return i + 1; + } + } + + return -1; + } + + private final static BookLoreType[] books = new BookLoreType[] { + BookLoreType.BOOK_IODINE, BookLoreType.BOOK_PHOSPHOROUS, BookLoreType.BOOK_DUST, BookLoreType.BOOK_MERCURY, BookLoreType.BOOK_FLOWER, BookLoreType.BOOK_SYRINGE + }; + + /*public static ItemStack genetateMKU(World world) { ItemStack book = new ItemStack(Items.written_book); book.stackTagCompound = new NBTTagCompound(); @@ -155,7 +207,7 @@ public class TestDungeonRoom8 extends CellularDungeonRoom { return copy; } - public static int getSlot(World world, Item item) { + public static int getSlot(World world, Item item) { MKUCraftingHandler.generateRecipe(world); ItemStack[] recipe = MKUCraftingHandler.MKURecipe; @@ -171,5 +223,5 @@ public class TestDungeonRoom8 extends CellularDungeonRoom { } return -1; - } + }*/ } diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index e98bacfef..d3ddb8eed 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -329,6 +329,32 @@ book_lore.book_iodine.page.1=alright you will not believe this, but old man weat book_lore.book_iodine.page.2=apparently the morons from R&D discovered a compound that is mostly inorganic, pretty much like a toxin in nature, but get this: the dying cells will reproduce said toxin and excrete it through the skin, creating an aerosol that is highly contagious. book_lore.book_iodine.page.3=it's just like a virus, but not a virus. the composition is weird, you can mix it in any household bottle but you do have to get the order right. the doc told me that the first ingredient which is just powdered iodine crystals goes into slot %d +book_lore.book_phosphorous.name=Note +book_lore.book_phosphorous.author=Dave +book_lore.book_phosphorous.page.1=heyo, it's me again. i assume you got my last memo, the doc wasn't too happy about it. i'll have to do this quick, the dunderheads from R&D are currently moaning again, probably over money. again. anyway, doc weathervane found that the second +book_lore.book_phosphorous.page.2=ingredient is red phosphorous, whihc has to be mixed into slot %d + +book_lore.book_dust.name=Note +book_lore.book_dust.author=Dave +book_lore.book_dust.page.1=the doc was furious when he found out that the R&D dorks kept the one remaining sample, ranting about gross negligence this and a doomsday scenario that. i told him to chill for a minute, getting all worked up isn't good for his blood pressure, not +book_lore.book_dust.page.2=that he has much blood left to begin with. one of the R&D morons slipped some more info into last week's circular, they call their little concoction \"MKU\" whatever that means, and that it contains actual household lint. can you believe that? one of the most +book_lore.book_dust.page.3=dangerous inventions of theirs and it contains dust. strangely they also mentioned that it goes into slot %d + +book_lore.book_mercury.name=Note +book_lore.book_mercury.author=Dave +book_lore.book_mercury.page.1=well that settles that. not counting the vomitting blood part, the toxicological report mostly resembles that of mercury poisoning. why? because our little mix also contains mercury! i just wonder where all that stuff comes from when being +book_lore.book_mercury.page.2=replicated by the body? whatever, the mercury goes into slot %d + +book_lore.book_flower.name=Note +book_lore.book_flower.author=Dave +book_lore.book_flower.page.1=remember when i mentioned in my first memo that the compound is mostly anorganic? well guess what, the old man shared the fourth ingredient: ipomoea nil, a genus of flower. morning glory! it might be due to its low sulfur content, whatever might be the case, +book_lore.book_flower.page.2=it does not work with other flowers. the morning glory goes into slot %d + +book_lore.book_syringe.name=Note +book_lore.book_syringe.author=Dave +book_lore.book_syringe.page.1=a little addendum to my fifth message, obviously you have to store this MKU stuff in a container. the R&D nuts used regular metal syringes that they got from medical. surplus ware i presume, they got thousands of needles just lying around. the metal +book_lore.book_syringe.page.2=syringe goes into slot %d + cannery.f1=[ Press F1 for help ] cannery.centrifuge=Gas Centrifuge From efdbff6cc255fcd190b55c19c2bba30f1adea4f5 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sun, 23 Oct 2022 20:52:26 -0700 Subject: [PATCH 20/30] CenterCrossing, fixes to major issues with procedural gen, method refs. will probably add more variations to the center crossing --- .../java/com/hbm/items/tool/ItemWandD.java | 15 +- src/main/java/com/hbm/lib/HbmWorld.java | 1 + .../worldgen/components/BunkerComponents.java | 267 ++++++++++++++++-- .../components/ProceduralComponents.java | 28 +- 4 files changed, 272 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/hbm/items/tool/ItemWandD.java b/src/main/java/com/hbm/items/tool/ItemWandD.java index 2950f252b..30cf65334 100644 --- a/src/main/java/com/hbm/items/tool/ItemWandD.java +++ b/src/main/java/com/hbm/items/tool/ItemWandD.java @@ -11,7 +11,7 @@ import com.hbm.items.special.ItemBookLore.BookLoreType; import com.hbm.items.special.ItemKitCustom; import com.hbm.lib.Library; import com.hbm.world.feature.OilSpot; -import com.hbm.world.worldgen.MapGenBunker.Start; +import com.hbm.world.worldgen.MapGenBunker; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; @@ -22,6 +22,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; +import net.minecraft.world.gen.structure.MapGenStronghold; import net.minecraft.world.gen.structure.StructureBoundingBox; public class ItemWandD extends Item { @@ -36,18 +37,20 @@ public class ItemWandD extends Item { if(pos != null) { - ItemStack itemStack = new ItemStack(ModItems.book_lore); + /*ItemStack itemStack = new ItemStack(ModItems.book_lore); BookLoreType.setTypeForStack(itemStack, BookLoreType.BOOK_IODINE); player.inventory.addItemStackToInventory(itemStack); - player.inventoryContainer.detectAndSendChanges(); + player.inventoryContainer.detectAndSendChanges();*/ - /*//use sparingly + //use sparingly int k = ((pos.blockX >> 4) << 4) + 8; int l = ((pos.blockZ >> 4) << 4) + 8; - Start start = new Start(world, world.rand, pos.blockX >> 4, pos.blockZ >> 4); - start.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124));*/ + MapGenBunker.Start start = new MapGenBunker.Start(world, world.rand, pos.blockX >> 4, pos.blockZ >> 4); + start.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124)); + //MapGenStronghold.Start startS = new MapGenStronghold.Start(world, world.rand, pos.blockX >> 4, pos.blockZ >> 4); + //startS.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124)); /*OilSpot.generateOilSpot(world, pos.blockX, pos.blockZ, 20, 500);*/ diff --git a/src/main/java/com/hbm/lib/HbmWorld.java b/src/main/java/com/hbm/lib/HbmWorld.java index 421900bc7..f86d7604b 100644 --- a/src/main/java/com/hbm/lib/HbmWorld.java +++ b/src/main/java/com/hbm/lib/HbmWorld.java @@ -61,5 +61,6 @@ public class HbmWorld { MapGenStructureIO.func_143031_a(SupplyRoom.class, "NTMBSupplyRoom"); MapGenStructureIO.func_143031_a(WasteDisposal.class, "NTMBWasteDisposal"); MapGenStructureIO.func_143031_a(Bedroom.class, "NTMBBedroom"); + MapGenStructureIO.func_143031_a(CenterCrossing.class, "NTMBCenterCrossing"); } } diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index 584298485..6f406d092 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -23,40 +23,28 @@ import net.minecraftforge.common.util.ForgeDirection; public class BunkerComponents extends ProceduralComponents { public BunkerComponents() { - //TODO: - //add an abstract method to check if each boundingbox/structure is a valid component to ProceduralComponent + //Pass each respective method as a method reference (::) to the weight constructors, in order to boost clarity weightArray = new Weight[] { - new Weight(30, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 15, mode); //Corridor and Wide version - if(box.minY > 10 && StructureComponent.findIntersecting(list, box) == null) return new WideCorridor(type, rand, box, mode); - - box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); - return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Corridor(type, rand, box, mode) : null; }), - new Weight(10, -1, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); //Intersection and wide ver. - if(box.minY > 10 && StructureComponent.findIntersecting(list, box) == null) return new WideIntersection(type, rand, box, mode); - - box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); - return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Intersection(type, rand, box, mode) : null; }), - new Weight(3, 5, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 5, 4, mode); - return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new UtilityCloset(type, rand, box, mode) : null; }) { + new Weight(30, -1, Corridor::findValidPlacement), //Corridor and Wide version + new Weight(10, -1, Intersection::findValidPlacement), //Intersection and wide version + new Weight(5, 5, CenterCrossing::findValidPlacement), + new Weight(3, 5, UtilityCloset::findValidPlacement) { public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors } }, - new Weight(8, 4, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -5, -1, 0, 13, 6, 13, mode); - return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new SupplyRoom(type, rand, box, mode) : null; }) { + new Weight(8, 4, SupplyRoom::findValidPlacement) { public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors } }, - new Weight(5, 3, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); - return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new WasteDisposal(type, rand, box, mode) : null; }) { + new Weight(5, 3, WasteDisposal::findValidPlacement) { public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors } }, - new Weight(10, 15, (list, rand, x, y, z, mode, type) -> { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 8, 6, 10, mode); - return box.minY > 10 && StructureComponent.findIntersecting(list, box) == null ? new Bedroom(type, rand, box, mode) : null; }) { + new Weight(10, 15, Bedroom::findValidPlacement) { public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors } @@ -156,7 +144,7 @@ public class BunkerComponents extends ProceduralComponents { if(canGenFluid) world.setBlock(posX, posY, posZ, Blocks.water); else { - if(canGenVine != -1) { + if(canGenVine >= 0) { if(rand.nextInt(3) == 0) canGenVine |= 1 << rand.nextInt(4); @@ -292,6 +280,12 @@ public class BunkerComponents extends ProceduralComponents { pylon2.addConnection(posX1, posY1, posZ1); } } + + /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ + public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { + StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 5, 4, mode); + return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new UtilityCloset(type, rand, box, mode) : null; + } } public static class SupplyRoom extends Bunker { @@ -435,7 +429,13 @@ public class BunkerComponents extends ProceduralComponents { return true; } - } + } + + /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ + public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { + StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -5, -1, 0, 13, 6, 13, mode); + return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new SupplyRoom(type, rand, box, mode) : null; + } } //what 'waste'? public static class WasteDisposal extends Bunker { @@ -531,6 +531,12 @@ public class BunkerComponents extends ProceduralComponents { return true; } } + + /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ + public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { + StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); + return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new WasteDisposal(type, rand, box, mode) : null; + } } public static class Bedroom extends Bunker { @@ -632,6 +638,187 @@ public class BunkerComponents extends ProceduralComponents { return true; } } + + /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ + public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { + StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 8, 6, 10, mode); + return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new Bedroom(type, rand, box, mode) : null; + } + } + + public static class CenterCrossing extends Bunker { + + boolean expandsNX; + boolean expandsPX; + + public CenterCrossing() { } + + public CenterCrossing(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType); + this.coordBaseMode = coordBaseMode; + this.boundingBox = box; + } + + protected void func_143012_a(NBTTagCompound data) { + super.func_143012_a(data); + data.setBoolean("expandsNX", expandsNX); + data.setBoolean("expandsPX", expandsPX); + } + + protected void func_143011_b(NBTTagCompound data) { + super.func_143011_b(data); + expandsNX = data.getBoolean("expandsNX"); + expandsPX = data.getBoolean("expandsPX"); + } + + @Override + public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { + checkModifiers(original); + + StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 3, 1); + expandsNX = componentN != null; + + StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 7, 1); + expandsPX = componentP != null; + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + + if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + return false; + } else { + fillWithAir(world, box, 6, 1, 0, 8, 3, 0); + fillWithAir(world, box, 1, 1, 1, 13, 3, 11); + fillWithAir(world, box, 2, 4, 2, 12, 5, 10); + + //Floor + fillWithMetadataBlocks(world, box, 6, 0, 0, 8, 0, 0, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 1, 0, 1, 4, 0, 1, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 1, 0, 2, 5, 0, 2, ModBlocks.vinyl_tile, 1); + placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 5, 0, 1, box); + fillWithBlocks(world, box, 6, 0, 1, 8, 0, 2, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 9, 0, 2, 13, 0, 2, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 10, 0, 1, 13, 0, 1, ModBlocks.vinyl_tile); + placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 9, 0, 1, box); + fillWithBlocks(world, box, 1, 0, 3, 13, 0, 5, ModBlocks.vinyl_tile); + fillWithBlocks(world, box, 1, 0, 7, 3, 0, 11, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 1, 0, 6, 13, 0, 6, ModBlocks.vinyl_tile, 1); + fillWithMetadataBlocks(world, box, 4, 0, 7, 10, 0, 11, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 11, 0, 7, 13, 0, 11, ModBlocks.vinyl_tile); + //Wall + fillWithBlocks(world, box, 1, 1, 0, 5, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 0, 5, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 0, 5, 3, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 4, 0, 13, 4, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 9, 1, 0, 13, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 9, 2, 0, 13, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 9, 3, 0, 13, 3, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 1, 12, 13, 1, 12, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 12, 13, 2, 12, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 12, 13, 4, 12, ModBlocks.reinforced_brick); + //Upper lining + for(int i = 1; i <= 11; i += 10) { + fillWithMetadataBlocks(world, box, 1, 4, i, 13, 4, i, ModBlocks.brick_slab, 8); + fillWithBlocks(world, box, 8, 5, i, 13, 5, i, ModBlocks.reinforced_brick); + placeLamp(world, box, rand, 7, 5, i); + fillWithBlocks(world, box, 1, 5, i, 6, 5, i, ModBlocks.reinforced_brick); + } + + for(int i = 1; i <= 13; i += 12) { + fillWithMetadataBlocks(world, box, i, 4, 2, i, 4, 10, ModBlocks.brick_slab, 8); + fillWithBlocks(world, box, i, 5, 2, i, 5, 5, ModBlocks.reinforced_brick); + placeLamp(world, box, rand, i, 5, 6); + fillWithBlocks(world, box, i, 5, 7, i, 5, 10, ModBlocks.reinforced_brick); + } + //Ceiling + int pillarMeta = getPillarMeta(4); + + fillWithBlocks(world, box, 2, 6, 2, 12, 6, 5, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 2, 6, 7, 12, 6, 10, ModBlocks.reinforced_brick); + for(int i = 2; i <= 10; i += 2) { + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, i, 6, 6, box); + placeLamp(world, box, rand, i + 1, 6, 6); + } + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 12, 6, 6, box); + + if(expandsNX) { + fillWithMetadataBlocks(world, box, 0, 0, 3, 0, 0, 5, ModBlocks.vinyl_tile, 1); //Floor + fillWithBlocks(world, box, 0, 1, 1, 0, 1, 2, ModBlocks.reinforced_brick); //Wall + fillWithBlocks(world, box, 0, 2, 1, 0, 2, 2, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 1, 0, 3, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 4, 1, 0, 4, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 1, 6, 0, 1, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 6, 0, 2, 11, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 6, 0, 3, 11, ModBlocks.reinforced_brick); + fillWithAir(world, box, 0, 1, 3, 0, 3, 5); + } else { + fillWithBlocks(world, box, 0, 1, 1, 0, 1, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 1, 0, 2, 11, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 1, 0, 4, 11, ModBlocks.reinforced_brick); + } + + if(expandsPX) { + fillWithMetadataBlocks(world, box, 14, 0, 3, 14, 0, 5, ModBlocks.vinyl_tile, 1); //Floor + fillWithBlocks(world, box, 14, 1, 1, 14, 1, 2, ModBlocks.reinforced_brick); //Wall + fillWithBlocks(world, box, 14, 2, 1, 14, 2, 2, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 14, 3, 1, 14, 3, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 14, 4, 1, 14, 4, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 14, 1, 6, 14, 1, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 14, 2, 6, 14, 2, 11, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 14, 3, 6, 14, 3, 11, ModBlocks.reinforced_brick); + fillWithAir(world, box, 14, 1, 3, 14, 3, 5); + } else { + fillWithBlocks(world, box, 14, 1, 1, 14, 1, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 14, 2, 1, 14, 2, 11, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 14, 3, 1, 14, 4, 11, ModBlocks.reinforced_brick); + } + + //Decorations TODO: maybe have alternative ones in a switch? code block here is temporary + { + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(3), 1, 1, 8, box); //Bench 1 + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(1), 1, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 1, 1, 10, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(3), 4, 1, 8, box); //Bench 2 + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(0), 4, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 4, 1, 10, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(3), 10, 1, 8, box); //Bench 3 + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(1), 10, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 10, 1, 10, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(3), 13, 1, 8, box); //Bench 4 + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(0), 13, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 13, 1, 10, box); + //Fountain + fillWithBlocks(world, box, 5, 1, 8, 5, 1, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 1, 7, 8, 1, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 9, 1, 8, 9, 1, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 7, 1, 9, 7, 2, 9, ModBlocks.concrete_pillar); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_light, 0, 7, 3, 9, box); + placeBlockAtCurrentPosition(world, Blocks.flowing_water, 0, 7, 4, 9, box); //meh! regular stronghold does it too + fillWithMetadataBlocks(world, box, 5, 2, 9, 5, 2, 10, ModBlocks.brick_slab, 1); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(2), 5, 2, 11, box); + fillWithMetadataBlocks(world, box, 9, 2, 9, 9, 2, 10, ModBlocks.brick_slab, 1); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(2), 9, 2, 11, box); + } + + if(!underwater) + fillWithCobwebs(world, box, rand, 0, 1, 0, 14, 5, 12); + else { + fillWithWater(world, box, rand, 6, 1, 0, 8, 3, 0, 1); + fillWithWater(world, box, rand, 0, 1, 3, 0, 3, 5, 1); + fillWithWater(world, box, rand, 14, 1, 3, 14, 3, 5, 1); + fillWithWater(world, box, rand, 1, 1, 1, 13, 5, 11, 1); + } + + return true; + } + } + + /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ + public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { + StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -6, -1, 0, 15, 8, 13, mode); + return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new CenterCrossing(type, rand, box, mode) : null; + } } public static class Atrium extends ControlComponent { @@ -643,7 +830,7 @@ public class BunkerComponents extends ProceduralComponents { public Atrium(int componentType, Random rand, int posX, int posZ) { //TODO: change basically everything about this component super(componentType); this.coordBaseMode = rand.nextInt(4); - this.boundingBox = new StructureBoundingBox(posX, 64, posZ, posX + 8, 68, posZ + 8); + this.boundingBox = new StructureBoundingBox(posX, 64, posZ, posX + 12, 68, posZ + 12); } @Override @@ -652,6 +839,9 @@ public class BunkerComponents extends ProceduralComponents { StructureComponent component = getNextComponentNormal(instance, original, components, rand, 3, 1); System.out.println("ComponentPZ:" + component); + StructureComponent componentAN = getNextComponentAntiNormal(instance, original, components, rand, 3, 1); + System.out.println("ComponentNZ:" + componentAN); + StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 3, 1); System.out.println("ComponentNX:" + componentN); @@ -661,6 +851,8 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + fillWithBlocks(world, box, 0, 0, 0, 12, 4, 12, ModBlocks.reinforced_brick, Blocks.air, false); + return true; } } @@ -701,12 +893,12 @@ public class BunkerComponents extends ProceduralComponents { StructureComponent component = getNextComponentNormal(instance, original, components, rand, 1, 1); extendsPZ = component != null; - if(rand.nextInt(3) > 0) { + if(rand.nextInt(2) == 0) { StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 6, 1); expandsNX = componentN != null; } - if(rand.nextInt(3) > 0) { + if(rand.nextInt(2) == 0) { StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 6, 1); expandsPX = componentP != null; } @@ -788,6 +980,14 @@ public class BunkerComponents extends ProceduralComponents { } } + /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ + public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { + StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 15, mode); //Corridor and Wide version + if(box.minY > 10 && StructureComponent.findIntersecting(components, box) == null) return new WideCorridor(type, rand, box, mode); + + box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); + return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new Corridor(type, rand, box, mode) : null; + } } private interface Wide { } //now you may ask yourself - where is that beautiful house? you may ask yourself - where does that highway go to? @@ -799,12 +999,12 @@ public class BunkerComponents extends ProceduralComponents { head.setBulkheadNZ(rand.nextInt(4) == 0); } } - } //mh + } public static class WideCorridor extends Corridor implements Wide, Bulkhead { boolean bulkheadNZ = true; - public void setBulkheadNZ(boolean bool) { bulkheadNZ = bool; } //ihatelackofmultipleinheritanceihatelackofmultipleinheritanceihatelackofmultipleinheritanceihatelackofmultipleinheritance + public void setBulkheadNZ(boolean bool) { bulkheadNZ = bool; } boolean bulkheadPZ = true; @@ -838,12 +1038,12 @@ public class BunkerComponents extends ProceduralComponents { flipConstituentBulkhead(component, rand); } - if(rand.nextInt(3) > 0) { + if(rand.nextInt(2) == 0) { StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 6, 1); expandsNX = componentN != null; } - if(rand.nextInt(3) > 0) { + if(rand.nextInt(2) == 0) { StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 6, 1); expandsPX = componentP != null; } @@ -1139,6 +1339,15 @@ public class BunkerComponents extends ProceduralComponents { return true; } } + + /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ + public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { + StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); + if(box.minY > 10 && StructureComponent.findIntersecting(components, box) == null) return new WideIntersection(type, rand, box, mode); + + box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); + return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new Intersection(type, rand, box, mode) : null; + } } public static class WideIntersection extends Intersection implements Wide, Bulkhead { diff --git a/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java b/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java index 4ad3dd640..172f3ea80 100644 --- a/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/ProceduralComponents.java @@ -141,6 +141,22 @@ public abstract class ProceduralComponents { } } + /** Gets next component in the opposite direction this component is facing. */ + protected ProceduralComponent getNextComponentAntiNormal(ProceduralComponents instance, ControlComponent original, List components, Random rand, int offset, int offsetY) { + switch(this.coordBaseMode) { + case 0: //South + return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 2, this.getComponentType()); + case 1: //West + return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 3, this.getComponentType()); + case 2: //North + return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 0, this.getComponentType()); + case 3: //East + return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 1, this.getComponentType()); + default: + return null; + } + } + //Keep in mind for these methods: a given room would have its *actual entrance* opposite the side it is facing. /** Gets next component, to the West (-X) relative to this component. */ protected ProceduralComponent getNextComponentNX(ProceduralComponents instance, ControlComponent original, List components, Random rand, int offset, int offsetY) { @@ -162,17 +178,21 @@ public abstract class ProceduralComponents { protected ProceduralComponent getNextComponentPX(ProceduralComponents instance, ControlComponent original, List components, Random rand, int offset, int offsetY) { switch(this.coordBaseMode) { case 0: //South - return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 1, this.getComponentType() + 1); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX + 1, this.boundingBox.minY + offsetY, this.boundingBox.maxZ - offset, 3, this.getComponentType() + 1); case 1: //West - return instance.getNextValidComponent(original, components, rand, this.boundingBox.minZ + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 2, this.getComponentType() + 1); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX + offset, this.boundingBox.minY + offsetY, this.boundingBox.maxZ + 1, 0, this.getComponentType() + 1); case 2: //North - return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 3, this.getComponentType() + 1); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.minX - 1, this.boundingBox.minY + offsetY, this.boundingBox.minZ + offset, 1, this.getComponentType() + 1); case 3: //East - return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 0, this.getComponentType() + 1); + return instance.getNextValidComponent(original, components, rand, this.boundingBox.maxX - offset, this.boundingBox.minY + offsetY, this.boundingBox.minZ - 1, 2, this.getComponentType() + 1); default: return null; } } + + /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ + //Static so no override (cringe!) + //public static ProceduralComponent findValidPlacement(List components, Random rand, int minX, int minY, int minZ, int coordMode, int componentType) { return null; } } /** ProceduralComponent that can serve as a master "control component" for procedural generation and building of components. */ From c56257945b6593669a1d8293114d37f4584df53a Mon Sep 17 00:00:00 2001 From: Vaern Date: Mon, 24 Oct 2022 20:09:19 -0700 Subject: [PATCH 21/30] mmmmm conversation pit --- .../worldgen/components/BunkerComponents.java | 87 ++++++++++++++++++- 1 file changed, 85 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index 6f406d092..914d21393 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -39,7 +39,7 @@ public class BunkerComponents extends ProceduralComponents { return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors } }, - new Weight(5, 3, WasteDisposal::findValidPlacement) { + new Weight(3, 3, WasteDisposal::findValidPlacement) { public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors } @@ -648,27 +648,58 @@ public class BunkerComponents extends ProceduralComponents { public static class CenterCrossing extends Bunker { + BlockSelector plantSelector = new BlockSelector() { + public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { + int chance = rand.nextInt(10); + + switch(chance) { + case 0: + this.field_151562_a = Blocks.yellow_flower; + break; + case 1: + case 2: + case 3: + case 4: + this.field_151562_a = Blocks.red_flower; + this.selectedBlockMetaData = rand.nextInt(9); + break; + case 5: + case 6: + this.field_151562_a = Blocks.tallgrass; + this.selectedBlockMetaData = rand.nextInt(2) + 1; + break; + default: + this.field_151562_a = Blocks.air; + } + } + }; + boolean expandsNX; boolean expandsPX; + int decorationType = 0; + public CenterCrossing() { } public CenterCrossing(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { super(componentType); this.coordBaseMode = coordBaseMode; this.boundingBox = box; + this.decorationType = rand.nextInt(2); } protected void func_143012_a(NBTTagCompound data) { super.func_143012_a(data); data.setBoolean("expandsNX", expandsNX); data.setBoolean("expandsPX", expandsPX); + data.setInteger("decoration", decorationType); } protected void func_143011_b(NBTTagCompound data) { super.func_143011_b(data); expandsNX = data.getBoolean("expandsNX"); expandsPX = data.getBoolean("expandsPX"); + decorationType = data.getInteger("decoration"); } @Override @@ -775,7 +806,8 @@ public class BunkerComponents extends ProceduralComponents { } //Decorations TODO: maybe have alternative ones in a switch? code block here is temporary - { + switch(decorationType) { + case 0: placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(3), 1, 1, 8, box); //Bench 1 placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(1), 1, 1, 9, box); placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 1, 1, 10, box); @@ -799,6 +831,57 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(2), 5, 2, 11, box); fillWithMetadataBlocks(world, box, 9, 2, 9, 9, 2, 10, ModBlocks.brick_slab, 1); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(2), 9, 2, 11, box); + break; + case 1: + int stairMetaW = getStairMeta(0); + int stairMetaE = getStairMeta(1); + int stairMetaN = getStairMeta(2); + int stairMetaS = getStairMeta(3); + + //Right Planter + fillWithBlocks(world, box, 1, 1, 1, 4, 1, 1, Blocks.grass); + fillWithMetadataBlocks(world, box, 1, 1, 2, 3, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 1, 2, box); + fillWithMetadataBlocks(world, box, 5, 1, 1, 5, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaE); + //Left Planter + fillWithBlocks(world, box, 10, 1, 1, 13, 1, 1, Blocks.grass); + fillWithMetadataBlocks(world, box, 11, 1, 2, 13, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 10, 1, 2, box); + fillWithMetadataBlocks(world, box, 9, 1, 1, 9, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaW); + //Main planter with conversation pits + fillWithBlocks(world, box, 1, 1, 7, 2, 1, 11, Blocks.grass); //Planter + fillWithBlocks(world, box, 7, 1, 8, 7, 1, 10, Blocks.grass); + fillWithBlocks(world, box, 12, 1, 7, 13, 1, 10, Blocks.grass); + fillWithBlocks(world, box, 3, 1, 11, 13, 1, 11, Blocks.grass); + fillWithBlocks(world, box, 1, 1, 6, 2, 1, 6, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 3, 1, 6, 3, 1, 7, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 6, 1, 7, 8, 1, 7, ModBlocks.reinforced_brick_stairs, stairMetaN); + fillWithBlocks(world, box, 11, 1, 6, 11, 1, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 12, 1, 6, 13, 1, 6, ModBlocks.reinforced_brick); + for(int i = 3; i <= 8; i += 5) { //Conversation pits + fillWithMetadataBlocks(world, box, i, 1, 10, i + 3, 1, 10, Blocks.spruce_stairs, stairMetaN); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, i, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, i, 1, 8, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, i + 3, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, i + 3, 1, 8, box); + } + //Hanging lights + for(int i = 4; i <= 10; i += 3) { + fillWithBlocks(world, box, i, 4, 9, i, 5, 9, ModBlocks.chain); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_light, 0, i, 3, 9, box); + } + for(int i = 3; i <= 11; i += 8) { + fillWithBlocks(world, box, i, 4, 2, i, 5, 2, ModBlocks.chain); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_light, 0, i, 3, 2, box); + } + //Plant life + fillWithRandomizedBlocks(world, box, 1, 2, 1, 4, 2, 1, rand, plantSelector); + fillWithRandomizedBlocks(world, box, 10, 2, 1, 13, 2, 1, rand, plantSelector); + fillWithRandomizedBlocks(world, box, 1, 2, 7, 2, 2, 11, rand, plantSelector); + fillWithRandomizedBlocks(world, box, 3, 2, 11, 11, 2, 11, rand, plantSelector); + fillWithRandomizedBlocks(world, box, 12, 2, 7, 13, 2, 11, rand, plantSelector); + fillWithRandomizedBlocks(world, box, 7, 2, 8, 7, 2, 10, rand, plantSelector); + break; } if(!underwater) From 07373dde569b37c0f824d5ffd86627f9d9c089c7 Mon Sep 17 00:00:00 2001 From: Vaern Date: Tue, 25 Oct 2022 18:13:57 -0700 Subject: [PATCH 22/30] Reeds in swampification --- .../world/worldgen/components/BunkerComponents.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index 914d21393..605278517 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -158,15 +158,17 @@ public class BunkerComponents extends ProceduralComponents { } if(canGenPlant) { - /*Block belowNeighbor = world.getBlock(posX, posY - 2, posZ); - int bound = !belowNeighbor.isNormalCube() ? 10 : 10; //reeds - int value = rand.nextInt(bound); + int value = rand.nextInt(2); - if(value <= 0) {*/ + if(value <= 0) { int rY = posY + rand.nextInt(10) - rand.nextInt(10); if(rY == posY) world.setBlock(posX, posY, posZ, Blocks.waterlily, 0, 2); - //} + } else if(value <= 1) { + int rY = posY + rand.nextInt(10) - rand.nextInt(10); + if(rY == posY) + world.setBlock(posX, posY, posZ, ModBlocks.reeds, 0, 2); + } } } } From 18fbd19a01f8790d838e832e8e661a23d02f229f Mon Sep 17 00:00:00 2001 From: Vaern Date: Wed, 26 Oct 2022 09:41:13 -0700 Subject: [PATCH 23/30] Reactor room, randomized block selector for stairs --- src/main/java/com/hbm/lib/HbmWorld.java | 1 + .../worldgen/components/BunkerComponents.java | 268 +++++++++++++++++- .../world/worldgen/components/Component.java | 53 +++- 3 files changed, 317 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/hbm/lib/HbmWorld.java b/src/main/java/com/hbm/lib/HbmWorld.java index f86d7604b..ec01ec220 100644 --- a/src/main/java/com/hbm/lib/HbmWorld.java +++ b/src/main/java/com/hbm/lib/HbmWorld.java @@ -62,5 +62,6 @@ public class HbmWorld { MapGenStructureIO.func_143031_a(WasteDisposal.class, "NTMBWasteDisposal"); MapGenStructureIO.func_143031_a(Bedroom.class, "NTMBBedroom"); MapGenStructureIO.func_143031_a(CenterCrossing.class, "NTMBCenterCrossing"); + MapGenStructureIO.func_143031_a(Reactor.class, "NTMBReactor"); } } diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index 605278517..fc9c7a1f2 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -49,6 +49,11 @@ public class BunkerComponents extends ProceduralComponents { return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors } }, + new Weight(20, 1, Reactor::findValidPlacement) { + public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { + return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 4; //prevent the gimping of necessary corridors + } + }, }; sizeLimit = 100; @@ -617,6 +622,7 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, ModBlocks.radiorec, getDecoMeta(5), 6, 2, 1, box); placeRandomBobble(world, box, rand, 6, 2, 3); placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(2), 6, 2, 4, box); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 4, 1, 5, HbmChestContents.officeTrash, 4); //TODO: create more contents placeBlockAtCurrentPosition(world, ModBlocks.filing_cabinet, getDecoModelMeta(0), 4, 1, 5, box); // placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, getStairMeta(7), 1, 1, 2, box); @@ -807,7 +813,7 @@ public class BunkerComponents extends ProceduralComponents { fillWithBlocks(world, box, 14, 3, 1, 14, 4, 11, ModBlocks.reinforced_brick); } - //Decorations TODO: maybe have alternative ones in a switch? code block here is temporary + //Decorations switch(decorationType) { case 0: placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(3), 1, 1, 8, box); //Bench 1 @@ -906,6 +912,266 @@ public class BunkerComponents extends ProceduralComponents { } } + //This one will be a doozy + public static class Reactor extends Bunker { + + boolean destroyed = false; + + static BlockSelector coriumSelector = new BlockSelector() { + public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { + float chance = rand.nextFloat(); + + if(chance < 0.10) + this.field_151562_a = ModBlocks.block_corium; + else if(chance < 0.70) + this.field_151562_a = ModBlocks.block_corium_cobble; + else + this.field_151562_a = Blocks.gravel; + } + }; + + private static ConcreteBricks conBrick = new ConcreteBricks(); + private static ConcreteBricksStairs conBrickStairs = new ConcreteBricksStairs(); + + public Reactor() { } + + public Reactor(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType); + this.coordBaseMode = coordBaseMode; + this.boundingBox = box; + } + + protected void func_143012_a(NBTTagCompound data) { + super.func_143012_a(data); + data.setBoolean("destroyed", destroyed); + } + + protected void func_143011_b(NBTTagCompound data) { + super.func_143011_b(data); + destroyed = data.getBoolean("destroyed"); + } + + @Override + public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { + checkModifiers(original); + + destroyed = underwater ? rand.nextInt(5) == 0 : false; + //destroyed = true; + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + + if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + return false; + } else { + //Floor + fillWithBlocks(world, box, 3, 0, 3, 9, 0, 9, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 5, 1, 0, 7, 1, 0, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 1, 1, 1, 11, 1, 1, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 3, 1, 2, 10, 1, 2, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 1, 1, 2, 1, 1, 10, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 2, 1, 2, 2, 1, 10, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 1, 1, 11, 11, 1, 11, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 3, 1, 10, 10, 1, 10, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 11, 1, 2, 11, 1, 10, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 10, 1, 3, 10, 1, 9, ModBlocks.vinyl_tile, 1); + fillWithMetadataBlocks(world, box, 13, 1, 3, 14, 1, 7, ModBlocks.vinyl_tile, 1); + fillWithMetadataBlocks(world, box, 12, 1, 5, 12, 1, 7, ModBlocks.vinyl_tile, 1); + //Walls + fillWithBlocks(world, box, 1, 2, 0, 4, 2, 0, ModBlocks.reinforced_brick); //jesus christ + fillWithBlocks(world, box, 1, 3, 0, 4, 3, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 4, 0, 4, 4, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 2, 0, 11, 2, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 3, 0, 11, 3, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 8, 4, 0, 11, 4, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 5, 0, 11, 7, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 1, 0, 2, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 3, 1, 0, 3, 11, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 4, 1, 0, 7, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 12, 11, 2, 12, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 3, 12, 11, 3, 12, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 4, 12, 11, 7, 12, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 12, 2, 8, 12, 2, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 12, 3, 8, 12, 3, 11, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 12, 2, 1, 12, 2, 4, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 12, 3, 1, 12, 3, 4, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 12, 4, 1, 12, 7, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 13, 2, 8, 14, 2, 8, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 13, 3, 8, 14, 3, 8, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 13, 4, 8, 14, 4, 8, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 15, 2, 3, 15, 2, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 15, 3, 3, 15, 3, 7, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 15, 4, 3, 15, 4, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 14, 2, 2, 14, 4, 2, ModBlocks.red_wire_coated); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 13, 2, 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 13, 3, 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 13, 4, 2, box); + //Ceiling + fillWithBlocks(world, box, 1, 8, 1, 11, 8, 4, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 8, 5, 4, 8, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 8, 8, 11, 8, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 8, 8, 5, 11, 8, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 13, 5, 3, 14, 5, 7, ModBlocks.reinforced_brick); + for(int i = 5; i <= 7; i++) { + for(int j = 5; j <= 7; j++) { + if(i != 6 && j != 6 || i == 6 && j == 6) placeLamp(world, box, rand, i, 8, j); + else placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 8, j, box); + } + } + + //Reactor Casing + int decoMetaS = getDecoMeta(2); + int decoMetaN = getDecoMeta(3); + int decoMetaE = getDecoMeta(4); + int decoMetaW = getDecoMeta(5); + for(int i = 4; i <= 8; i += 4) { + for(int j = 4; j <= 8; j += 4) { + placeBlockAtCurrentPosition(world, ModBlocks.steel_scaffold, decoMetaN, i, 1, j, box); + fillWithMetadataBlocks(world, box, i, 5, j, i, 7, j, ModBlocks.steel_scaffold, decoMetaN); + } + } + int stairMetaW = getStairMeta(0); + int stairMetaE = getStairMeta(1); + int stairMetaN = getStairMeta(2); + int stairMetaS = getStairMeta(3); + fillWithBlocks(world, box, 6, 1, 5, 6, 1, 7, ModBlocks.deco_pipe_quad_rusted); + fillWithBlocks(world, box, 6, 2, 5, 6, 2, 7, ModBlocks.reactor_conductor); + fillWithRandomizedBlocks(world, box, 4, 2, 5, 5, 2, 7, rand, conBrick); + fillWithRandomizedBlocks(world, box, 5, 2, 4, 7, 2, 4, rand, conBrick); + fillWithRandomizedBlocks(world, box, 5, 2, 8, 7, 2, 8, rand, conBrick); + fillWithRandomizedBlocks(world, box, 7, 2, 5, 8, 2, 7, rand, conBrick); + fillWithRandomizedBlocksMeta(world, box, 5, 2, 3, 7, 2, 3, rand, conBrickStairs, stairMetaN | 4); + fillWithRandomizedBlocks(world, box, 5, 3, 3, 7, 4, 3, rand, conBrick); + fillWithRandomizedBlocks(world, box, 4, 2, 4, 4, 4, 4, rand, conBrick); + fillWithRandomizedBlocksMeta(world, box, 3, 2, 5, 3, 2, 7, rand, conBrickStairs, stairMetaW | 4); + fillWithRandomizedBlocks(world, box, 3, 3, 5, 3, 4, 7, rand, conBrick); + fillWithRandomizedBlocks(world, box, 4, 2, 8, 4, 4, 8, rand, conBrick); + fillWithRandomizedBlocksMeta(world, box, 5, 2, 9, 7, 2, 9, rand, conBrickStairs, stairMetaS | 4); + fillWithRandomizedBlocks(world, box, 5, 3, 9, 7, 4, 9, rand, conBrick); + fillWithRandomizedBlocks(world, box, 8, 2, 8, 8, 4, 8, rand, conBrick); + fillWithRandomizedBlocksMeta(world, box, 9, 2, 5, 9, 2, 7, rand, conBrickStairs, stairMetaE | 4); + fillWithRandomizedBlocks(world, box, 9, 3, 5, 9, 4, 7, rand, conBrick); + fillWithRandomizedBlocks(world, box, 8, 2, 4, 8, 4, 4, rand, conBrick); + //Reactor Core + for(int i = 4; i <= 8; i += 1) { + for(int j = 4; j <= 8; j += 1) { + if((i == 4 || i == 8) && (j == 4 || j == 8)) continue; + + int check = i % 2 == 0 ? 0 : 1; + if(j % 2 == check) + placeBlockAtCurrentPosition(world, ModBlocks.reactor_control, 0, i, 3, j, box); + else { + Block choice = i < 5 || i > 7 || j < 5 || j > 7 ? ModBlocks.reactor_element : ModBlocks.machine_generator; + placeBlockAtCurrentPosition(world, choice, 0, i, 3, j, box); + } + } + } + + if(destroyed) { + randomlyFillWithBlocks(world, box, rand, 0.20F, 4, 4, 4, 8, 4, 8, Blocks.gravel); + fillWithRandomizedBlocks(world, box, 5, 1, 4, 7, 3, 8, rand, coriumSelector); + fillWithRandomizedBlocks(world, box, 4, 1, 5, 4, 3, 7, rand, coriumSelector); + fillWithRandomizedBlocks(world, box, 8, 1, 5, 8, 3, 7, rand, coriumSelector); + } else { + //Reactor Shield/Top + fillWithBlocks(world, box, 5, 4, 4, 7, 4, 8, ModBlocks.glass_lead); + fillWithBlocks(world, box, 4, 4, 5, 4, 4, 7, ModBlocks.glass_lead); + fillWithBlocks(world, box, 8, 4, 5, 8, 4, 7, ModBlocks.glass_lead); + fillWithBlocks(world, box, 5, 5, 4, 7, 5, 8, ModBlocks.steel_roof); + fillWithBlocks(world, box, 4, 5, 5, 4, 5, 7, ModBlocks.steel_roof); + fillWithBlocks(world, box, 8, 5, 5, 8, 5, 7, ModBlocks.steel_roof); + } + + //Scaffolding + //Grates + for(int i = 4; i <= 9; i++) { //Steps + int meta = i % 2 == 0 ? 3 : 7; + placeBlockAtCurrentPosition(world, ModBlocks.steel_grate, meta, 1, i / 2, i, box); + } + fillWithMetadataBlocks(world, box, 2, 4, 8, 3, 4, 9, ModBlocks.steel_grate, 7); + placeBlockAtCurrentPosition(world, ModBlocks.steel_grate, 7, 4, 4, 9, box); + fillWithMetadataBlocks(world, box, 3, 4, 1, 9, 4, 2, ModBlocks.steel_grate, 7); + fillWithMetadataBlocks(world, box, 3, 4, 3, 4, 4, 3, ModBlocks.steel_grate, 7); + placeBlockAtCurrentPosition(world, ModBlocks.steel_grate, 7, 3, 4, 4, box); + fillWithMetadataBlocks(world, box, 8, 4, 3, 9, 4, 3, ModBlocks.steel_grate, 7); + placeBlockAtCurrentPosition(world, ModBlocks.steel_grate, 7, 9, 4, 4, box); + //Barriers + fillWithMetadataBlocks(world, box, 3, 5, 1, 3, 5, 7, ModBlocks.steel_wall, decoMetaW); + placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaN, 2, 5, 8, box); + fillWithMetadataBlocks(world, box, 1, 5, 9, 7, 5, 9, ModBlocks.steel_wall, decoMetaS); + placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaW, 8, 5, 9, box); + fillWithMetadataBlocks(world, box, 9, 5, 1, 9, 5, 7, ModBlocks.steel_wall, decoMetaE); + placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaN, 9, 5, 8, box); + //Decoration + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, stairMetaE | 4, 4, 5, 1, box); + fillWithMetadataBlocks(world, box, 5, 5, 1, 7, 5, 1, ModBlocks.brick_slab, 9); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, stairMetaW | 4, 8, 5, 1, box); + fillWithMetadataBlocks(world, box, 4, 6, 1, 5, 6, 1, ModBlocks.tape_recorder, decoMetaN); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(1), 7, 6, 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.geiger, decoMetaS, 6, 6, 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.machine_storage_drum, 0, 4, 5, 3, box); + placeRandomBobble(world, box, rand, 4, 6, 3); + placeBlockAtCurrentPosition(world, ModBlocks.machine_storage_drum, 0, 1, 2, 11, box); + placeBlockAtCurrentPosition(world, ModBlocks.machine_storage_drum, 0, 9, 2, 10, box); + placeBlockAtCurrentPosition(world, ModBlocks.machine_storage_drum, 0, 11, 2, 9, box); + placeBlockAtCurrentPosition(world, ModBlocks.machine_storage_drum, 0, 11, 2, 11, box); + //Turbines/Transformers + placeBlockAtCurrentPosition(world, ModBlocks.machine_turbine, 0, 14, 2, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_pipe_quad_rusted, getPillarMeta(8), 14, 2, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.machine_turbine, 0, 14, 4, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_pipe_quad_rusted, getPillarMeta(8), 14, 4, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_pipe_rim_rusted, 0, 14, 3, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.red_connector, decoMetaE, 13, 2, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.red_connector, decoMetaE, 13, 4, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.red_connector, decoMetaN, 13, 3, 4, box); + makeConnection(world, 13, 2, 6, 13, 3, 4); + makeConnection(world, 13, 4, 6, 13, 3, 4); + fillWithMetadataBlocks(world, box, 13, 2, 3, 13, 3, 3, ModBlocks.machine_battery, decoMetaN); + fillWithMetadataBlocks(world, box, 14, 2, 3, 14, 3, 3, ModBlocks.cable_diode, decoMetaN); + + generateInvContents(world, box, rand, ModBlocks.crate_iron, 8, 5, 3, HbmChestContents.nuclear, 10); + generateInvContents(world, box, rand, ModBlocks.crate_iron, 10, 2, 1, HbmChestContents.nuclearFuel, 12); + + if(underwater) { + fillWithWater(world, box, rand, 5, 2, 0, 7, 4, 0, 1); + fillWithWater(world, box, rand, 1, 1, 1, 11, 7, 11, 2); + fillWithWater(world, box, rand, 12, 2, 3, 14, 4, 7, 1); + } else { + fillWithCobwebs(world, box, rand, 1, 1, 0, 11, 7, 11); + fillWithCobwebs(world, box, rand, 12, 2, 3, 14, 4, 7); + } + + return true; + } + } + + protected void makeConnection(World world, int x1, int y1, int z1, int x2, int y2, int z2) { + int posX1 = getXWithOffset(x1, z1); + int posY1 = getYWithOffset(y1); + int posZ1 = getZWithOffset(x1, z1); + + int posX2 = getXWithOffset(x2, z2); + int posY2 = getYWithOffset(y2); + int posZ2 = getZWithOffset(x2, z2); + + TileEntity tile1 = world.getTileEntity(posX1, posY1, posZ1); + TileEntity tile2 = world.getTileEntity(posX2, posY2, posZ2); + if(tile1 instanceof TileEntityPylonBase && tile2 instanceof TileEntityPylonBase) { + TileEntityPylonBase pylon1 = (TileEntityPylonBase)tile1; + pylon1.addConnection(posX2, posY2, posZ2); + TileEntityPylonBase pylon2 = (TileEntityPylonBase)tile2; + pylon2.addConnection(posX1, posY1, posZ1); + } + } + + /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ + public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { + StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -5, -2, 0, 16, 10, 13, mode); + return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new Reactor(type, rand, box, mode) : null; + } + } + public static class Atrium extends ControlComponent { public boolean underwater = false; diff --git a/src/main/java/com/hbm/world/worldgen/components/Component.java b/src/main/java/com/hbm/world/worldgen/components/Component.java index a35d30662..9132abbf4 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Component.java +++ b/src/main/java/com/hbm/world/worldgen/components/Component.java @@ -696,6 +696,30 @@ abstract public class Component extends StructureComponent { } } + //stairs and shit + protected void fillWithRandomizedBlocksMeta(World world, StructureBoundingBox box, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Random rand, BlockSelector selector, int meta) { + + if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) + return; + + for(int x = minX; x <= maxX; x++) { + + for(int z = minZ; z <= maxZ; z++) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + + if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { + for(int y = minY; y <= maxY; y++) { + int posY = getYWithOffset(y); + //keep this functionality in mind! + selector.selectBlocks(rand, posX, posY, posZ, false); //for most structures it's redundant since nothing is just hollow cubes, but vanilla structures rely on this. use the method above in that case. + world.setBlock(posX, posY, posZ, selector.func_151561_a(), meta, 2); + } + } + } + } + } + @Override protected void randomlyFillWithBlocks(World world, StructureBoundingBox box, Random rand, float randLimit, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block, Block replaceBlock, boolean onlyReplace) { @@ -755,7 +779,7 @@ abstract public class Component extends StructureComponent { /** Selects blocks */ @Override - public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean p_75062_5_) { + public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { float chance = rand.nextFloat(); if(chance > 0.6F) { @@ -774,7 +798,7 @@ abstract public class Component extends StructureComponent { /** Selects blocks */ @Override - public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean p_75062_5_) { + public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { float chance = rand.nextFloat(); if(chance < 0.4F) { @@ -789,6 +813,27 @@ abstract public class Component extends StructureComponent { } } + static class ConcreteBricksStairs extends StructureComponent.BlockSelector { + + ConcreteBricksStairs() { } + + /** Selects blocks */ + @Override + public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { + float chance = rand.nextFloat(); + + if(chance < 0.4F) { + this.field_151562_a = ModBlocks.brick_concrete_stairs; + } else if (chance < 0.7F) { + this.field_151562_a = ModBlocks.brick_concrete_mossy_stairs; + } else if (chance < 0.9F) { + this.field_151562_a = ModBlocks.brick_concrete_cracked_stairs; + } else { + this.field_151562_a = ModBlocks.brick_concrete_broken_stairs; + } + } + } + //ag static class LabTiles extends StructureComponent.BlockSelector { @@ -796,7 +841,7 @@ abstract public class Component extends StructureComponent { /** Selects blocks */ @Override - public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean p_75062_5_) { + public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { float chance = rand.nextFloat(); if(chance < 0.5F) { @@ -817,7 +862,7 @@ abstract public class Component extends StructureComponent { /** Selects blocks */ @Override - public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean p_75062_5_) { + public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { this.selectedBlockMetaData = rand.nextInt(6) + 10; } } From 3dbb3c6fa676f1ace9646bffa19b80529fb67d66 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sat, 29 Oct 2022 15:00:53 -0700 Subject: [PATCH 24/30] RTG test room, fillSpace for structureComponents --- .../worldgen/components/BunkerComponents.java | 130 ++++++++++++++++++ .../world/worldgen/components/Component.java | 103 +++++++++++++- 2 files changed, 232 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index fc9c7a1f2..c78fe9946 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -5,6 +5,7 @@ import java.util.Iterator; import java.util.List; import java.util.Random; +import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.lib.HbmChestContents; import com.hbm.tileentity.network.TileEntityPylonBase; @@ -54,6 +55,11 @@ public class BunkerComponents extends ProceduralComponents { return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 4; //prevent the gimping of necessary corridors } }, + new Weight(20, 1, RTG::findValidPlacement) { + public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { + return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors + } + }, }; sizeLimit = 100; @@ -965,6 +971,10 @@ public class BunkerComponents extends ProceduralComponents { if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; } else { + fillWithAir(world, box, 5, 2, 0, 7, 4, 0); + fillWithAir(world, box, 3, 1, 3, 9, 1, 9); + fillWithAir(world, box, 1, 2, 1, 11, 7, 11); + fillWithAir(world, box, 12, 2, 3, 14, 4, 7); //Floor fillWithBlocks(world, box, 3, 0, 3, 9, 0, 9, ModBlocks.reinforced_brick); fillWithMetadataBlocks(world, box, 5, 1, 0, 7, 1, 0, ModBlocks.vinyl_tile, 1); @@ -1172,6 +1182,126 @@ public class BunkerComponents extends ProceduralComponents { } } + public static class RTG extends Bunker { + + public RTG() { } + + public RTG(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType); + this.coordBaseMode = coordBaseMode; + this.boundingBox = box; + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + + if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + return false; + } else { + fillWithAir(world, box, 4, 1, 0, 6, 3, 0); + fillWithAir(world, box, 1, 1, 1, 9, 3, 9); + + //Floor + fillWithMetadataBlocks(world, box, 4, 0, 0, 6, 0, 0, ModBlocks.vinyl_tile, 1); + fillWithMetadataBlocks(world, box, 1, 0, 1, 9, 0, 1, ModBlocks.vinyl_tile, 1); + fillWithMetadataBlocks(world, box, 1, 0, 2, 1, 0, 8, ModBlocks.vinyl_tile, 1); + fillWithMetadataBlocks(world, box, 1, 0, 9, 9, 0, 9, ModBlocks.vinyl_tile, 1); + fillWithMetadataBlocks(world, box, 9, 0, 2, 9, 0, 8, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 2, 0, 2, 8, 0, 8, ModBlocks.vinyl_tile); + //Walls + fillWithBlocks(world, box, 1, 1, 0, 3, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 0, 3, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 0, 3, 3, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 1, 1, 0, 1, 9, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 1, 0, 2, 9, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 1, 0, 3, 9, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 1, 10, 9, 1, 10, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 10, 9, 2, 10, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 10, 9, 3, 10, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 10, 1, 6, 10, 1, 9, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.red_wire_coated, 0, 10, 1, 5, box); + fillWithBlocks(world, box, 10, 1, 1, 10, 1, 4, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 10, 2, 1, 10, 2, 9, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 10, 3, 1, 10, 3, 9, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 7, 1, 0, 9, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 7, 2, 0, 9, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 7, 3, 0, 9, 3, 0, ModBlocks.reinforced_brick); + //Ceiling + int pillarMetaWE = getPillarMeta(4); + fillWithBlocks(world, box, 4, 4, 0, 6, 4, 0, ModBlocks.reinforced_brick); + for(int i = 1; i <= 9; i += 3) { + fillWithBlocks(world, box, 2, 4, i, 8, 4, i, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 4, i, 1, 4, i + 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 2, 4, i + 2, 8, 4, i + 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 9, 4, i, 9, 4, i + 2, ModBlocks.reinforced_brick); + placeLamp(world, box, rand, 2, 4, i + 1); + fillWithMetadataBlocks(world, box, 3, 4, i + 1, 4, 4, i + 1, ModBlocks.concrete_pillar, pillarMetaWE); + placeLamp(world, box, rand, 5, 4, i + 1); + fillWithMetadataBlocks(world, box, 6, 4, i + 1, 7, 4, i + 1, ModBlocks.concrete_pillar, pillarMetaWE); + placeLamp(world, box, rand, 8, 4, i + 1); + } + + //Decoration + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(7), 1, 1, 3, box); //Desk + fillWithMetadataBlocks(world, box, 1, 1, 4, 1, 1, 6, ModBlocks.brick_slab, 9); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(6), 1, 1, 7, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(0), 2, 1, 4, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoMeta(3), 1, 2, 4, box); + + fillWithBlocks(world, box, 1, 1, 9, 2, 1, 9, ModBlocks.crate_lead); + placeBlockAtCurrentPosition(world, ModBlocks.barrel_corroded, 0, 1, 2, 9, box); + fillWithMetadataBlocks(world, box, 4, 1, 9, 4, 2, 9, ModBlocks.tape_recorder, getDecoMeta(2)); + placeBlockAtCurrentPosition(world, ModBlocks.barrel_corroded, 0, 7, 1, 9, box); + placeBlockAtCurrentPosition(world, ModBlocks.barrel_corroded, 0, 9, 1, 8, box); + + //The boy + placeBlockAtCurrentPosition(world, ModBlocks.machine_radiolysis, getDirection(ForgeDirection.EAST).ordinal() + BlockDummyable.offset, 5, 1, 5, box); + fillSpace(world, box, 5, 1, 5, new int[] {2, 0, 1, 1, 1, 1}, ModBlocks.machine_radiolysis, ForgeDirection.EAST); + makeExtra(world, box, ModBlocks.machine_radiolysis, 5 + 1, 1, 5); + makeExtra(world, box, ModBlocks.machine_radiolysis, 5 - 1, 1, 5); + makeExtra(world, box, ModBlocks.machine_radiolysis, 5, 1, 5 + 1); + makeExtra(world, box, ModBlocks.machine_radiolysis, 5, 1, 5 - 1); + + int decoMetaS = getDecoMeta(2); + int decoMetaN = getDecoMeta(3); + int decoMetaE = getDecoMeta(4); + int decoMetaW = getDecoMeta(5); + fillWithMetadataBlocks(world, box, 4, 1, 3, 6, 3, 3, ModBlocks.steel_wall, decoMetaS); + fillWithMetadataBlocks(world, box, 3, 1, 4, 3, 3, 6, ModBlocks.steel_wall, decoMetaE); + fillWithMetadataBlocks(world, box, 4, 1, 7, 6, 3, 7, ModBlocks.steel_wall, decoMetaN); + fillWithMetadataBlocks(world, box, 7, 1, 4, 7, 3, 4, ModBlocks.steel_wall, decoMetaW); + placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaW, 7, 3, 5, box); + fillWithMetadataBlocks(world, box, 7, 1, 6, 7, 3, 6, ModBlocks.steel_wall, decoMetaW); + + //Cable + placeBlockAtCurrentPosition(world, ModBlocks.red_cable, 0, 7, 1, 5, box); + placeBlockAtCurrentPosition(world, ModBlocks.red_wire_coated, 0, 8, 1, 5, box); + placeBlockAtCurrentPosition(world, ModBlocks.red_cable, 0, 9, 1, 5, box); + placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaN, 8, 1, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaS, 8, 1, 4, box); + fillWithBlocks(world, box, 7, 2, 5, 9, 2, 5, ModBlocks.steel_roof); + + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(3), 1, 1, 2, HbmChestContents.filingCabinet, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(3), 1, 2, 2, HbmChestContents.filingCabinet, 4); + + if(underwater) { + fillWithWater(world, box, rand, 4, 1, 0, 6, 3, 0, 1); + fillWithWater(world, box, rand, 1, 1, 1, 9, 3, 9, 1); + } else + fillWithCobwebs(world, box, rand, 1, 1, 0, 9, 3, 9); + + return true; + } + } + + + /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ + public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { + StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -4, -1, 0, 11, 6, 11, mode); + return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new RTG(type, rand, box, mode) : null; + } + } + public static class Atrium extends ControlComponent { public boolean underwater = false; diff --git a/src/main/java/com/hbm/world/worldgen/components/Component.java b/src/main/java/com/hbm/world/worldgen/components/Component.java index 9132abbf4..bfa5369ec 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Component.java +++ b/src/main/java/com/hbm/world/worldgen/components/Component.java @@ -2,10 +2,12 @@ package com.hbm.world.worldgen.components; import java.util.Random; +import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockBobble.BobbleType; import com.hbm.blocks.generic.BlockBobble.TileEntityBobble; import com.hbm.config.StructureConfig; +import com.hbm.handler.MultiblockHandlerXR; import com.hbm.lib.HbmChestContents; import com.hbm.tileentity.machine.TileEntityLockableBase; import com.hbm.tileentity.machine.storage.TileEntityCrateIron; @@ -520,7 +522,7 @@ abstract public class Component extends StructureComponent { case 3: return this.boundingBox.maxZ - x; default: - return x; + return z; } } @@ -771,6 +773,105 @@ abstract public class Component extends StructureComponent { } } + protected ForgeDirection getDirection(ForgeDirection dir) { + switch(coordBaseMode) { + default: //South + return dir; + case 1: //West + return dir.getRotation(ForgeDirection.UP); + case 2: //North + return dir.getOpposite(); + case 3: //East + return dir.getRotation(ForgeDirection.DOWN); + } + } + + //always set the core block first + /** StructureComponent-friendly method for {@link com.hbm.handler.MultiblockHandlerXR#fillSpace(World, int, int, int, int[], Block, ForgeDirection)}. Prevents runoff outside of the provided bounding box. */ + protected void fillSpace(World world, StructureBoundingBox box, int x, int y, int z, int[] dim, Block block, ForgeDirection dir) { + + if(getYWithOffset(y - dim[1]) < box.minY || getYWithOffset(y + dim[0]) > box.maxY) //the BlockDummyable will be fucked regardless if it goes beyond either limit + return; + + if(dir == null) + dir = ForgeDirection.SOUTH; + + dir = getDirection(dir); + + int count = 0; + + int[] rot = MultiblockHandlerXR.rotate(dim, dir); + + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); //MY SILLY ASS OPERATING WITH ALREADY FUCKING MODIFIED VARIABLES CLOWNKOEN + int posY = getYWithOffset(y); + + BlockDummyable.safeRem = true; + + for(int a = posX - rot[4]; a <= posX + rot[5]; a++) { + for(int c = posZ - rot[2]; c <= posZ + rot[3]; c++) { + + if(a >= box.minX && a <= box.maxX && c >= box.minZ && c <= box.maxZ) { + for(int b = posY - rot[1]; b <= posY + rot[0]; b++) { + + int meta = 0; + + if(b < posY) { + meta = ForgeDirection.DOWN.ordinal(); + } else if(b > posY) { + meta = ForgeDirection.UP.ordinal(); + } else if(a < posX) { + meta = ForgeDirection.WEST.ordinal(); + } else if(a > posX) { + meta = ForgeDirection.EAST.ordinal(); + } else if(c < posZ) { + meta = ForgeDirection.NORTH.ordinal(); + } else if(c > posZ) { + meta = ForgeDirection.SOUTH.ordinal(); + } else { + continue; + } + + world.setBlock(a, b, c, block, meta, 2); + + count++; + + if(count > 2000) { + System.out.println("component's fillspace: ded " + a + " " + b + " " + c + " " + x + " " + y + " " + z); + + BlockDummyable.safeRem = false; + return; + } + } + } + } + } + + BlockDummyable.safeRem = false; + } + + /** StructureComponent-friendly method for {@link com.hbm.blocks.BlockDummyable#makeExtra(World, int, int, int)}. Prevents runoff outside of the provided bounding box. */ + public void makeExtra(World world, StructureBoundingBox box, Block block, int x, int y, int z) { + int posX = getXWithOffset(x, z); + int posZ = getZWithOffset(x, z); + int posY = getYWithOffset(y); + + if(!box.isVecInside(posX, posY, posZ)) + return; + + if(world.getBlock(posX, posY, posZ) != block) + return; + + int meta = world.getBlockMetadata(posX, posY, posZ); + + if(meta > 5) + return; + + BlockDummyable.safeRem = true; + world.setBlock(posX, posY, posZ, block, meta + BlockDummyable.extra, 3); + BlockDummyable.safeRem = false; + } + /** Block Selectors **/ static class Sandstone extends StructureComponent.BlockSelector { From e8ef0c1a870759104fdf60e558e741cebb1c2444 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sat, 29 Oct 2022 19:54:56 -0700 Subject: [PATCH 25/30] Steel Filing Cabinet --- src/main/java/com/hbm/blocks/ModBlocks.java | 4 ++-- .../blocks/generic/BlockDecoContainer.java | 19 +++++++++++++++++ .../java/com/hbm/main/CraftingManager.java | 2 ++ .../java/com/hbm/main/ResourceManager.java | 1 + .../render/tileentity/RenderFileCabinet.java | 20 +++++++++++++++--- .../worldgen/components/BunkerComponents.java | 14 ++++++------ .../textures/models/file_cabinet_steel.png | Bin 0 -> 3688 bytes 7 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 src/main/resources/assets/hbm/textures/models/file_cabinet_steel.png diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index a09757d2d..d32485948 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -1682,7 +1682,7 @@ public class ModBlocks { deco_computer = new BlockDecoModel(Material.iron, 1).setBlockBoundsTo(.160749F, 0F, 0F, .839251F, .867849F, .622184F).setBlockName("deco_computer").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_computer"); - filing_cabinet = new BlockDecoContainer(Material.iron, 1, TileEntityFileCabinet.class).setBlockBoundsTo(.1875F, 0F, 0F, .8125F, 1F, .75F).setBlockName("filing_cabinet").setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":block_steel"); + filing_cabinet = new BlockDecoContainer(Material.iron, 2, TileEntityFileCabinet.class).setBlockBoundsTo(.1875F, 0F, 0F, .8125F, 1F, .75F).setBlockName("filing_cabinet").setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":block_steel"); tape_recorder = new DecoTapeRecorder(Material.iron).setBlockName("tape_recorder").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder"); steel_poles = new DecoSteelPoles(Material.iron).setBlockName("steel_poles").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam"); @@ -2799,7 +2799,7 @@ public class ModBlocks { GameRegistry.registerBlock(brick_dungeon_circle, brick_dungeon_circle.getUnlocalizedName()); GameRegistry.registerBlock(brick_forgotten, brick_forgotten.getUnlocalizedName()); GameRegistry.registerBlock(deco_computer, deco_computer.getUnlocalizedName()); - GameRegistry.registerBlock(filing_cabinet, filing_cabinet.getUnlocalizedName()); + GameRegistry.registerBlock(filing_cabinet, ItemBlockMeta.class, filing_cabinet.getUnlocalizedName()); GameRegistry.registerBlock(tape_recorder, tape_recorder.getUnlocalizedName()); GameRegistry.registerBlock(steel_poles, steel_poles.getUnlocalizedName()); GameRegistry.registerBlock(pole_top, pole_top.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java b/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java index d2dafd4ea..4655116d1 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java +++ b/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java @@ -1,19 +1,26 @@ package com.hbm.blocks.generic; +import java.util.List; import java.util.Random; import com.hbm.main.MainRegistry; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; import net.minecraft.world.World; public class BlockDecoContainer extends BlockDecoModel implements ITileEntityProvider { @@ -56,6 +63,18 @@ public class BlockDecoContainer extends BlockDecoModel implements ITileEntityPro } } + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + super.registerBlockIcons(iconRegister); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + return this.blockIcon; + } + @Override public int getRenderType() { return -1; diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index b7f36e23c..30977623a 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -975,6 +975,8 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.brick_fire), new Object[] { "BB", "BB", 'B', ModItems.ingot_firebrick }); addShapelessAuto(new ItemStack(ModItems.ingot_firebrick, 4), new Object[] { ModBlocks.brick_fire }); + addRecipeAuto(new ItemStack(ModBlocks.filing_cabinet, 1, 4), new Object[] { " P ", "PIP", " P ", 'P', STEEL.plate(), 'I', ModItems.plate_polymer }); + addShapelessAuto(new ItemStack(ModItems.upgrade_5g), new Object[] { ModItems.upgrade_template, ModItems.gem_alexandrite }); if(GeneralConfig.enableLBSM && GeneralConfig.enableLBSMSimpleCrafting) { diff --git a/src/main/java/com/hbm/main/ResourceManager.java b/src/main/java/com/hbm/main/ResourceManager.java index 557493c5d..2a1a98412 100644 --- a/src/main/java/com/hbm/main/ResourceManager.java +++ b/src/main/java/com/hbm/main/ResourceManager.java @@ -660,6 +660,7 @@ public class ResourceManager { //DecoContainer public static final ResourceLocation file_cabinet_tex = new ResourceLocation(RefStrings.MODID, "textures/models/file_cabinet.png"); + public static final ResourceLocation file_cabinet_steel_tex = new ResourceLocation(RefStrings.MODID, "textures/models/file_cabinet_steel.png"); ////Obj Items diff --git a/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java b/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java index 156562a15..bbe0119b6 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java +++ b/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java @@ -9,6 +9,7 @@ import com.hbm.tileentity.machine.storage.TileEntityFileCabinet; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.client.IItemRenderer; @@ -37,9 +38,15 @@ public class RenderFileCabinet extends TileEntitySpecialRenderer implements IIte break; } + switch(tile.getBlockMetadata() >> 2) { + case 0: + bindTexture(ResourceManager.file_cabinet_tex); break; + case 1: + bindTexture(ResourceManager.file_cabinet_steel_tex); //sadge + } + TileEntityFileCabinet cabinet = (TileEntityFileCabinet) tile; - bindTexture(ResourceManager.file_cabinet_tex); ResourceManager.file_cabinet.renderPart("Cabinet"); GL11.glPushMatrix(); @@ -70,10 +77,17 @@ public class RenderFileCabinet extends TileEntitySpecialRenderer implements IIte GL11.glRotatef(180F, 0, 1F, 0); GL11.glScalef(4F, 4F, 4F); } - public void renderCommon() { + public void renderCommonWithStack(ItemStack stack) { GL11.glTranslated(0, -1.25D, 0); GL11.glScaled(2.75D, 2.75D, 2.75D); - bindTexture(ResourceManager.file_cabinet_tex); + + switch(stack.getItemDamage() >> 2) { + case 0: + bindTexture(ResourceManager.file_cabinet_tex); break; + case 1: + bindTexture(ResourceManager.file_cabinet_steel_tex); + } + ResourceManager.file_cabinet.renderAll(); }}; } diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index c78fe9946..59f491ebe 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -253,7 +253,7 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, ModBlocks.deco_red_copper, 0, 3, 1, 3, box); placeBlockAtCurrentPosition(world, ModBlocks.deco_red_copper, 0, 4, 2, 2, box); - int cabinetMeta = getDecoModelMeta(0); + int cabinetMeta = getDecoModelMeta(0) | 4; if(hasLoot) generateInvContents(world, box, rand, ModBlocks.filing_cabinet, cabinetMeta, 1, 1, 2, HbmChestContents.machineParts, 4); } else { @@ -261,7 +261,7 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, ModBlocks.machine_boiler_off, decoMetaN, 3, 1, 2, box); fillWithBlocks(world, box, 3, 2, 2, 3, 3, 2, ModBlocks.deco_pipe_rusted); - int cabinetMeta = getDecoModelMeta(3); + int cabinetMeta = getDecoModelMeta(3) | 4; if(hasLoot) generateInvContents(world, box, rand, ModBlocks.filing_cabinet, cabinetMeta, 1, 1, 1, HbmChestContents.machineParts, 4); } @@ -628,8 +628,8 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, ModBlocks.radiorec, getDecoMeta(5), 6, 2, 1, box); placeRandomBobble(world, box, rand, 6, 2, 3); placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(2), 6, 2, 4, box); - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 4, 1, 5, HbmChestContents.officeTrash, 4); //TODO: create more contents - placeBlockAtCurrentPosition(world, ModBlocks.filing_cabinet, getDecoModelMeta(0), 4, 1, 5, box); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0) | 4, 4, 1, 5, HbmChestContents.officeTrash, 4); //TODO: create more contents + placeBlockAtCurrentPosition(world, ModBlocks.filing_cabinet, getDecoModelMeta(0) | 4, 4, 1, 5, box); // placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, getStairMeta(7), 1, 1, 2, box); placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, getStairMeta(6), 1, 1, 3, box); @@ -1246,7 +1246,7 @@ public class BunkerComponents extends ProceduralComponents { fillWithMetadataBlocks(world, box, 1, 1, 4, 1, 1, 6, ModBlocks.brick_slab, 9); placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(6), 1, 1, 7, box); placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(0), 2, 1, 4, box); - placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoMeta(3), 1, 2, 4, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(3), 1, 2, 4, box); fillWithBlocks(world, box, 1, 1, 9, 2, 1, 9, ModBlocks.crate_lead); placeBlockAtCurrentPosition(world, ModBlocks.barrel_corroded, 0, 1, 2, 9, box); @@ -1281,8 +1281,8 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaS, 8, 1, 4, box); fillWithBlocks(world, box, 7, 2, 5, 9, 2, 5, ModBlocks.steel_roof); - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(3), 1, 1, 2, HbmChestContents.filingCabinet, 4); - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(3), 1, 2, 2, HbmChestContents.filingCabinet, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(3) | 4, 1, 1, 2, HbmChestContents.filingCabinet, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(3) | 4, 1, 2, 2, HbmChestContents.filingCabinet, 4); if(underwater) { fillWithWater(world, box, rand, 4, 1, 0, 6, 3, 0, 1); diff --git a/src/main/resources/assets/hbm/textures/models/file_cabinet_steel.png b/src/main/resources/assets/hbm/textures/models/file_cabinet_steel.png new file mode 100644 index 0000000000000000000000000000000000000000..87c203558883d19b27e8a94ca250a2562ccad830 GIT binary patch literal 3688 zcmV-u4wvzXP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGizyJUazyWI3i3tDz4gE<(K~#8N?VDL| z6xkKWZ}sAZ-8Ke^2OfAs0v-T?1VTVCd9cj#4KjR^e2+^Ji)?soQ5w|bHgVR3OW6+)6Ep_}>tT|x- zq!?q=R4$i9#Dozqazm@#3XOUr)Eo6s5_6I=!^FG}Owf2S5jv`6F<^2$OiYLYs@EGe zTOS4%5;zQw9XpmDIB>wE^Y-oAuxZmKtAF_L!5ENlkLxd9ya*2;KJ2Z3 zfs~8@lVcLvA~ZuHNsfhzGysB|tyXA@kVc~!$`!_yyJL)B8Yc#bi!fzkV!|{4ZK&1i z8dJ9`3|}>v)Pc#2f|C9c6^LN23Z+sNp_$~}G)0Tr%IXV=X=ryupv(jY@VugHrCiay zm{iexlDPHNzs$6lhxJ&EvPN(Qa5Vz70XQCGOwubtNkl>@(r2TkF$hXkFB`!y0BNSO zbN$DNfUt5&zCnKo-o~kaqALwZUY;PNng?G2v$(1uwDB>l%i^m=P0q)G?{HwF0Ey&@ zhA|ZH(}Vg#C_6%WXEKZSb>>hP*iKvps;x{NJ0BJ#qv2ckAMKDZ( zQ9Or{Mm_U#83ho-q%gqi?#;P6!R`}Q0;6DBMp|3MNotZ5#4{Hp&4xs~>X9LLL4=#Hv38rRvj4TZ->Z z@GBmV1q|dA{s?6*znLtR+H#*iVdS z(>O=!;PdCtJxAD3=CxtN2CJhP_wL>6t$*amk<=Jz|M+9$8B=hCM2Tv3%rZfI35;pV zR4_Ns6U^!H5AUxlS^$&C9mdE37_U5_(QIg6$|A*N*7+GoaGWrRA)G-N5`-`$f)pW$ zer%kKkBwm#A3uKVF@SoU6?(gCgKG=@++ngNV^{}9v4%TP`msi)9j(4&yw3grxdn5K zD-*0LiE7kamJKe|3Nk^@@YtLa;G033w3Eqk@0nnn{khavYG*ui?%%)P2w}6XDKKjD z=FQgr?AbGG-?wj{-7^QNHTAe3``or|+t2EZM>DFL1IFP;(3tvCE!3n5W=RVR3+Z>i z`!2n7=~8;({Dm~m@LW=CnhA%2Yfm0N7s&TvZq@*Czj!Zs#QlnZcBU?7`32mEfe4@n znG?iI>S0x}QbOqgNn7~oB6fDza=bbELV#<_FmQhW;<;JVO#{U9#r=v9?-?+L3=^VZ zhB@JGeqcQ;{g}r!fVsS_2r;98?;{V|^6j=)(M!e% zZA5-(XP<;dV*oLi>?z~?a_+_GJ9!t*xIqjoLO+5WvFXKY#*&WbMl+W&Nn4^XL|e*? zMs#1OzG#3Na26FYAeJDLF%hcmU;>Kwix;Qvi~9z+`aHn<`#cVJma%F18u9pejIY&C zD;-%PlpT(Ue#-(f6A)vv4x|Phdx;<+0Zhu|@nS9sj|egH_W(6_V*Lu3ll~O9?^wz_ zcfvqCcf6mNQH=LB=o9xdsbl;Crl5zSQ<q(;1LtJf29|Fkzc_$d-p)ewb3$Sw@^C4;?J|ckJ_p)kV&ahb>C>lfZ8?)-A;f)F za>&4T(v~W40>gYojwNmfMbe5@+3gPG$Adhxiq?h!@w~CtIOremBd)Im>oqrbHl3ZF z4O82;hPVHH8-DuFzb*S>gJg1KUS22j0-k1i_U6x6n8Q!TP^aC~U)r~B-D-6t!G02g z{S-dDdmkzy46VR1ViouXd&5E!(pomgGhSIaoc#PLOLN%(@E0Pag>>SS8ldJ+pFSNZ zCem^UK?^8ua?FEGpFDZeCZvtj*rQdx?hK7jra7dw4V;-fBL>Wd>6s~Mz&qn62a;o) zzS^;roTK`&D5b6(8b%N{d9$kP{kx_d{ouia)=q%|o{v)?*zhDJ}8WZ zNo8Y|Y8Kna#T?RRKV(caX5+?_Nz9iC+WE&lrHSf_8|uBLdxw zYjI)(o8cY2D&qMl!GQvOIak9(up+{!qo1<_d2e4t99jjh;&40)R!We-msPYsY#DpC zgs7>yR1lV!@GOO-9~#1eBBw6KE4uW;B8X#f5krbVMhZyIFr$?ahsV{Tx4ULb-d5_2 zqsua6vL)SXBS??;g(gQ;q8dh!J92QDaR)9eM;ylbq3AhtGaDK<3~+vJ>^)llhU>AfR=z=B)fa!yLYcGh(_VScJAD18D2~NgJgsR1oPtl&6_tXW@wHRCrsyBpFe*diV~Es0Sw@v6oO!s`=Xd(fP0AN>Y#3SXaEVt_U+rHe#+&w zY0l935XlG2>X^b}JM#&Awj%B?Eq#_Wj1omS9lHajohizgl8F2C9 z#dP=X-Bx!qi-}*!1YW&*mH7ZVGZ?o<2+V$2lK$TMV=6gCDL2Emv?zF0Vq3VnGQ;w6ZJHW~$RPxJ^POq(-?C=5bvhm&G$ z-qcEeW;MD`F$pn^vvodW`#cU*kwtk!WWHD}*Ah6o>FH@JI9aZkGIjhKg*{N{iyz`8 zjlzA;2TUk&nVOjn6MFgiAPc4#)_%_T8j zeVZzrq4VvX^q7N1`|$x#%+`}-_D9HbJETrXf?(8=I;s~RTa5zd$*aDv7Z(KL1vBt^ zPXnrw{Os&Zn4Fjl-~ZwJp(Mj+G}D4ccDU)^`6w`8HRl0e3p9XrSsxQ)?ijQep%(@2 z|NVY)=g!}f%a<=F!x9fH8OBw}RPtCUD_l!pQb^o24uaz{2t5;64eSs_ARCO)@4X<8 zVfqXM)H#j3%!eZoA8_=0z8av$s5{cc;l(E4(V+;8 z9Z4_wX$`hsuaPu$!l6TlEEM_MAX4yq2!{K#Qy=y`U=aAFnjeb9j+Q#5=qv%40K4^7 z;lc$aLYgr9QRA1_VStV8+O^BB&Hy|!lA%r-8vk7W*TQH{u&Y9;I0>g?34r{)0~6`z zm46M4&HzOLiP+RB22RlJ9D-5P_-*l9!AK0i_n89}?fs-3x8)i1tza|_=z4z)0SV&} z;|vh9$ivSEz7>olmUHJ8QqBl#^7On)6XuXQg%Cun1>BQ>5T^n555v|X3XF;o8E`J; ze_E=`*6&9@eExsJ$hw${>|sA*tYaPPSjRfnv5s#DA^Z Date: Sun, 30 Oct 2022 14:31:18 -0700 Subject: [PATCH 26/30] Fixed components, added block selector for slabs --- .../hbm/world/worldgen/MapGenNTMFeatures.java | 4 +- .../worldgen/components/BunkerComponents.java | 44 +++++++++++++------ .../world/worldgen/components/Component.java | 28 +++++++++++- .../components/MilitaryBaseFeatures.java | 1 + 4 files changed, 59 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java b/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java index e23fed89e..f0d666dc8 100644 --- a/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java @@ -155,9 +155,9 @@ public class MapGenNTMFeatures extends MapGenStructure { case 2: LargeOffice office = new LargeOffice(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); this.components.add(office); break; - /*case 3: + case 3: LargeOfficeCorner officeCorner = new LargeOfficeCorner(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); - this.components.add(officeCorner); break;*/ + this.components.add(officeCorner); break; } } diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index 59f491ebe..f72706519 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -453,6 +453,10 @@ public class BunkerComponents extends ProceduralComponents { //what 'waste'? public static class WasteDisposal extends Bunker { + private static ConcreteBricks conBrick = new ConcreteBricks(); + private static ConcreteBricksStairs conBrickStairs = new ConcreteBricksStairs(); + private static ConcreteBricksSlabs conBrickSlabs = new ConcreteBricksSlabs(); + public WasteDisposal() { } public WasteDisposal(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { @@ -521,16 +525,16 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, ModBlocks.brick_fire, 0, 4, 1, 7, box); fillWithBlocks(world, box, 5, 1, 5, 5, 1, 7, ModBlocks.brick_fire); //i genuinely cannot be bothered to go to the effort of block selectors for the stairs n shit - fillWithMetadataBlocks(world, box, 3, 2, 5, 3, 2, 6, ModBlocks.brick_concrete_stairs, getStairMeta(1)); - placeBlockAtCurrentPosition(world, ModBlocks.brick_concrete_stairs, getStairMeta(2), 3, 2, 7, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_brick_slab, 0, 4, 2, 5, box); - placeBlockAtCurrentPosition(world, ModBlocks.brick_concrete_stairs, getStairMeta(2), 4, 2, 7, box); - fillWithMetadataBlocks(world, box, 5, 2, 5, 5, 2, 6, ModBlocks.brick_concrete_stairs, getStairMeta(0)); - placeBlockAtCurrentPosition(world, ModBlocks.brick_concrete_stairs, getStairMeta(2), 5, 2, 7, box); - fillWithBlocks(world, box, 3, 3, 5, 3, 3, 7, ModBlocks.brick_concrete); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_brick_slab, 8, 4, 3, 5, box); - placeBlockAtCurrentPosition(world, ModBlocks.brick_concrete, 0, 4, 3, 7, box); - fillWithBlocks(world, box, 5, 3, 5, 5, 3, 7, ModBlocks.brick_concrete); + fillWithRandomizedBlocksMeta(world, box, 3, 2, 5, 3, 2, 6, rand, conBrickStairs, getStairMeta(1)); + fillWithRandomizedBlocksMeta(world, box, 3, 2, 7, 3, 2, 7, rand, conBrickStairs, getStairMeta(2)); + fillWithRandomizedBlocksMeta(world, box, 4, 2, 5, 4, 2, 5, rand, conBrickSlabs, 0); + fillWithRandomizedBlocksMeta(world, box, 4, 2, 7, 4, 2, 7, rand, conBrickStairs, getStairMeta(2)); + fillWithRandomizedBlocksMeta(world, box, 5, 2, 5, 5, 2, 6, rand, conBrickStairs, getStairMeta(0)); + fillWithRandomizedBlocksMeta(world, box, 5, 2, 7, 5, 2, 7, rand, conBrickStairs, getStairMeta(2)); + fillWithRandomizedBlocks(world, box, 3, 3, 5, 3, 3, 7, rand, conBrick); + fillWithRandomizedBlocksMeta(world, box, 4, 3, 5, 4, 3, 5, rand, conBrickSlabs, 8); + fillWithRandomizedBlocks(world, box, 4, 3, 7, 4, 3, 7, rand, conBrick); + fillWithRandomizedBlocks(world, box, 5, 3, 5, 5, 3, 7, rand, conBrick); fillWithMetadataBlocks(world, box, 1, 3, 6, 2, 3, 6, ModBlocks.deco_pipe_quad_rusted, pillarMetaWE); fillWithMetadataBlocks(world, box, 6, 3, 6, 7, 3, 6, ModBlocks.deco_pipe_quad_rusted, pillarMetaWE); placeDoor(world, box, ModBlocks.door_bunker, 1, 4, 1, 0); @@ -854,14 +858,24 @@ public class BunkerComponents extends ProceduralComponents { //Right Planter fillWithBlocks(world, box, 1, 1, 1, 4, 1, 1, Blocks.grass); - fillWithMetadataBlocks(world, box, 1, 1, 2, 3, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 1, 2, box); fillWithMetadataBlocks(world, box, 5, 1, 1, 5, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaE); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 1, 2, box); + if(!expandsNX) { + fillWithMetadataBlocks(world, box, 2, 1, 2, 3, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); + fillWithMetadataBlocks(world, box, 2, 1, 3, 2, 1, 5, ModBlocks.reinforced_brick_stairs, stairMetaE); + fillWithBlocks(world, box, 1, 1, 2, 1, 1, 5, Blocks.grass); + } else + fillWithMetadataBlocks(world, box, 1, 1, 2, 3, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); //Left Planter fillWithBlocks(world, box, 10, 1, 1, 13, 1, 1, Blocks.grass); - fillWithMetadataBlocks(world, box, 11, 1, 2, 13, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 10, 1, 2, box); fillWithMetadataBlocks(world, box, 9, 1, 1, 9, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaW); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 10, 1, 2, box); + if(!expandsPX) { + fillWithMetadataBlocks(world, box, 11, 1, 2, 12, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); + fillWithMetadataBlocks(world, box, 12, 1, 3, 12, 1, 5, ModBlocks.reinforced_brick_stairs, stairMetaW); + fillWithBlocks(world, box, 13, 1, 2, 13, 1, 5, Blocks.grass); + } else + fillWithMetadataBlocks(world, box, 11, 1, 2, 13, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); //Main planter with conversation pits fillWithBlocks(world, box, 1, 1, 7, 2, 1, 11, Blocks.grass); //Planter fillWithBlocks(world, box, 7, 1, 8, 7, 1, 10, Blocks.grass); @@ -895,6 +909,8 @@ public class BunkerComponents extends ProceduralComponents { fillWithRandomizedBlocks(world, box, 3, 2, 11, 11, 2, 11, rand, plantSelector); fillWithRandomizedBlocks(world, box, 12, 2, 7, 13, 2, 11, rand, plantSelector); fillWithRandomizedBlocks(world, box, 7, 2, 8, 7, 2, 10, rand, plantSelector); + if(!expandsNX) fillWithRandomizedBlocks(world, box, 1, 2, 2, 1, 2, 5, rand, plantSelector); + if(!expandsPX) fillWithRandomizedBlocks(world, box, 13, 2, 2, 13, 2, 5, rand, plantSelector); break; } diff --git a/src/main/java/com/hbm/world/worldgen/components/Component.java b/src/main/java/com/hbm/world/worldgen/components/Component.java index bfa5369ec..858503387 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Component.java +++ b/src/main/java/com/hbm/world/worldgen/components/Component.java @@ -715,7 +715,7 @@ abstract public class Component extends StructureComponent { int posY = getYWithOffset(y); //keep this functionality in mind! selector.selectBlocks(rand, posX, posY, posZ, false); //for most structures it's redundant since nothing is just hollow cubes, but vanilla structures rely on this. use the method above in that case. - world.setBlock(posX, posY, posZ, selector.func_151561_a(), meta, 2); + world.setBlock(posX, posY, posZ, selector.func_151561_a(), meta | selector.getSelectedBlockMetaData(), 2); //Make sure the metadata is initialized in the ctor! } } } @@ -916,7 +916,9 @@ abstract public class Component extends StructureComponent { static class ConcreteBricksStairs extends StructureComponent.BlockSelector { - ConcreteBricksStairs() { } + ConcreteBricksStairs() { + this.selectedBlockMetaData = 0; + } /** Selects blocks */ @Override @@ -935,6 +937,28 @@ abstract public class Component extends StructureComponent { } } + static class ConcreteBricksSlabs extends StructureComponent.BlockSelector { + + ConcreteBricksSlabs() { + this.field_151562_a = ModBlocks.concrete_brick_slab; + this.selectedBlockMetaData = 0; + } + + /** Selects blocks */ + @Override + public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { + float chance = rand.nextFloat(); + + if (chance >= 0.4F && chance < 0.7F) { + this.selectedBlockMetaData |= 1; + } else if (chance < 0.9F) { + this.selectedBlockMetaData |= 2; + } else { + this.selectedBlockMetaData |= 3; + } + } + } + //ag static class LabTiles extends StructureComponent.BlockSelector { diff --git a/src/main/java/com/hbm/world/worldgen/components/MilitaryBaseFeatures.java b/src/main/java/com/hbm/world/worldgen/components/MilitaryBaseFeatures.java index 06acabe2f..d24d2975b 100644 --- a/src/main/java/com/hbm/world/worldgen/components/MilitaryBaseFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/MilitaryBaseFeatures.java @@ -10,6 +10,7 @@ import net.minecraft.world.World; import net.minecraft.world.gen.structure.StructureBoundingBox; //These structures are... kind of? low quality, but they test out new methods so whatev. +//TODO: smite public class MilitaryBaseFeatures { //stop-gap methods until this entire mess can be organized into proper classes/structure groups From 42efc46a9f7433255bbb37373ec16ee7a2587604 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sun, 30 Oct 2022 20:39:04 -0700 Subject: [PATCH 27/30] More bedrooms & loot, removed militarybasefeatures, compartmentalization --- .../blocks/generic/BlockDecoContainer.java | 2 +- .../hbm/blocks/generic/BlockDecoModel.java | 3 + .../hbm/items/tool/ItemStructurePattern.java | 7 +- .../java/com/hbm/lib/HbmChestContents.java | 102 +- src/main/java/com/hbm/lib/HbmWorld.java | 40 +- src/main/java/com/hbm/util/LootGenerator.java | 26 + .../hbm/world/worldgen/MapGenNTMFeatures.java | 6 - .../worldgen/components/BunkerComponents.java | 895 +++++++++++------- .../worldgen/components/CivilianFeatures.java | 9 + .../world/worldgen/components/Component.java | 8 +- .../components/MilitaryBaseFeatures.java | 182 ---- .../worldgen/components/OfficeFeatures.java | 14 +- .../worldgen/components/RuinFeatures.java | 8 + 13 files changed, 702 insertions(+), 600 deletions(-) delete mode 100644 src/main/java/com/hbm/world/worldgen/components/MilitaryBaseFeatures.java diff --git a/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java b/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java index 4655116d1..e9f65a120 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java +++ b/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java @@ -37,7 +37,7 @@ public class BlockDecoContainer extends BlockDecoModel implements ITileEntityPro try { return tile.newInstance(); } catch (Exception e) { - System.out.println("BlockDecoContainer attempted to create a TE, but couldn't. How does that even happen?"); + MainRegistry.logger.error("BlockDecoContainer attempted to create a TE, but couldn't. How does that even happen?"); return null; } } diff --git a/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java b/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java index dbe3af5ed..78320789c 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java +++ b/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java @@ -52,6 +52,9 @@ public class BlockDecoModel extends Block { super.registerBlockIcons(iconRegister); icons = new IIcon[subTypes]; + if(subTypes == 1) + return; + for(byte i = 0; i < subTypes; i++) icons[i] = iconRegister.registerIcon(this.textureName + "_" + i); } diff --git a/src/main/java/com/hbm/items/tool/ItemStructurePattern.java b/src/main/java/com/hbm/items/tool/ItemStructurePattern.java index f65d4c80a..60f7c39f4 100644 --- a/src/main/java/com/hbm/items/tool/ItemStructurePattern.java +++ b/src/main/java/com/hbm/items/tool/ItemStructurePattern.java @@ -6,6 +6,7 @@ import com.hbm.util.fauxpointtwelve.BlockPos; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; @@ -43,10 +44,10 @@ public class ItemStructurePattern extends ItemStructureTool { int maxZ = Math.max(savedZ, z) - pos.getZ(); for(int ix = minX; ix <= maxX; ix++) { - for(int iy = minX; iy <= maxY; iy++) { - for(int iz = minX; iz <= maxZ; iz++) { + for(int iy = minY; iy <= maxY; iy++) { + for(int iz = minZ; iz <= maxZ; iz++) { - Block b = world.getBlock(ix + pos.getX(), iy + pos.getY(), iz + pos.getZ()); + Block b = world.getBlock(ix + pos.getX(), iy + pos.getY(), iz + pos.getZ()); int meta = world.getBlockMetadata(ix + pos.getX(), iy + pos.getY(), iz + pos.getZ()); message.concat("placeBlockAtCurrentPosition(world, " + b.getUnlocalizedName() + ", " + meta + ", " + ix + ", " + iy + ", " + iz + ", box);\n"); diff --git a/src/main/java/com/hbm/lib/HbmChestContents.java b/src/main/java/com/hbm/lib/HbmChestContents.java index aa7df0b1a..80b520b54 100644 --- a/src/main/java/com/hbm/lib/HbmChestContents.java +++ b/src/main/java/com/hbm/lib/HbmChestContents.java @@ -368,49 +368,67 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.ink, 0, 1, 1, 1), //make that mf rare; 1:555 weight }; - /** Nowhere else to put this and this seems like the most fitting place **/ - public static ItemStack genetateBook(String key) { - - String author = resolve("book.lore." + key + ".author"); - String title = resolve("book.lore." + key + ".title"); - - ItemStack book = new ItemStack(Items.written_book); - book.stackTagCompound = new NBTTagCompound(); - book.stackTagCompound.setString("author", author); - book.stackTagCompound.setString("title", title); - NBTTagList nbt = new NBTTagList(); - - for(byte i = 1; i <= 50; i++) { - String unloc = "book.lore." + key + ".page" + i; - String page = resolve(unloc); - - if(page.equals(unloc)) - break; - else - nbt.appendTag(new NBTTagString(page)); - } - - book.stackTagCompound.setTag("pages", nbt); - - return book; - } + public static WeightedRandomChestContent[] bedroom1 = new WeightedRandomChestContent[] { //soda enjoyer who really needs to charge their radio + new WeightedRandomChestContent(ModItems.can_empty, 0, 1, 1, 2), + new WeightedRandomChestContent(ModItems.can_creature, 0, 1, 2, 2), + new WeightedRandomChestContent(ModItems.can_smart, 0, 1, 3, 2), + new WeightedRandomChestContent(ModItems.can_mrsugar, 0, 1, 2, 2), + new WeightedRandomChestContent(ModItems.med_ipecac, 0, 1, 1, 1), + new WeightedRandomChestContent(ModItems.radx, 0, 1, 1, 2), + new WeightedRandomChestContent(ModItems.dust_tiny, 0, 1, 3, 2), + new WeightedRandomChestContent(ModItems.dust, 0, 1, 1, 1), + new WeightedRandomChestContent(Items.paper, 0, 1, 12, 7), + new WeightedRandomChestContent(Items.book, 0, 1, 3, 5), + new WeightedRandomChestContent(ModItems.battery_su, 0, 1, 1, 3), + new WeightedRandomChestContent(ModItems.canteen_13, 0, 1, 1, 1), + }; - private static String resolve(String key) { - String result = books.get(key); - return result != null ? result : key; - } + public static WeightedRandomChestContent[] bedroom2 = new WeightedRandomChestContent[] { //overworking nuka-cola enthusiast + new WeightedRandomChestContent(ModItems.twinkie, 0, 1, 3, 7), + new WeightedRandomChestContent(ModItems.coffee, 0, 1, 1, 5), + new WeightedRandomChestContent(ModItems.bottle_nuka, 0, 1, 1, 3), + new WeightedRandomChestContent(ModItems.bottle_quantum, 0, 1, 1, 4), + new WeightedRandomChestContent(ModItems.bottle_cherry, 0, 1, 1, 3), + new WeightedRandomChestContent(ModItems.bottle_opener, 0, 1, 1, 3), + new WeightedRandomChestContent(ModItems.radaway, 0, 1, 1, 2), + new WeightedRandomChestContent(ModItems.dust_tiny, 0, 1, 3, 2), + new WeightedRandomChestContent(ModItems.dust, 0, 1, 1, 1), + new WeightedRandomChestContent(ModItems.battery_su_l, 0, 1, 1, 1), + new WeightedRandomChestContent(Items.paper, 0, 1, 12, 10), + new WeightedRandomChestContent(Items.book, 0, 1, 3, 5), + new WeightedRandomChestContent(ModItems.canteen_13, 0, 1, 1, 1), + }; - private static HashMap books = new HashMap(); + public static WeightedRandomChestContent[] bedroom3 = new WeightedRandomChestContent[] { //secretly alcoholic journaling fan who drinks straight from the canister + new WeightedRandomChestContent(Items.writable_book, 0, 1, 12, 10), + new WeightedRandomChestContent(Items.feather, 0, 1, 2, 5), + new WeightedRandomChestContent(new ItemStack(ModItems.canister_full, 1, Fluids.ETHANOL.getID()), 1, 2, 10), + new WeightedRandomChestContent(ModItems.scrumpy, 0, 1, 1, 1), + new WeightedRandomChestContent(ModItems.dust_tiny, 0, 1, 3, 3), + new WeightedRandomChestContent(ModItems.dust, 0, 1, 1, 2), + new WeightedRandomChestContent(Items.paper, 0, 1, 12, 10), + new WeightedRandomChestContent(Items.book, 0, 1, 3, 10), + new WeightedRandomChestContent(ModItems.canteen_13, 0, 1, 1, 2), + }; + + public static WeightedRandomChestContent[] bedroom4 = new WeightedRandomChestContent[] { //gun nut with a knack for self-made weapons + new WeightedRandomChestContent(ModItems.armor_polish, 0, 1, 1, 3), + new WeightedRandomChestContent(ModItems.gun_kit_1, 0, 1, 2, 2), + new WeightedRandomChestContent(ModItems.mechanism_revolver_1, 0, 1, 2, 2), + new WeightedRandomChestContent(ModItems.mechanism_revolver_2, 0, 1, 1, 2), + new WeightedRandomChestContent(ModItems.mechanism_rifle_1, 0, 1, 2, 1), + new WeightedRandomChestContent(ModItems.mechanism_rifle_2, 0, 1, 1, 1), + new WeightedRandomChestContent(ModItems.battery_su_l, 0, 1, 1, 1), + new WeightedRandomChestContent(ModItems.bolt_tungsten, 0, 1, 4, 1), + new WeightedRandomChestContent(ModItems.wire_aluminium, 0, 1, 5, 1), + new WeightedRandomChestContent(ModItems.steel_plate, 0, 1, 3, 1), + new WeightedRandomChestContent(ModItems.screwdriver, 0, 1, 1, 2), + new WeightedRandomChestContent(ModItems.wrench, 0, 1, 1, 2), + new WeightedRandomChestContent(ModItems.hand_drill, 0, 1, 1, 2), + new WeightedRandomChestContent(ModItems.clip_revolver_nopip, 0, 1, 1, 2), + new WeightedRandomChestContent(ModItems.ammo_20gauge, 0, 1, 8, 2), + new WeightedRandomChestContent(ModItems.gun_revolver_nopip, 0, 1, 1, 3), + new WeightedRandomChestContent(ModItems.canteen_13, 0, 1, 1, 1), + }; - static { - books.put("book.lore.office0.title", "Letter of Resignation"); - books.put("book.lore.office0.author", "Kosma"); - books.put("book.lore.office0.page1", "Management downsized our department again yesterday. Those idiots only have themselves to blame, I don't know what they were expecting after the Panay fiasco. Who the hell leaks that sort of information? We're losing millions and"); - books.put("book.lore.office0.page2", "it's ME who's the one out of a job now. I'M the one being asked to resign. I hope you asshats finally learn from your overabundance of mistakes and take that stick out of your ass."); - books.put("book.lore.office0.page3", "I'm not coming back on Friday. Just send the paycheck."); - books.put("book.lore.office1.title", "Note"); - books.put("book.lore.office1.author", "Jonas"); - books.put("book.lore.office1.page1", null); - books.put("book.lore.office2.page2", null); - } } diff --git a/src/main/java/com/hbm/lib/HbmWorld.java b/src/main/java/com/hbm/lib/HbmWorld.java index ec01ec220..86f1b6a61 100644 --- a/src/main/java/com/hbm/lib/HbmWorld.java +++ b/src/main/java/com/hbm/lib/HbmWorld.java @@ -2,11 +2,10 @@ package com.hbm.lib; import com.hbm.world.worldgen.MapGenNTMFeatures; import com.hbm.world.worldgen.NTMWorldGenerator; -import com.hbm.world.worldgen.components.BunkerComponents.*; -import com.hbm.world.worldgen.components.CivilianFeatures.*; -import com.hbm.world.worldgen.components.MilitaryBaseFeatures.*; -import com.hbm.world.worldgen.components.OfficeFeatures.*; -import com.hbm.world.worldgen.components.RuinFeatures.*; +import com.hbm.world.worldgen.components.BunkerComponents; +import com.hbm.world.worldgen.components.CivilianFeatures; +import com.hbm.world.worldgen.components.OfficeFeatures; +import com.hbm.world.worldgen.components.RuinFeatures; import cpw.mods.fml.common.IWorldGenerator; import cpw.mods.fml.common.registry.GameRegistry; @@ -36,32 +35,9 @@ public class HbmWorld { /** Register structures in MapGenStructureIO */ public static void registerNTMFeatures() { - MapGenStructureIO.func_143031_a(NTMHouse1.class, "NTMHouse1"); - MapGenStructureIO.func_143031_a(NTMHouse2.class, "NTMHouse2"); - MapGenStructureIO.func_143031_a(NTMLab1.class, "NTMLab1"); - MapGenStructureIO.func_143031_a(NTMLab2.class, "NTMLab2"); - MapGenStructureIO.func_143031_a(NTMWorkshop1.class, "NTMWorkshop1"); - MapGenStructureIO.func_143031_a(NTMRuin1.class, "NTMRuin1"); - MapGenStructureIO.func_143031_a(NTMRuin2.class, "NTMRuin2"); - MapGenStructureIO.func_143031_a(NTMRuin3.class, "NTMRuin3"); - MapGenStructureIO.func_143031_a(NTMRuin4.class, "NTMRuin4"); - //aggggggggggg - MapGenStructureIO.func_143031_a(BasicHelipad.class, "NTMBasicHelipad"); - MapGenStructureIO.func_143031_a(RadioShack.class, "NTMRadioShack"); - MapGenStructureIO.func_143031_a(LargeOffice.class, "NTMLargeOffice"); - MapGenStructureIO.func_143031_a(LargeOfficeCorner.class, "NTMLargeOfficeCorner"); - - //bunker - MapGenStructureIO.func_143031_a(Atrium.class, "NTMBAtrium"); - MapGenStructureIO.func_143031_a(Corridor.class, "NTMBCorridor"); - MapGenStructureIO.func_143031_a(WideCorridor.class, "NTMBWideCorridor"); - MapGenStructureIO.func_143031_a(Intersection.class, "NTMBIntersection"); - MapGenStructureIO.func_143031_a(WideIntersection.class, "NTMBWideIntersection"); - MapGenStructureIO.func_143031_a(UtilityCloset.class, "NTMBUtilityCloset"); - MapGenStructureIO.func_143031_a(SupplyRoom.class, "NTMBSupplyRoom"); - MapGenStructureIO.func_143031_a(WasteDisposal.class, "NTMBWasteDisposal"); - MapGenStructureIO.func_143031_a(Bedroom.class, "NTMBBedroom"); - MapGenStructureIO.func_143031_a(CenterCrossing.class, "NTMBCenterCrossing"); - MapGenStructureIO.func_143031_a(Reactor.class, "NTMBReactor"); + CivilianFeatures.registerComponents(); + OfficeFeatures.registerComponents(); + RuinFeatures.registerComponents(); + BunkerComponents.registerComponents(); } } diff --git a/src/main/java/com/hbm/util/LootGenerator.java b/src/main/java/com/hbm/util/LootGenerator.java index 2c5d0b500..519c4c428 100644 --- a/src/main/java/com/hbm/util/LootGenerator.java +++ b/src/main/java/com/hbm/util/LootGenerator.java @@ -83,6 +83,32 @@ public class LootGenerator { } } + public static void lootMakeshiftGun(World world, int x, int y, int z) { + + TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); + + if(loot != null && loot.items.isEmpty()) { + + if(world.rand.nextInt(2) == 0) + addItemWithDeviation(loot, world.rand, new ItemStack(ModItems.gun_lever_action), 0, 0, 0.125); + + int count = world.rand.nextInt(2) + 1; + for(int i = 0; i < count; i++) { + int type = world.rand.nextInt(2); + Item parts = type < 1 ? ModItems.plate_steel : ModItems.mechanism_rifle_1; + addItemWithDeviation(loot, world.rand, new ItemStack(parts), -0.3125, i * 0.03125, 0.3125); + } + + count = world.rand.nextInt(2) + 2; + for(int i = 0; i < count; i++) + addItemWithDeviation(loot, world.rand, new ItemStack(ModItems.wire_aluminium), 0.3125, i * 0.03125, -0.125); + + int type = world.rand.nextInt(4); + Item tool = type > 2 ? ModItems.wrench : ModItems.screwdriver; + addItemWithDeviation(loot, world.rand, new ItemStack(tool), 0.005, 0, -0.3125); + } + } + public static void lootNukeStorage(World world, int x, int y, int z) { TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); diff --git a/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java b/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java index f0d666dc8..f578cb70c 100644 --- a/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java @@ -9,8 +9,6 @@ import java.util.Random; import com.hbm.config.GeneralConfig; import com.hbm.config.StructureConfig; import com.hbm.world.worldgen.components.CivilianFeatures.*; -import com.hbm.world.worldgen.components.MilitaryBaseFeatures; -import com.hbm.world.worldgen.components.MilitaryBaseFeatures.*; import com.hbm.world.worldgen.components.OfficeFeatures.*; import com.hbm.world.worldgen.components.RuinFeatures.*; @@ -140,10 +138,6 @@ public class MapGenNTMFeatures extends MapGenStructure { } else if(biome.temperature >= 0.25 && biome.temperature <= 0.3 && biome.rainfall >= 0.6 && biome.rainfall <= 0.9 && rand.nextBoolean()) { //Taiga & Mega Taiga NTMWorkshop1 workshop1 = new NTMWorkshop1(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); this.components.add(workshop1); - - } else if(biome.heightVariation <= 0.2 && biome.rainfall <= 0.5 && !(biome instanceof BiomeGenBeach) && rand.nextInt(5) == 0) { //Everything except jungles, extra-hilly areas, and beaches - MilitaryBaseFeatures.smallHelipad(components, chunkX, posY, chunkZ, rand); //agggggggg - } else { //Everything else switch(rand.nextInt(3)) { case 0: diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java index f72706519..744a96d6a 100644 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java @@ -9,6 +9,7 @@ import com.hbm.blocks.BlockDummyable; import com.hbm.blocks.ModBlocks; import com.hbm.lib.HbmChestContents; import com.hbm.tileentity.network.TileEntityPylonBase; +import com.hbm.util.LootGenerator; import com.hbm.world.worldgen.components.ProceduralComponents.ProceduralComponent; import net.minecraft.block.Block; @@ -17,12 +18,29 @@ import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraft.world.gen.structure.StructureBoundingBox; import net.minecraft.world.gen.structure.StructureComponent; import net.minecraftforge.common.util.ForgeDirection; public class BunkerComponents extends ProceduralComponents { + public static void registerComponents() { + MapGenStructureIO.func_143031_a(Atrium.class, "NTMBAtrium"); + MapGenStructureIO.func_143031_a(Corridor.class, "NTMBCorridor"); + MapGenStructureIO.func_143031_a(WideCorridor.class, "NTMBWideCorridor"); + MapGenStructureIO.func_143031_a(Intersection.class, "NTMBIntersection"); + MapGenStructureIO.func_143031_a(WideIntersection.class, "NTMBWideIntersection"); + MapGenStructureIO.func_143031_a(DeadEnd.class, "NTMBDeadEnd"); + MapGenStructureIO.func_143031_a(CenterCrossing.class, "NTMBCenterCrossing"); + MapGenStructureIO.func_143031_a(UtilityCloset.class, "NTMBUtilityCloset"); + MapGenStructureIO.func_143031_a(SupplyRoom.class, "NTMBSupplyRoom"); + MapGenStructureIO.func_143031_a(WasteDisposal.class, "NTMBWasteDisposal"); + MapGenStructureIO.func_143031_a(Bedroom.class, "NTMBBedroom"); + MapGenStructureIO.func_143031_a(Reactor.class, "NTMBReactor"); + MapGenStructureIO.func_143031_a(RTG.class, "NTMBRTG"); + } + public BunkerComponents() { //Pass each respective method as a method reference (::) to the weight constructors, in order to boost clarity @@ -207,9 +225,9 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; - } else { + } else {*/ fillWithAir(world, box, 1, 1, 1, 3, 3, 2); //Floor @@ -272,7 +290,7 @@ public class BunkerComponents extends ProceduralComponents { fillWithCobwebs(world, box, rand, 1, 1, 1, 3, 3, 2); return true; - } + //} } protected void makeConnection(World world, int x1, int y1, int z1, int x2, int y2, int z2) { @@ -334,9 +352,9 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; - } else { + } else {*/ fillWithAir(world, box, 5, 1, 0, 7, 3, 0); fillWithAir(world, box, 1, 1, 1, 11, 3, 11); @@ -441,7 +459,7 @@ public class BunkerComponents extends ProceduralComponents { fillWithCobwebs(world, box, rand, 1, 1, 0, 11, 3, 11); return true; - } + //} } /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ @@ -467,9 +485,11 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; - } else { + } else {*/ + fillWithAir(world, box, 1, 1, 1, 7, 3, 7); + //Floor placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 4, 0, 0, box); fillWithBlocks(world, box, 1, 0, 1, 1, 0, 2, ModBlocks.concrete_brick_slab); @@ -514,7 +534,7 @@ public class BunkerComponents extends ProceduralComponents { generateInvContents(world, box, rand, ModBlocks.crate_iron, 1, 2, 7, HbmChestContents.filingCabinet, 10); fillWithMetadataBlocks(world, box, 7, 1, 1, 7, 1, 2, ModBlocks.steel_grate, 7); placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, getDecoMeta(3), 7, 1, 3, box); - placeRandomBobble(world, box, rand, 7, 2, 1); + if(rand.nextInt(3) == 0) placeRandomBobble(world, box, rand, 7, 2, 1); //Cremator int pillarMetaWE = getPillarMeta(4); @@ -546,7 +566,7 @@ public class BunkerComponents extends ProceduralComponents { } return true; - } + //} } /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ @@ -558,20 +578,35 @@ public class BunkerComponents extends ProceduralComponents { public static class Bedroom extends Bunker { + int decorationType = 0; + public Bedroom() { } public Bedroom(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { super(componentType); this.coordBaseMode = coordBaseMode; this.boundingBox = box; + this.decorationType = rand.nextInt(4); + } + + protected void func_143012_a(NBTTagCompound data) { + super.func_143012_a(data); + data.setInteger("decoration", decorationType); + } + + protected void func_143011_b(NBTTagCompound data) { + super.func_143011_b(data); + decorationType = data.getInteger("decoration"); } @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; - } else { + } else {*/ + fillWithAir(world, box, 1, 1, 1, 6, 3, 8); + //Floor placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 2, 0, 0, box); fillWithMetadataBlocks(world, box, 1, 0, 1, 6, 0, 8, ModBlocks.vinyl_tile, 1); @@ -617,6 +652,11 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 6, 4, 8, box); //Decorations + int stairMetaW = getStairMeta(0); + int stairMetaE = getStairMeta(1); + int stairMetaN = getStairMeta(2); + int stairMetaS = getStairMeta(3); + //Bathroom placeDoor(world, box, ModBlocks.door_metal, 4, 4, 1, 8); placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 5, 1, 6, box); @@ -625,25 +665,99 @@ public class BunkerComponents extends ProceduralComponents { placeBlockAtCurrentPosition(world, Blocks.hopper, getDecoMeta(3), 6, 1, 8, box); placeBlockAtCurrentPosition(world, Blocks.trapdoor, getDecoModelMeta(0), 6, 2, 8, box); //Furnishing - placeBed(world, box, 2, 4, 1, 2); - placeBed(world, box, 2, 5, 1, 2); - fillWithMetadataBlocks(world, box, 6, 1, 1, 6, 1, 4, ModBlocks.concrete_slab, 9); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(1), 5, 1, 4, box); - placeBlockAtCurrentPosition(world, ModBlocks.radiorec, getDecoMeta(5), 6, 2, 1, box); - placeRandomBobble(world, box, rand, 6, 2, 3); - placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(2), 6, 2, 4, box); - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0) | 4, 4, 1, 5, HbmChestContents.officeTrash, 4); //TODO: create more contents - placeBlockAtCurrentPosition(world, ModBlocks.filing_cabinet, getDecoModelMeta(0) | 4, 4, 1, 5, box); - // - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, getStairMeta(7), 1, 1, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, getStairMeta(6), 1, 1, 3, box); - placeBlockAtCurrentPosition(world, ModBlocks.machine_electric_furnace_off, 5, 1, 1, 4, box); - fillWithMetadataBlocks(world, box, 1, 3, 2, 1, 3, 4, ModBlocks.reinforced_brick_stairs, getStairMeta(1)); - // - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(3), 1, 1, 6, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, getStairMeta(4), 2, 1, 7, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 1, 1, 7, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 1, 1, 8, box); + switch(this.decorationType) { + case 0: + placeBed(world, box, 2, 4, 1, 2); + placeBed(world, box, 2, 5, 1, 2); + fillWithMetadataBlocks(world, box, 6, 1, 1, 6, 1, 4, ModBlocks.concrete_slab, 9); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, 5, 1, 4, box); + placeBlockAtCurrentPosition(world, ModBlocks.radiorec, getDecoMeta(5), 6, 2, 1, box); + if(rand.nextInt(2) == 0) placeRandomBobble(world, box, rand, 6, 2, 3); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(2), 6, 2, 4, box); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(4), 4, 1, 5, HbmChestContents.bedroom1, 8); + //Kitchen + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaS | 4, 1, 1, 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaN | 4, 1, 1, 3, box); + placeBlockAtCurrentPosition(world, ModBlocks.machine_electric_furnace_off, getDecoMeta(5), 1, 1, 4, box); + fillWithMetadataBlocks(world, box, 1, 3, 2, 1, 3, 4, ModBlocks.reinforced_brick_stairs, stairMetaE); + //Dining Table + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, 1, 1, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaW | 4, 2, 1, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 1, 1, 7, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 1, 1, 8, box); + break; + case 1: + placeBed(world, box, 1, 2, 1, 3); + placeBed(world, box, 1, 2, 1, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(7), 1, 1, 2, HbmChestContents.bedroom2, 8); + placeBlockAtCurrentPosition(world, ModBlocks.hev_battery, 0, 1, 2, 2, box); + //Desk + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaS | 4, 1, 1, 5, box); + fillWithMetadataBlocks(world, box, 1, 1, 6, 1, 1, 7, ModBlocks.concrete_slab, 9); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaN | 4, 1, 1, 8, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, 2, 1, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.tape_recorder, getDecoMeta(5), 1, 2, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(3), 1, 2, 7, box); + //Kitchen + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaE | 4, 4, 1, 1, box); + fillWithMetadataBlocks(world, box, 5, 1, 1, 6, 1, 1, ModBlocks.brick_slab, 9); + placeBlockAtCurrentPosition(world, ModBlocks.brick_slab, 9, 6, 1, 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaN | 4, 6, 1, 3, box); + placeBlockAtCurrentPosition(world, ModBlocks.machine_electric_furnace_off, getDecoMeta(4), 6, 1, 4, box); + fillWithMetadataBlocks(world, box, 6, 3, 1, 6, 3, 4, ModBlocks.reinforced_brick_stairs, stairMetaW); + placeBlockAtCurrentPosition(world, ModBlocks.machine_microwave, getDecoMeta(3), 5, 2, 1, box); + if(rand.nextInt(2) == 0) placeRandomBobble(world, box, rand, 6, 2, 2); + break; + case 2: + placeBed(world, box, 2, 5, 1, 3); + placeBed(world, box, 2, 6, 1, 3); + //Desk + placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 4, 1, 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaS | 4, 5, 1, 1, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 6, 1, 1, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 4, 1, 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(1), 4, 2, 1, box); + placeBlockAtCurrentPosition(world, Blocks.flower_pot, 3 + rand.nextInt(4), 5, 2, 1, box); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(5), 6, 2, 1, HbmChestContents.officeTrash, 4); + //Dining Table + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, 1, 1, 2, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 1, 1, 4, box); + placeBlockAtCurrentPosition(world, Blocks.fence, 0, 1, 1, 3, box); + placeBlockAtCurrentPosition(world, Blocks.heavy_weighted_pressure_plate, 0, 1, 2, 3, box); + //Kitchen + placeBlockAtCurrentPosition(world, ModBlocks.machine_electric_furnace_off, getDecoMeta(5), 1, 1, 8, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 1, 1, 7, box); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaS | 4, 1, 1, 6, box); + fillWithMetadataBlocks(world, box, 1, 3, 6, 1, 3, 8, ModBlocks.reinforced_brick_stairs, stairMetaE); + // + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(6), 3, 1, 6, HbmChestContents.bedroom3, 6); //TODO: add bedroom3 + if(rand.nextInt(2) == 0) placeRandomBobble(world, box, rand, 3, 2, 6); + break; + case 3: + placeBed(world, box, 1, 2, 1, 7); + placeBed(world, box, 1, 2, 1, 8); + //Kitchen & Nightstand + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaE | 4, 1, 1, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.radiorec, getDecoMeta(4), 1, 2, 6, box); + placeBlockAtCurrentPosition(world, ModBlocks.machine_electric_furnace_off, getDecoMeta(5), 1, 1, 4, box); + fillWithMetadataBlocks(world, box, 1, 1, 2, 1, 1, 3, ModBlocks.concrete_slab, 9); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaS | 4, 1, 1, 1, box); + fillWithMetadataBlocks(world, box, 1, 3, 1, 1, 3, 4, ModBlocks.reinforced_brick_stairs, stairMetaE); + //Workspace + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaE | 4, 4, 1, 1, box); + fillWithMetadataBlocks(world, box, 5, 1, 1, 6, 1, 1, ModBlocks.concrete_slab, 9); + fillWithMetadataBlocks(world, box, 6, 1, 2, 6, 1, 3, ModBlocks.concrete_slab, 9); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaN | 4, 6, 1, 4, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 5, 1, 2, box); + placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(0), 5, 1, 4, box); + if(rand.nextInt(2) == 0) placeRandomBobble(world, box, rand, 4, 1, 4); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(6), 6, 2, 3, HbmChestContents.bedroom4, 6); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(6), 6, 2, 4, HbmChestContents.bedroom4, 6); + placeBlockAtCurrentPosition(world, ModBlocks.deco_loot, 0, 5, 2, 1, box); //TODO: change LootGenerator to use a proper 'registry' instead of cumbersome methods + LootGenerator.lootMakeshiftGun(world, getXWithOffset(5, 1), getYWithOffset(2), getZWithOffset(5, 1)); + break; + } + placeDoor(world, box, ModBlocks.door_metal, 1, 2, 1, 0); @@ -654,7 +768,7 @@ public class BunkerComponents extends ProceduralComponents { } return true; - } + //} } /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ @@ -664,276 +778,6 @@ public class BunkerComponents extends ProceduralComponents { } } - public static class CenterCrossing extends Bunker { - - BlockSelector plantSelector = new BlockSelector() { - public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { - int chance = rand.nextInt(10); - - switch(chance) { - case 0: - this.field_151562_a = Blocks.yellow_flower; - break; - case 1: - case 2: - case 3: - case 4: - this.field_151562_a = Blocks.red_flower; - this.selectedBlockMetaData = rand.nextInt(9); - break; - case 5: - case 6: - this.field_151562_a = Blocks.tallgrass; - this.selectedBlockMetaData = rand.nextInt(2) + 1; - break; - default: - this.field_151562_a = Blocks.air; - } - } - }; - - boolean expandsNX; - boolean expandsPX; - - int decorationType = 0; - - public CenterCrossing() { } - - public CenterCrossing(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType); - this.coordBaseMode = coordBaseMode; - this.boundingBox = box; - this.decorationType = rand.nextInt(2); - } - - protected void func_143012_a(NBTTagCompound data) { - super.func_143012_a(data); - data.setBoolean("expandsNX", expandsNX); - data.setBoolean("expandsPX", expandsPX); - data.setInteger("decoration", decorationType); - } - - protected void func_143011_b(NBTTagCompound data) { - super.func_143011_b(data); - expandsNX = data.getBoolean("expandsNX"); - expandsPX = data.getBoolean("expandsPX"); - decorationType = data.getInteger("decoration"); - } - - @Override - public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { - checkModifiers(original); - - StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 3, 1); - expandsNX = componentN != null; - - StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 7, 1); - expandsPX = componentP != null; - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - - if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else { - fillWithAir(world, box, 6, 1, 0, 8, 3, 0); - fillWithAir(world, box, 1, 1, 1, 13, 3, 11); - fillWithAir(world, box, 2, 4, 2, 12, 5, 10); - - //Floor - fillWithMetadataBlocks(world, box, 6, 0, 0, 8, 0, 0, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 1, 0, 1, 4, 0, 1, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 1, 0, 2, 5, 0, 2, ModBlocks.vinyl_tile, 1); - placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 5, 0, 1, box); - fillWithBlocks(world, box, 6, 0, 1, 8, 0, 2, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 9, 0, 2, 13, 0, 2, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 10, 0, 1, 13, 0, 1, ModBlocks.vinyl_tile); - placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 9, 0, 1, box); - fillWithBlocks(world, box, 1, 0, 3, 13, 0, 5, ModBlocks.vinyl_tile); - fillWithBlocks(world, box, 1, 0, 7, 3, 0, 11, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 1, 0, 6, 13, 0, 6, ModBlocks.vinyl_tile, 1); - fillWithMetadataBlocks(world, box, 4, 0, 7, 10, 0, 11, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 11, 0, 7, 13, 0, 11, ModBlocks.vinyl_tile); - //Wall - fillWithBlocks(world, box, 1, 1, 0, 5, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 0, 5, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 0, 5, 3, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 4, 0, 13, 4, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 9, 1, 0, 13, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 9, 2, 0, 13, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 9, 3, 0, 13, 3, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 1, 12, 13, 1, 12, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 12, 13, 2, 12, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 12, 13, 4, 12, ModBlocks.reinforced_brick); - //Upper lining - for(int i = 1; i <= 11; i += 10) { - fillWithMetadataBlocks(world, box, 1, 4, i, 13, 4, i, ModBlocks.brick_slab, 8); - fillWithBlocks(world, box, 8, 5, i, 13, 5, i, ModBlocks.reinforced_brick); - placeLamp(world, box, rand, 7, 5, i); - fillWithBlocks(world, box, 1, 5, i, 6, 5, i, ModBlocks.reinforced_brick); - } - - for(int i = 1; i <= 13; i += 12) { - fillWithMetadataBlocks(world, box, i, 4, 2, i, 4, 10, ModBlocks.brick_slab, 8); - fillWithBlocks(world, box, i, 5, 2, i, 5, 5, ModBlocks.reinforced_brick); - placeLamp(world, box, rand, i, 5, 6); - fillWithBlocks(world, box, i, 5, 7, i, 5, 10, ModBlocks.reinforced_brick); - } - //Ceiling - int pillarMeta = getPillarMeta(4); - - fillWithBlocks(world, box, 2, 6, 2, 12, 6, 5, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 2, 6, 7, 12, 6, 10, ModBlocks.reinforced_brick); - for(int i = 2; i <= 10; i += 2) { - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, i, 6, 6, box); - placeLamp(world, box, rand, i + 1, 6, 6); - } - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 12, 6, 6, box); - - if(expandsNX) { - fillWithMetadataBlocks(world, box, 0, 0, 3, 0, 0, 5, ModBlocks.vinyl_tile, 1); //Floor - fillWithBlocks(world, box, 0, 1, 1, 0, 1, 2, ModBlocks.reinforced_brick); //Wall - fillWithBlocks(world, box, 0, 2, 1, 0, 2, 2, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 1, 0, 3, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 4, 1, 0, 4, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 1, 6, 0, 1, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 6, 0, 2, 11, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 6, 0, 3, 11, ModBlocks.reinforced_brick); - fillWithAir(world, box, 0, 1, 3, 0, 3, 5); - } else { - fillWithBlocks(world, box, 0, 1, 1, 0, 1, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 1, 0, 2, 11, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 1, 0, 4, 11, ModBlocks.reinforced_brick); - } - - if(expandsPX) { - fillWithMetadataBlocks(world, box, 14, 0, 3, 14, 0, 5, ModBlocks.vinyl_tile, 1); //Floor - fillWithBlocks(world, box, 14, 1, 1, 14, 1, 2, ModBlocks.reinforced_brick); //Wall - fillWithBlocks(world, box, 14, 2, 1, 14, 2, 2, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 14, 3, 1, 14, 3, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 14, 4, 1, 14, 4, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 14, 1, 6, 14, 1, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 14, 2, 6, 14, 2, 11, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 14, 3, 6, 14, 3, 11, ModBlocks.reinforced_brick); - fillWithAir(world, box, 14, 1, 3, 14, 3, 5); - } else { - fillWithBlocks(world, box, 14, 1, 1, 14, 1, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 14, 2, 1, 14, 2, 11, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 14, 3, 1, 14, 4, 11, ModBlocks.reinforced_brick); - } - - //Decorations - switch(decorationType) { - case 0: - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(3), 1, 1, 8, box); //Bench 1 - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(1), 1, 1, 9, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 1, 1, 10, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(3), 4, 1, 8, box); //Bench 2 - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(0), 4, 1, 9, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 4, 1, 10, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(3), 10, 1, 8, box); //Bench 3 - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(1), 10, 1, 9, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 10, 1, 10, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(3), 13, 1, 8, box); //Bench 4 - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(0), 13, 1, 9, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 13, 1, 10, box); - //Fountain - fillWithBlocks(world, box, 5, 1, 8, 5, 1, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 1, 7, 8, 1, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 9, 1, 8, 9, 1, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 7, 1, 9, 7, 2, 9, ModBlocks.concrete_pillar); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_light, 0, 7, 3, 9, box); - placeBlockAtCurrentPosition(world, Blocks.flowing_water, 0, 7, 4, 9, box); //meh! regular stronghold does it too - fillWithMetadataBlocks(world, box, 5, 2, 9, 5, 2, 10, ModBlocks.brick_slab, 1); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(2), 5, 2, 11, box); - fillWithMetadataBlocks(world, box, 9, 2, 9, 9, 2, 10, ModBlocks.brick_slab, 1); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(2), 9, 2, 11, box); - break; - case 1: - int stairMetaW = getStairMeta(0); - int stairMetaE = getStairMeta(1); - int stairMetaN = getStairMeta(2); - int stairMetaS = getStairMeta(3); - - //Right Planter - fillWithBlocks(world, box, 1, 1, 1, 4, 1, 1, Blocks.grass); - fillWithMetadataBlocks(world, box, 5, 1, 1, 5, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaE); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 1, 2, box); - if(!expandsNX) { - fillWithMetadataBlocks(world, box, 2, 1, 2, 3, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); - fillWithMetadataBlocks(world, box, 2, 1, 3, 2, 1, 5, ModBlocks.reinforced_brick_stairs, stairMetaE); - fillWithBlocks(world, box, 1, 1, 2, 1, 1, 5, Blocks.grass); - } else - fillWithMetadataBlocks(world, box, 1, 1, 2, 3, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); - //Left Planter - fillWithBlocks(world, box, 10, 1, 1, 13, 1, 1, Blocks.grass); - fillWithMetadataBlocks(world, box, 9, 1, 1, 9, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaW); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 10, 1, 2, box); - if(!expandsPX) { - fillWithMetadataBlocks(world, box, 11, 1, 2, 12, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); - fillWithMetadataBlocks(world, box, 12, 1, 3, 12, 1, 5, ModBlocks.reinforced_brick_stairs, stairMetaW); - fillWithBlocks(world, box, 13, 1, 2, 13, 1, 5, Blocks.grass); - } else - fillWithMetadataBlocks(world, box, 11, 1, 2, 13, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); - //Main planter with conversation pits - fillWithBlocks(world, box, 1, 1, 7, 2, 1, 11, Blocks.grass); //Planter - fillWithBlocks(world, box, 7, 1, 8, 7, 1, 10, Blocks.grass); - fillWithBlocks(world, box, 12, 1, 7, 13, 1, 10, Blocks.grass); - fillWithBlocks(world, box, 3, 1, 11, 13, 1, 11, Blocks.grass); - fillWithBlocks(world, box, 1, 1, 6, 2, 1, 6, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 3, 1, 6, 3, 1, 7, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 6, 1, 7, 8, 1, 7, ModBlocks.reinforced_brick_stairs, stairMetaN); - fillWithBlocks(world, box, 11, 1, 6, 11, 1, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 12, 1, 6, 13, 1, 6, ModBlocks.reinforced_brick); - for(int i = 3; i <= 8; i += 5) { //Conversation pits - fillWithMetadataBlocks(world, box, i, 1, 10, i + 3, 1, 10, Blocks.spruce_stairs, stairMetaN); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, i, 1, 9, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, i, 1, 8, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, i + 3, 1, 9, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, i + 3, 1, 8, box); - } - //Hanging lights - for(int i = 4; i <= 10; i += 3) { - fillWithBlocks(world, box, i, 4, 9, i, 5, 9, ModBlocks.chain); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_light, 0, i, 3, 9, box); - } - for(int i = 3; i <= 11; i += 8) { - fillWithBlocks(world, box, i, 4, 2, i, 5, 2, ModBlocks.chain); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_light, 0, i, 3, 2, box); - } - //Plant life - fillWithRandomizedBlocks(world, box, 1, 2, 1, 4, 2, 1, rand, plantSelector); - fillWithRandomizedBlocks(world, box, 10, 2, 1, 13, 2, 1, rand, plantSelector); - fillWithRandomizedBlocks(world, box, 1, 2, 7, 2, 2, 11, rand, plantSelector); - fillWithRandomizedBlocks(world, box, 3, 2, 11, 11, 2, 11, rand, plantSelector); - fillWithRandomizedBlocks(world, box, 12, 2, 7, 13, 2, 11, rand, plantSelector); - fillWithRandomizedBlocks(world, box, 7, 2, 8, 7, 2, 10, rand, plantSelector); - if(!expandsNX) fillWithRandomizedBlocks(world, box, 1, 2, 2, 1, 2, 5, rand, plantSelector); - if(!expandsPX) fillWithRandomizedBlocks(world, box, 13, 2, 2, 13, 2, 5, rand, plantSelector); - break; - } - - if(!underwater) - fillWithCobwebs(world, box, rand, 0, 1, 0, 14, 5, 12); - else { - fillWithWater(world, box, rand, 6, 1, 0, 8, 3, 0, 1); - fillWithWater(world, box, rand, 0, 1, 3, 0, 3, 5, 1); - fillWithWater(world, box, rand, 14, 1, 3, 14, 3, 5, 1); - fillWithWater(world, box, rand, 1, 1, 1, 13, 5, 11, 1); - } - - return true; - } - } - - /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ - public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { - StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -6, -1, 0, 15, 8, 13, mode); - return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new CenterCrossing(type, rand, box, mode) : null; - } - } - //This one will be a doozy public static class Reactor extends Bunker { @@ -984,9 +828,9 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; - } else { + } else {*/ fillWithAir(world, box, 5, 2, 0, 7, 4, 0); fillWithAir(world, box, 3, 1, 3, 9, 1, 9); fillWithAir(world, box, 1, 2, 1, 11, 7, 11); @@ -1169,7 +1013,7 @@ public class BunkerComponents extends ProceduralComponents { } return true; - } + //} } protected void makeConnection(World world, int x1, int y1, int z1, int x2, int y2, int z2) { @@ -1211,9 +1055,9 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; - } else { + } else {*/ fillWithAir(world, box, 4, 1, 0, 6, 3, 0); fillWithAir(world, box, 1, 1, 1, 9, 3, 9); @@ -1307,7 +1151,7 @@ public class BunkerComponents extends ProceduralComponents { fillWithCobwebs(world, box, rand, 1, 1, 0, 9, 3, 9); return true; - } + //} } @@ -1390,12 +1234,12 @@ public class BunkerComponents extends ProceduralComponents { StructureComponent component = getNextComponentNormal(instance, original, components, rand, 1, 1); extendsPZ = component != null; - if(rand.nextInt(2) == 0) { + if(rand.nextInt(3) > 0) { StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 6, 1); expandsNX = componentN != null; } - if(rand.nextInt(2) == 0) { + if(rand.nextInt(3) > 0) { StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 6, 1); expandsPX = componentP != null; } @@ -1404,9 +1248,9 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; - } else { + } else {*/ int end = extendsPZ ? 14 : 13; fillWithAir(world, box, 1, 1, 0, 3, 3, end); @@ -1474,7 +1318,7 @@ public class BunkerComponents extends ProceduralComponents { fillWithCobwebs(world, box, rand, expandsNX ? 0 : 1, 1, 0, expandsPX ? 4 : 3, 3, end); return true; - } + //} } /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ @@ -1535,12 +1379,12 @@ public class BunkerComponents extends ProceduralComponents { flipConstituentBulkhead(component, rand); } - if(rand.nextInt(2) == 0) { + if(rand.nextInt(3) > 0) { StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 6, 1); expandsNX = componentN != null; } - if(rand.nextInt(2) == 0) { + if(rand.nextInt(3) > 0) { StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 6, 1); expandsPX = componentP != null; } @@ -1549,9 +1393,9 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; - } else { + } else {*/ int begin = bulkheadNZ ? 1 : 0; int end = bulkheadPZ ? 13 : 14; //for the bulkhead int endExtend = !extendsPZ ? 13 : 14; //for parts that would be cut off if it doesn't extend further @@ -1657,7 +1501,7 @@ public class BunkerComponents extends ProceduralComponents { fillWithCobwebs(world, box, rand, expandsNX ? 0 : 1, 1, 0, expandsPX ? 8 : 7, 3, endExtend); return true; - } + //} } } @@ -1737,9 +1581,9 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; - } else { + } else {*/ fillWithAir(world, box, 1, 1, 0, 3, 3, 3); //Floor @@ -1834,7 +1678,7 @@ public class BunkerComponents extends ProceduralComponents { fillWithCobwebs(world, box, rand, opensNX ? 0 : 1, 1, 0, opensPX ? 4 : 3, 3, opensPZ ? 4 : 3); return true; - } + //} } /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ @@ -1842,8 +1686,13 @@ public class BunkerComponents extends ProceduralComponents { StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); if(box.minY > 10 && StructureComponent.findIntersecting(components, box) == null) return new WideIntersection(type, rand, box, mode); - box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); - return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new Intersection(type, rand, box, mode) : null; + if(rand.nextInt(2) == 0) { + box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); + return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new Intersection(type, rand, box, mode) : null; + } else { + box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 4, mode); + return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new DeadEnd(type, rand, box, mode) : null; + } } } @@ -1909,9 +1758,9 @@ public class BunkerComponents extends ProceduralComponents { @Override public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { return false; - } else { + } else {*/ int start = bulkheadNZ ? 1 : 0; int end = bulkheadPZ ? 7 : 8; @@ -2097,7 +1946,401 @@ public class BunkerComponents extends ProceduralComponents { fillWithCobwebs(world, box, rand, opensNX ? 0 : 1, 1, 0, opensPX ? 8 : 7, 3, opensPZ ? 8 : 7); return true; - } + //} } } + + //fuck you intersection stop clogging my vaults + public static class DeadEnd extends Bunker { + + BlockSelector plantSelector = new BlockSelector() { + public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { + int chance = rand.nextInt(10); + + switch(chance) { + case 0: + this.field_151562_a = Blocks.yellow_flower; + break; + case 1: + case 2: + case 3: + case 4: + this.field_151562_a = Blocks.red_flower; + this.selectedBlockMetaData = rand.nextInt(9); + break; + case 5: + case 6: + this.field_151562_a = Blocks.tallgrass; + this.selectedBlockMetaData = rand.nextInt(2) + 1; + break; + default: + this.field_151562_a = Blocks.air; + } + } + }; + + int decorationType = 0; + + public DeadEnd() { } + + public DeadEnd(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType); + this.coordBaseMode = coordBaseMode; + this.boundingBox = box; + this.decorationType = rand.nextInt(4); + } + + protected void func_143012_a(NBTTagCompound data) { + super.func_143012_a(data); + data.setInteger("decoration", decorationType); + } + + protected void func_143011_b(NBTTagCompound data) { + super.func_143011_b(data); + decorationType = data.getInteger("decoration"); + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + return false; + } else {*/ + fillWithAir(world, box, 1, 1, 0, 3, 3, 2); + + //Floor + fillWithBlocks(world, box, 1, 0, 0, 3, 0, 2, ModBlocks.vinyl_tile); + //Wall + fillWithBlocks(world, box, 0, 1, 0, 0, 1, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 0, 0, 2, 2, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 0, 0, 3, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 1, 3, 3, 1, 3, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 3, 3, 2, 3, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 3, 3, 3, 3, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 4, 1, 0, 4, 1, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 4, 2, 0, 4, 2, 2, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 4, 3, 0, 4, 3, 2, ModBlocks.reinforced_brick); + //Ceiling + fillWithBlocks(world, box, 1, 4, 0, 1, 4, 2, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 2, 4, 2, box); + fillWithBlocks(world, box, 3, 4, 0, 3, 4, 2, ModBlocks.reinforced_brick); + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, getPillarMeta(8), 2, 4, 0, box); + placeLamp(world, box, rand, 2, 4, 1); + + //Decoration + switch(this.decorationType) { + case 0: break; + case 1: + fillWithBlocks(world, box, 1, 1, 2, 3, 1, 2, Blocks.grass); + fillWithBlocks(world, box, 1, 1, 1, 3, 1, 1, ModBlocks.reinforced_brick); + fillWithRandomizedBlocks(world, box, 1, 2, 2, 3, 2, 2, rand, plantSelector); + break; + case 2: + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(1), 1, 1, 2, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 2, 1, 2, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(0), 3, 1, 2, box); + break; + case 3: + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(1), 1, 1, 2, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(0), 3, 1, 2, box); + placeBlockAtCurrentPosition(world, Blocks.fence, 0, 2, 1, 2, box); + placeBlockAtCurrentPosition(world, Blocks.heavy_weighted_pressure_plate, 0, 2, 2, 2, box); + break; + } + + if(underwater) + fillWithWater(world, box, rand, 1, 1, 0, 3, 3, 2, 1); + else + fillWithCobwebs(world, box, rand, 1, 1, 0, 3, 3, 2); + + return true; + //} + } + } + + public static class CenterCrossing extends Bunker { + + BlockSelector plantSelector = new BlockSelector() { + public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { + int chance = rand.nextInt(10); + + switch(chance) { + case 0: + this.field_151562_a = Blocks.yellow_flower; + break; + case 1: + case 2: + case 3: + case 4: + this.field_151562_a = Blocks.red_flower; + this.selectedBlockMetaData = rand.nextInt(9); + break; + case 5: + case 6: + this.field_151562_a = Blocks.tallgrass; + this.selectedBlockMetaData = rand.nextInt(2) + 1; + break; + default: + this.field_151562_a = Blocks.air; + } + } + }; + + boolean expandsNX; + boolean expandsPX; + + int decorationType = 0; + + public CenterCrossing() { } + + public CenterCrossing(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { + super(componentType); + this.coordBaseMode = coordBaseMode; + this.boundingBox = box; + this.decorationType = rand.nextInt(2); + } + + protected void func_143012_a(NBTTagCompound data) { + super.func_143012_a(data); + data.setBoolean("expandsNX", expandsNX); + data.setBoolean("expandsPX", expandsPX); + data.setInteger("decoration", decorationType); + } + + protected void func_143011_b(NBTTagCompound data) { + super.func_143011_b(data); + expandsNX = data.getBoolean("expandsNX"); + expandsPX = data.getBoolean("expandsPX"); + decorationType = data.getInteger("decoration"); + } + + @Override + public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { + checkModifiers(original); + + StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 3, 1); + expandsNX = componentN != null; + + StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 7, 1); + expandsPX = componentP != null; + } + + @Override + public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { + + /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { + return false; + } else {*/ + fillWithAir(world, box, 6, 1, 0, 8, 3, 0); + fillWithAir(world, box, 1, 1, 1, 13, 3, 11); + fillWithAir(world, box, 2, 4, 2, 12, 5, 10); + + //Floor + fillWithMetadataBlocks(world, box, 6, 0, 0, 8, 0, 0, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 1, 0, 1, 4, 0, 1, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 1, 0, 2, 5, 0, 2, ModBlocks.vinyl_tile, 1); + placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 5, 0, 1, box); + fillWithBlocks(world, box, 6, 0, 1, 8, 0, 2, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 9, 0, 2, 13, 0, 2, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 10, 0, 1, 13, 0, 1, ModBlocks.vinyl_tile); + placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 9, 0, 1, box); + fillWithBlocks(world, box, 1, 0, 3, 13, 0, 5, ModBlocks.vinyl_tile); + fillWithBlocks(world, box, 1, 0, 7, 3, 0, 11, ModBlocks.vinyl_tile); + fillWithMetadataBlocks(world, box, 1, 0, 6, 13, 0, 6, ModBlocks.vinyl_tile, 1); + fillWithMetadataBlocks(world, box, 4, 0, 7, 10, 0, 11, ModBlocks.vinyl_tile, 1); + fillWithBlocks(world, box, 11, 0, 7, 13, 0, 11, ModBlocks.vinyl_tile); + //Wall + fillWithBlocks(world, box, 1, 1, 0, 5, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 0, 5, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 0, 5, 3, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 4, 0, 13, 4, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 9, 1, 0, 13, 1, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 9, 2, 0, 13, 2, 0, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 9, 3, 0, 13, 3, 0, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 1, 12, 13, 1, 12, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 1, 2, 12, 13, 2, 12, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 1, 3, 12, 13, 4, 12, ModBlocks.reinforced_brick); + //Upper lining + for(int i = 1; i <= 11; i += 10) { + fillWithMetadataBlocks(world, box, 1, 4, i, 13, 4, i, ModBlocks.brick_slab, 8); + fillWithBlocks(world, box, 8, 5, i, 13, 5, i, ModBlocks.reinforced_brick); + placeLamp(world, box, rand, 7, 5, i); + fillWithBlocks(world, box, 1, 5, i, 6, 5, i, ModBlocks.reinforced_brick); + } + + for(int i = 1; i <= 13; i += 12) { + fillWithMetadataBlocks(world, box, i, 4, 2, i, 4, 10, ModBlocks.brick_slab, 8); + fillWithBlocks(world, box, i, 5, 2, i, 5, 5, ModBlocks.reinforced_brick); + placeLamp(world, box, rand, i, 5, 6); + fillWithBlocks(world, box, i, 5, 7, i, 5, 10, ModBlocks.reinforced_brick); + } + //Ceiling + int pillarMeta = getPillarMeta(4); + + fillWithBlocks(world, box, 2, 6, 2, 12, 6, 5, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 2, 6, 7, 12, 6, 10, ModBlocks.reinforced_brick); + for(int i = 2; i <= 10; i += 2) { + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, i, 6, 6, box); + placeLamp(world, box, rand, i + 1, 6, 6); + } + placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 12, 6, 6, box); + + if(expandsNX) { + fillWithMetadataBlocks(world, box, 0, 0, 3, 0, 0, 5, ModBlocks.vinyl_tile, 1); //Floor + fillWithBlocks(world, box, 0, 1, 1, 0, 1, 2, ModBlocks.reinforced_brick); //Wall + fillWithBlocks(world, box, 0, 2, 1, 0, 2, 2, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 1, 0, 3, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 4, 1, 0, 4, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 1, 6, 0, 1, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 6, 0, 2, 11, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 6, 0, 3, 11, ModBlocks.reinforced_brick); + fillWithAir(world, box, 0, 1, 3, 0, 3, 5); + } else { + fillWithBlocks(world, box, 0, 1, 1, 0, 1, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 0, 2, 1, 0, 2, 11, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 0, 3, 1, 0, 4, 11, ModBlocks.reinforced_brick); + } + + if(expandsPX) { + fillWithMetadataBlocks(world, box, 14, 0, 3, 14, 0, 5, ModBlocks.vinyl_tile, 1); //Floor + fillWithBlocks(world, box, 14, 1, 1, 14, 1, 2, ModBlocks.reinforced_brick); //Wall + fillWithBlocks(world, box, 14, 2, 1, 14, 2, 2, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 14, 3, 1, 14, 3, 2, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 14, 4, 1, 14, 4, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 14, 1, 6, 14, 1, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 14, 2, 6, 14, 2, 11, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 14, 3, 6, 14, 3, 11, ModBlocks.reinforced_brick); + fillWithAir(world, box, 14, 1, 3, 14, 3, 5); + } else { + fillWithBlocks(world, box, 14, 1, 1, 14, 1, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 14, 2, 1, 14, 2, 11, ModBlocks.reinforced_stone); + fillWithBlocks(world, box, 14, 3, 1, 14, 4, 11, ModBlocks.reinforced_brick); + } + + //Decorations + int stairMetaW = getStairMeta(0); + int stairMetaE = getStairMeta(1); + int stairMetaN = getStairMeta(2); + int stairMetaS = getStairMeta(3); + + switch(decorationType) { + case 0: + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, 1, 1, 8, box); //Bench 1 + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, 1, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 1, 1, 10, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, 4, 1, 8, box); //Bench 2 + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, 4, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 4, 1, 10, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, 10, 1, 8, box); //Bench 3 + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, 10, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 10, 1, 10, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, 13, 1, 8, box); //Bench 4 + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, 13, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 13, 1, 10, box); + if(!expandsNX) { + for(int i = 3; i <= 5; i += 2) { + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, 2, 1, i, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, 4, 1, i, box); + placeBlockAtCurrentPosition(world, Blocks.fence, 0, 3, 1, i, box); + placeBlockAtCurrentPosition(world, Blocks.heavy_weighted_pressure_plate, 0, 3, 2, i, box); + } + } + if(!expandsPX) { + for(int i = 3; i <= 5; i += 2) { + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, 10, 1, i, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, 12, 1, i, box); + placeBlockAtCurrentPosition(world, Blocks.fence, 0, 11, 1, i, box); + placeBlockAtCurrentPosition(world, Blocks.heavy_weighted_pressure_plate, 0, 11, 2, i, box); + } + } + //Fountain + fillWithBlocks(world, box, 5, 1, 8, 5, 1, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 6, 1, 7, 8, 1, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 9, 1, 8, 9, 1, 11, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 7, 1, 9, 7, 2, 9, ModBlocks.concrete_pillar); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_light, 0, 7, 3, 9, box); + placeBlockAtCurrentPosition(world, Blocks.flowing_water, 0, 7, 4, 9, box); //meh! regular stronghold does it too + fillWithMetadataBlocks(world, box, 5, 2, 9, 5, 2, 10, ModBlocks.brick_slab, 1); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(2), 5, 2, 11, box); + fillWithMetadataBlocks(world, box, 9, 2, 9, 9, 2, 10, ModBlocks.brick_slab, 1); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(2), 9, 2, 11, box); + break; + case 1: + //Right Planter + fillWithBlocks(world, box, 1, 1, 1, 4, 1, 1, Blocks.grass); + fillWithMetadataBlocks(world, box, 5, 1, 1, 5, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaE); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 1, 2, box); + if(!expandsNX) { + fillWithMetadataBlocks(world, box, 2, 1, 2, 3, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); + fillWithMetadataBlocks(world, box, 2, 1, 3, 2, 1, 5, ModBlocks.reinforced_brick_stairs, stairMetaE); + fillWithBlocks(world, box, 1, 1, 2, 1, 1, 5, Blocks.grass); + } else + fillWithMetadataBlocks(world, box, 1, 1, 2, 3, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); + //Left Planter + fillWithBlocks(world, box, 10, 1, 1, 13, 1, 1, Blocks.grass); + fillWithMetadataBlocks(world, box, 9, 1, 1, 9, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaW); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 10, 1, 2, box); + if(!expandsPX) { + fillWithMetadataBlocks(world, box, 11, 1, 2, 12, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); + fillWithMetadataBlocks(world, box, 12, 1, 3, 12, 1, 5, ModBlocks.reinforced_brick_stairs, stairMetaW); + fillWithBlocks(world, box, 13, 1, 2, 13, 1, 5, Blocks.grass); + } else + fillWithMetadataBlocks(world, box, 11, 1, 2, 13, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); + //Main planter with conversation pits + fillWithBlocks(world, box, 1, 1, 7, 2, 1, 11, Blocks.grass); //Planter + fillWithBlocks(world, box, 7, 1, 8, 7, 1, 10, Blocks.grass); + fillWithBlocks(world, box, 12, 1, 7, 13, 1, 10, Blocks.grass); + fillWithBlocks(world, box, 3, 1, 11, 13, 1, 11, Blocks.grass); + fillWithBlocks(world, box, 1, 1, 6, 2, 1, 6, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 3, 1, 6, 3, 1, 7, ModBlocks.reinforced_brick); + fillWithMetadataBlocks(world, box, 6, 1, 7, 8, 1, 7, ModBlocks.reinforced_brick_stairs, stairMetaN); + fillWithBlocks(world, box, 11, 1, 6, 11, 1, 7, ModBlocks.reinforced_brick); + fillWithBlocks(world, box, 12, 1, 6, 13, 1, 6, ModBlocks.reinforced_brick); + for(int i = 3; i <= 8; i += 5) { //Conversation pits + fillWithMetadataBlocks(world, box, i, 1, 10, i + 3, 1, 10, Blocks.spruce_stairs, stairMetaN); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, i, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, i, 1, 8, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, i + 3, 1, 9, box); + placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, i + 3, 1, 8, box); + } + //Hanging lights + for(int i = 4; i <= 10; i += 3) { + fillWithBlocks(world, box, i, 4, 9, i, 5, 9, ModBlocks.chain); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_light, 0, i, 3, 9, box); + } + for(int i = 3; i <= 11; i += 8) { + fillWithBlocks(world, box, i, 4, 2, i, 5, 2, ModBlocks.chain); + placeBlockAtCurrentPosition(world, ModBlocks.reinforced_light, 0, i, 3, 2, box); + } + //Plant life + fillWithRandomizedBlocks(world, box, 1, 2, 1, 4, 2, 1, rand, plantSelector); + fillWithRandomizedBlocks(world, box, 10, 2, 1, 13, 2, 1, rand, plantSelector); + fillWithRandomizedBlocks(world, box, 1, 2, 7, 2, 2, 11, rand, plantSelector); + fillWithRandomizedBlocks(world, box, 3, 2, 11, 11, 2, 11, rand, plantSelector); + fillWithRandomizedBlocks(world, box, 12, 2, 7, 13, 2, 11, rand, plantSelector); + fillWithRandomizedBlocks(world, box, 7, 2, 8, 7, 2, 10, rand, plantSelector); + if(!expandsNX) fillWithRandomizedBlocks(world, box, 1, 2, 2, 1, 2, 5, rand, plantSelector); + if(!expandsPX) fillWithRandomizedBlocks(world, box, 13, 2, 2, 13, 2, 5, rand, plantSelector); + break; + } + + if(!underwater) + fillWithCobwebs(world, box, rand, 0, 1, 0, 14, 5, 12); + else { + fillWithWater(world, box, rand, 6, 1, 0, 8, 3, 0, 1); + fillWithWater(world, box, rand, 0, 1, 3, 0, 3, 5, 1); + fillWithWater(world, box, rand, 14, 1, 3, 14, 3, 5, 1); + fillWithWater(world, box, rand, 1, 1, 1, 13, 5, 11, 1); + } + + return true; + //} + } + + /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ + public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { + StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -6, -1, 0, 15, 8, 13, mode); + return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new CenterCrossing(type, rand, box, mode) : null; + } + } + } \ No newline at end of file diff --git a/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java b/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java index 4110a1294..bbd9bab87 100644 --- a/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java @@ -14,6 +14,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntityChest; import net.minecraft.util.WeightedRandomChestContent; import net.minecraft.world.World; +import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraft.world.gen.structure.StructureBoundingBox; /* Described as "Civilian", as that's the overarching connection between all of these structures. Unlike the ruins, there's not enough to @@ -21,6 +22,14 @@ import net.minecraft.world.gen.structure.StructureBoundingBox; */ public class CivilianFeatures { + public static void registerComponents() { + MapGenStructureIO.func_143031_a(NTMHouse1.class, "NTMHouse1"); + MapGenStructureIO.func_143031_a(NTMHouse2.class, "NTMHouse2"); + MapGenStructureIO.func_143031_a(NTMLab1.class, "NTMLab1"); + MapGenStructureIO.func_143031_a(NTMLab2.class, "NTMLab2"); + MapGenStructureIO.func_143031_a(NTMWorkshop1.class, "NTMWorkshop1"); + } + /** Sandstone Ruin 1 */ public static class NTMHouse1 extends Component { diff --git a/src/main/java/com/hbm/world/worldgen/components/Component.java b/src/main/java/com/hbm/world/worldgen/components/Component.java index 858503387..88b8dd3bf 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Component.java +++ b/src/main/java/com/hbm/world/worldgen/components/Component.java @@ -256,7 +256,7 @@ abstract public class Component extends StructureComponent { ItemDoor.placeDoorBlock(world, posX, posY, posZ, meta, door); } - //N:0 W:1 S:2 E:3 + /**N:0 W:1 S:2 E:3 */ protected void placeBed(World world, StructureBoundingBox box, int meta, int featureX, int featureY, int featureZ) { int xOffset = 0; int zOffset = 0; @@ -377,9 +377,9 @@ abstract public class Component extends StructureComponent { IInventory inventory = (IInventory) world.getTileEntity(posX, posY, posZ); if(inventory != null) { - ItemStack book = HbmChestContents.genetateBook(key); - - inventory.setInventorySlotContents(slot, book); + //ItemStack book = HbmChestContents.genetateBook(key); + //TODO: replace this with ItemBookLore version + //inventory.setInventorySlotContents(slot, book); } } diff --git a/src/main/java/com/hbm/world/worldgen/components/MilitaryBaseFeatures.java b/src/main/java/com/hbm/world/worldgen/components/MilitaryBaseFeatures.java deleted file mode 100644 index d24d2975b..000000000 --- a/src/main/java/com/hbm/world/worldgen/components/MilitaryBaseFeatures.java +++ /dev/null @@ -1,182 +0,0 @@ -package com.hbm.world.worldgen.components; - -import java.util.LinkedList; -import java.util.Random; - -import com.hbm.blocks.ModBlocks; - -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.structure.StructureBoundingBox; - -//These structures are... kind of? low quality, but they test out new methods so whatev. -//TODO: smite -public class MilitaryBaseFeatures { - - //stop-gap methods until this entire mess can be organized into proper classes/structure groups - public static void smallHelipad(LinkedList components, int chunkX, int posY, int chunkZ, Random rand) { - BasicHelipad helipad = new BasicHelipad(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); - int[] chunkPos = getAdjacentChunk(chunkX, chunkZ, rand); - - RadioShack radio = new RadioShack(rand, chunkPos[0] * 16 + 8, posY, chunkPos[1] * 16 + 8); - components.add(helipad); - components.add(radio); - } - - //ugh - public static int[] getAdjacentChunk(int chunkX, int chunkZ, Random rand) { - int[] chunkPos = new int[2]; - - switch(rand.nextInt(4)) { - case 0: - chunkPos[0] = chunkX; - chunkPos[1] = chunkZ + 1; - break; - case 1: - chunkPos[0] = chunkX - 1; - chunkPos[1] = chunkZ; - break; - case 2: - chunkPos[0] = chunkX; - chunkPos[1] = chunkZ - 1; - break; - case 3: - chunkPos[0] = chunkX + 1; - chunkPos[1] = chunkZ; - break; - } - - return chunkPos; - } - - public static class BasicHelipad extends Component { - - public BasicHelipad() { super(); } - - protected BasicHelipad(Random rand, int minX, int minY, int minZ) { - super(rand, minX, minY, minZ, 12, 0, 12); - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - - if(!this.setAverageHeight(world, box, this.boundingBox.minY)) { - return true; - } - - this.boundingBox.offset(0, -1, 0); - - for(int i = 1; i < sizeX; i++) { - for(int j = 1; j < sizeZ; j++) { - clearCurrentPositionBlocksUpwards(world, i, 1, j, box); - } - } - - placeFoundationUnderneath(world, Blocks.stonebrick, 0, 1, 1, sizeX - 1, sizeZ - 1, -1, box); - - placeFoundationUnderneath(world, Blocks.stonebrick, 0, 0, 0, sizeX, 0, -1, box); - placeFoundationUnderneath(world, Blocks.stonebrick, 0, 0, 1, 0, sizeZ, -1, box); - placeFoundationUnderneath(world, Blocks.stonebrick, 0, sizeX, 1, sizeX, sizeZ, -1, box); - placeFoundationUnderneath(world, Blocks.stonebrick, 0, 1, sizeZ, sizeX - 1, sizeZ, -1, box); - - //Helipad - fillWithBlocks(world, box, 1, 0, 1, 11, 0, 1, ModBlocks.concrete, Blocks.air, false); //this entire time, the second block was actually for anything not at min/max x's, y's, and z's. useful! - fillWithBlocks(world, box, 11, 0, 2, 11, 0, 11, ModBlocks.concrete, Blocks.air, false); - fillWithBlocks(world, box, 1, 0, 11, 10, 0, 11, ModBlocks.concrete, Blocks.air, false); - fillWithBlocks(world, box, 1, 0, 2, 1, 0, 10, ModBlocks.concrete, Blocks.air, false); - - fillWithBlocks(world, box, 2, 0, 2, 10, 0, 10, ModBlocks.concrete_smooth, Blocks.air, false); //i'm not carefully carving out the white H lmao fuck that - fillWithBlocks(world, box, 4, 0, 4, 4, 0, 8, ModBlocks.concrete_colored, Blocks.air, false); //white is 0 - fillWithBlocks(world, box, 8, 0, 4, 8, 0, 8, ModBlocks.concrete_colored, Blocks.air, false); - fillWithBlocks(world, box, 5, 0, 6, 7, 0, 6, ModBlocks.concrete_colored, Blocks.air, false); - - //Surrounding Fences - placeBlocksOnTop(world, box, ModBlocks.fence_metal, 0, 0, sizeX, 0, 1); - placeBlocksOnTop(world, box, ModBlocks.fence_metal, sizeX, 1, sizeX, sizeZ, 1); - placeBlocksOnTop(world, box, ModBlocks.fence_metal, 0, sizeZ, sizeX - 1, sizeZ, 1); - placeBlocksOnTop(world, box, ModBlocks.fence_metal, 0, 1, 0, sizeZ - 1, 1); - - return false; - } - - } - - public static class RadioShack extends Component { - - private static LabTiles RandomLabTiles = new LabTiles(); - private static ConcreteBricks ConcreteBricks = new ConcreteBricks(); - - public RadioShack() { super(); } - - protected RadioShack(Random rand, int minX, int minY, int minZ) { - super(rand, minX, minY, minZ, 6, 4, 5); - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - - if(!this.setAverageHeight(world, box, this.boundingBox.minY)) { - return true; - } - - this.boundingBox.offset(0, -1, 0); - - placeFoundationUnderneath(world, Blocks.stonebrick, 0, 1, 1, sizeX, sizeZ, -1, box); - placeFoundationUnderneath(world, Blocks.stonebrick, 0, 0, 2, 0, 2, 0, box); - - //Floor & Foundation - fillWithRandomizedBlocks(world, box, 2, 0, 1, 5, 0, 4, false, rand, RandomLabTiles); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, 0, 1, 0, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, 0, sizeX, 0, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, 0, 1, 0, sizeZ, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, 0, sizeX, 0, sizeZ, box); - fillWithBlocks(world, box, 2, 0, 1, sizeX - 1, 0, 1, ModBlocks.concrete_smooth, Blocks.air, false); - fillWithBlocks(world, box, 2, 0, 0, sizeX - 1, 0, 0, ModBlocks.concrete_smooth, Blocks.air, false); - fillWithBlocks(world, box, sizeX, 0, 2, sizeX, 0, sizeZ - 1, ModBlocks.concrete_smooth, Blocks.air, false); - fillWithBlocks(world, box, 2, 0, sizeZ, sizeX - 1, 0, sizeZ, ModBlocks.concrete_smooth, Blocks.air, false); - fillWithBlocks(world, box, 1, 0, 2, 1, 0, sizeZ - 1, ModBlocks.concrete_smooth, Blocks.air, false); - - //Back Wall - fillWithRandomizedBlocks(world, box, 1, 1, 1, 2, sizeY - 1, 1, false, rand, ConcreteBricks); - fillWithRandomizedBlocks(world, box, 2, 1, 0, 5, sizeY - 1, 0, false, rand, ConcreteBricks); - fillWithRandomizedBlocks(world, box, 5, 1, 1, sizeX, sizeY - 1, 1, false, rand, ConcreteBricks); - //Front Wall - fillWithRandomizedBlocks(world, box, 1, 1, sizeZ, 2, sizeY - 1, sizeZ, false, rand, ConcreteBricks); - placeBlockAtCurrentPosition(world, ModBlocks.brick_concrete, 0, 3, sizeY - 1, sizeZ, box); - fillWithRandomizedBlocks(world, box, 4, 1, sizeZ, sizeX, sizeY - 1, sizeZ, false, rand, ConcreteBricks); - placeDoor(world, box, ModBlocks.door_metal, 3, 3, 1, sizeZ); - //Left & Right Wall - fillWithRandomizedBlocks(world, box, 1, 1, 2, 1, sizeY - 1, sizeZ - 1, false, rand, ConcreteBricks); - fillWithRandomizedBlocks(world, box, sizeX, 1, 2, sizeX, sizeY - 1, sizeZ - 1, false, rand, ConcreteBricks); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_glass, 0, 1, 2, 3, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_glass, 0, sizeX, 2, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_glass, 0, sizeX, 2, 4, box); - //Ceiling - fillWithBlocks(world, box, 3, sizeY - 1, 1, 4, sizeY - 1, 1, ModBlocks.concrete_smooth, Blocks.air, false); - fillWithBlocks(world, box, 2, sizeY - 1, 2, sizeX - 1, sizeY - 1, sizeZ - 1, ModBlocks.concrete_smooth, Blocks.air, false); - - fillWithAir(world, box, 2, 1, 2, sizeX - 1, 2, sizeZ - 1); - - //Decoration - int southMeta = getDecoMeta(2); - int northMeta = getDecoMeta(3); //all of these deco blocks are so inconsistent about what their directions actually are - int eastMeta = getDecoMeta(4); - fillWithMetadataBlocks(world, box, 2, 1, 2, 5, 1, 2, ModBlocks.steel_grate, 7, null, 0, false); //null should be okay here - fillWithBlocks(world, box, 3, 1, 1, 4, 1, 1, ModBlocks.deco_tungsten, null, false); - fillWithMetadataBlocks(world, box, 3, 2, 1, 4, 2, 1, ModBlocks.tape_recorder, northMeta, null, 0, false); - placeBlockAtCurrentPosition(world, ModBlocks.radiorec, southMeta, 2, 2, 2, box); - placeRandomBobble(world, box, rand, sizeX - 1, 2, 2); - fillWithMetadataBlocks(world, box, sizeX - 1, 1, 3, sizeX - 1, 2, 3, ModBlocks.tape_recorder, eastMeta, null, 0, false); - //OutsideDeco - fillWithMetadataBlocks(world, box, 0, 1, 2, 0, 2, 2, ModBlocks.steel_poles, eastMeta, null, 0, false); - placeBlockAtCurrentPosition(world, ModBlocks.pole_satellite_receiver, eastMeta, 0, sizeY - 1, 2, box); - fillWithBlocks(world, box, 0, sizeY, 2, sizeX - 1, sizeY, 2, ModBlocks.steel_roof, null, false); - placeBlockAtCurrentPosition(world, ModBlocks.steel_roof, 0, sizeX - 1, sizeY, 3, box); - - return false; - } - - } - - -} diff --git a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java index 32c5bf866..ee632225a 100644 --- a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java @@ -10,11 +10,17 @@ import com.hbm.world.worldgen.components.Component.ConcreteBricks; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; +import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraft.world.gen.structure.StructureBoundingBox; //Oh my fucking god TM public class OfficeFeatures { + public static void registerComponents() { + MapGenStructureIO.func_143031_a(LargeOffice.class, "NTMLargeOffice"); + MapGenStructureIO.func_143031_a(LargeOfficeCorner.class, "NTMLargeOfficeCorner"); + } + public static class LargeOffice extends Component { private static ConcreteBricks ConcreteBricks = new ConcreteBricks(); @@ -50,7 +56,7 @@ public class OfficeFeatures { public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { if(!this.setAverageHeight(world, box, this.boundingBox.minY)) { - return true; + return false; } this.boundingBox.offset(0, -1, 0); @@ -210,7 +216,7 @@ public class OfficeFeatures { //TODO: add book with funny lore to safe, add cobwebs too //0b00/0 West, 0b01/1 East, 0b10/2 North, 0b11/3 South, 0b100/4 West UD, 0b101 East UD, 0b110 North UD, 0b111 South UD - return false; + return true; } } @@ -234,7 +240,7 @@ public class OfficeFeatures { public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { if(!this.setAverageHeight(world, box, this.boundingBox.minY)) { - return true; + return false; } this.boundingBox.offset(0, -1, 0); @@ -539,7 +545,7 @@ public class OfficeFeatures { //this hurt my soul - return false; //TODO: whoopsy! this should probably be true, with the failed ones being false! not necessary here since the structures always generate in one chunk + return true; } } diff --git a/src/main/java/com/hbm/world/worldgen/components/RuinFeatures.java b/src/main/java/com/hbm/world/worldgen/components/RuinFeatures.java index 6ba87e6fc..a04e2ca2c 100644 --- a/src/main/java/com/hbm/world/worldgen/components/RuinFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/RuinFeatures.java @@ -6,10 +6,18 @@ import com.hbm.blocks.ModBlocks; import net.minecraft.init.Blocks; import net.minecraft.world.World; +import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraft.world.gen.structure.StructureBoundingBox; public class RuinFeatures { + public static void registerComponents() { + MapGenStructureIO.func_143031_a(NTMRuin1.class, "NTMRuin1"); + MapGenStructureIO.func_143031_a(NTMRuin2.class, "NTMRuin2"); + MapGenStructureIO.func_143031_a(NTMRuin3.class, "NTMRuin3"); + MapGenStructureIO.func_143031_a(NTMRuin4.class, "NTMRuin4"); + } + public static class NTMRuin1 extends Component { private static ConcreteBricks RandomConcreteBricks = new ConcreteBricks(); From ea6f1ffff0a755849f20f76743bd7014ee1f88b5 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sat, 5 Nov 2022 22:05:55 -0800 Subject: [PATCH 28/30] pr preparation --- .../java/com/hbm/items/tool/ItemWandD.java | 5 +- src/main/java/com/hbm/lib/HbmWorld.java | 2 - .../com/hbm/world/worldgen/MapGenBunker.java | 74 - .../worldgen/components/BunkerComponents.java | 2346 ----------------- 4 files changed, 2 insertions(+), 2425 deletions(-) delete mode 100644 src/main/java/com/hbm/world/worldgen/MapGenBunker.java delete mode 100644 src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java diff --git a/src/main/java/com/hbm/items/tool/ItemWandD.java b/src/main/java/com/hbm/items/tool/ItemWandD.java index 30cf65334..2aa3986a5 100644 --- a/src/main/java/com/hbm/items/tool/ItemWandD.java +++ b/src/main/java/com/hbm/items/tool/ItemWandD.java @@ -11,7 +11,6 @@ import com.hbm.items.special.ItemBookLore.BookLoreType; import com.hbm.items.special.ItemKitCustom; import com.hbm.lib.Library; import com.hbm.world.feature.OilSpot; -import com.hbm.world.worldgen.MapGenBunker; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; @@ -44,11 +43,11 @@ public class ItemWandD extends Item { player.inventoryContainer.detectAndSendChanges();*/ //use sparingly - int k = ((pos.blockX >> 4) << 4) + 8; + /*int k = ((pos.blockX >> 4) << 4) + 8; int l = ((pos.blockZ >> 4) << 4) + 8; MapGenBunker.Start start = new MapGenBunker.Start(world, world.rand, pos.blockX >> 4, pos.blockZ >> 4); - start.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124)); + start.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124));*/ //MapGenStronghold.Start startS = new MapGenStronghold.Start(world, world.rand, pos.blockX >> 4, pos.blockZ >> 4); //startS.generateStructure(world, world.rand, new StructureBoundingBox(k - 124, l - 124, k + 15 + 124, l + 15 + 124)); diff --git a/src/main/java/com/hbm/lib/HbmWorld.java b/src/main/java/com/hbm/lib/HbmWorld.java index 86f1b6a61..44bea3667 100644 --- a/src/main/java/com/hbm/lib/HbmWorld.java +++ b/src/main/java/com/hbm/lib/HbmWorld.java @@ -2,7 +2,6 @@ package com.hbm.lib; import com.hbm.world.worldgen.MapGenNTMFeatures; import com.hbm.world.worldgen.NTMWorldGenerator; -import com.hbm.world.worldgen.components.BunkerComponents; import com.hbm.world.worldgen.components.CivilianFeatures; import com.hbm.world.worldgen.components.OfficeFeatures; import com.hbm.world.worldgen.components.RuinFeatures; @@ -38,6 +37,5 @@ public class HbmWorld { CivilianFeatures.registerComponents(); OfficeFeatures.registerComponents(); RuinFeatures.registerComponents(); - BunkerComponents.registerComponents(); } } diff --git a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java b/src/main/java/com/hbm/world/worldgen/MapGenBunker.java deleted file mode 100644 index 079049bbe..000000000 --- a/src/main/java/com/hbm/world/worldgen/MapGenBunker.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.hbm.world.worldgen; - -import java.util.List; -import java.util.Random; - -import com.hbm.config.GeneralConfig; -import com.hbm.world.worldgen.components.BunkerComponents; -import com.hbm.world.worldgen.components.BunkerComponents.Atrium; -import com.hbm.world.worldgen.components.ProceduralComponents.ProceduralComponent; - -import net.minecraft.world.World; -import net.minecraft.world.gen.structure.MapGenStructure; -import net.minecraft.world.gen.structure.MapGenStructureIO; -import net.minecraft.world.gen.structure.StructureComponent; -import net.minecraft.world.gen.structure.StructureStart; - -public class MapGenBunker extends MapGenStructure { - - /** String ID for this MapGen */ - @Override - public String func_143025_a() { - return "NTMBunker"; - } - - @Override - protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) { - return false; - } - - @Override - protected StructureStart getStructureStart(int chunkX, int chunkZ) { - return new Start(this.worldObj, this.rand, chunkX, chunkZ); - } - - public static class Start extends StructureStart { - - public Start() { } - - public Start(World world, Random rand, int chunkX, int chunkZ) { - super(chunkX, chunkZ); - - BunkerComponents bunker = new BunkerComponents(); //oop is confusing sometimes - bunker.prepareComponents(); - - Atrium atrium = new Atrium(0, rand, (chunkX << 4) + 8, (chunkZ << 4) + 8); - this.components.add(atrium); - atrium.buildComponent(bunker, atrium, components, rand); - atrium.underwater = false;//rand.nextInt(2) == 0; - - List list = atrium.queuedComponents; - while(!list.isEmpty()) { - int k = rand.nextInt(list.size()); - ProceduralComponent component = (ProceduralComponent)list.remove(k); - atrium.lastComponent = component; - component.buildComponent(bunker, atrium, this.components, rand); - } - - if(GeneralConfig.enableDebugMode) { - System.out.print("[Debug] StructureStart at " + (chunkX * 16 + 8) + ", idfk lmao, " + (chunkZ * 16 + 8) + "\n[Debug] Components: "); - this.components.forEach((component) -> { - System.out.print(MapGenStructureIO.func_143036_a((StructureComponent) component) + " "); - }); - - System.out.print("\n"); - } - - this.updateBoundingBox(); - this.markAvailableHeight(world, rand, 10); - - System.out.print(this.boundingBox.minY); - } - - } -} diff --git a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java b/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java deleted file mode 100644 index 744a96d6a..000000000 --- a/src/main/java/com/hbm/world/worldgen/components/BunkerComponents.java +++ /dev/null @@ -1,2346 +0,0 @@ -package com.hbm.world.worldgen.components; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -import com.hbm.blocks.BlockDummyable; -import com.hbm.blocks.ModBlocks; -import com.hbm.lib.HbmChestContents; -import com.hbm.tileentity.network.TileEntityPylonBase; -import com.hbm.util.LootGenerator; -import com.hbm.world.worldgen.components.ProceduralComponents.ProceduralComponent; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import net.minecraft.world.gen.structure.MapGenStructureIO; -import net.minecraft.world.gen.structure.StructureBoundingBox; -import net.minecraft.world.gen.structure.StructureComponent; -import net.minecraftforge.common.util.ForgeDirection; - -public class BunkerComponents extends ProceduralComponents { - - public static void registerComponents() { - MapGenStructureIO.func_143031_a(Atrium.class, "NTMBAtrium"); - MapGenStructureIO.func_143031_a(Corridor.class, "NTMBCorridor"); - MapGenStructureIO.func_143031_a(WideCorridor.class, "NTMBWideCorridor"); - MapGenStructureIO.func_143031_a(Intersection.class, "NTMBIntersection"); - MapGenStructureIO.func_143031_a(WideIntersection.class, "NTMBWideIntersection"); - MapGenStructureIO.func_143031_a(DeadEnd.class, "NTMBDeadEnd"); - MapGenStructureIO.func_143031_a(CenterCrossing.class, "NTMBCenterCrossing"); - MapGenStructureIO.func_143031_a(UtilityCloset.class, "NTMBUtilityCloset"); - MapGenStructureIO.func_143031_a(SupplyRoom.class, "NTMBSupplyRoom"); - MapGenStructureIO.func_143031_a(WasteDisposal.class, "NTMBWasteDisposal"); - MapGenStructureIO.func_143031_a(Bedroom.class, "NTMBBedroom"); - MapGenStructureIO.func_143031_a(Reactor.class, "NTMBReactor"); - MapGenStructureIO.func_143031_a(RTG.class, "NTMBRTG"); - } - - public BunkerComponents() { - - //Pass each respective method as a method reference (::) to the weight constructors, in order to boost clarity - weightArray = new Weight[] { - new Weight(30, -1, Corridor::findValidPlacement), //Corridor and Wide version - new Weight(10, -1, Intersection::findValidPlacement), //Intersection and wide version - new Weight(5, 5, CenterCrossing::findValidPlacement), - new Weight(3, 5, UtilityCloset::findValidPlacement) { - public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { - return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors - } - }, - new Weight(8, 4, SupplyRoom::findValidPlacement) { - public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { - return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors - } - }, - new Weight(3, 3, WasteDisposal::findValidPlacement) { - public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { - return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors - } - }, - new Weight(10, 15, Bedroom::findValidPlacement) { - public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { - return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors - } - }, - new Weight(20, 1, Reactor::findValidPlacement) { - public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { - return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 4; //prevent the gimping of necessary corridors - } - }, - new Weight(20, 1, RTG::findValidPlacement) { - public boolean canSpawnStructure(int componentAmount, int coordMode, ProceduralComponent component) { - return (this.instanceLimit < 0 || this.instancesSpawned < this.instanceLimit) && componentAmount > 6; //prevent the gimping of necessary corridors - } - }, - }; - - sizeLimit = 100; - distanceLimit = 100; - } - - public static abstract class Bunker extends ProceduralComponent { - - boolean underwater = false; - - public Bunker() { } - - public Bunker(int componentType) { - super(componentType); - } - - public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { - checkModifiers(original); - } - - protected void checkModifiers(ControlComponent original) { - if(original instanceof Atrium) - this.underwater = ((Atrium) original).underwater; - } - - protected void placeLamp(World world, StructureBoundingBox box, Random rand, int featureX, int featureY, int featureZ) { - if(rand.nextInt(underwater ? 5 : 3) == 0) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_on, 0, featureX, featureY, featureZ, box); - placeBlockAtCurrentPosition(world, Blocks.redstone_block, 0, featureX, featureY + 1, featureZ, box); - } else - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_lamp_off, 0, featureX, featureY, featureZ, box); - } - - protected void fillWithWater(World world, StructureBoundingBox box, Random rand, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, int waterLevel) { - - if(getYWithOffset(minY) < box.minY || getYWithOffset(maxY) > box.maxY) - return; - - waterLevel += getYWithOffset(minY) - 1; - - for(int x = minX; x <= maxX; x++) { - - for(int z = minZ; z <= maxZ; z++) { - int posX = getXWithOffset(x, z); - int posZ = getZWithOffset(x, z); - - if(posX >= box.minX && posX <= box.maxX && posZ >= box.minZ && posZ <= box.maxZ) { - for(int y = minY; y <= maxY; y++) { - int posY = getYWithOffset(y); - Block genTarget = world.getBlock(posX, posY, posZ); - - if(!genTarget.isAir(world, posX, posY, posZ)) - continue; - - if(posY <= waterLevel && world.getBlock(posX, posY - 1, posZ).getMaterial() != Material.air) { - world.setBlock(posX, posY, posZ, Blocks.water, 0, 2); - continue; - } - - boolean canGenFluid = true; - boolean canGenPlant = false; - int canGenVine = -1; - - for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { - Block neighbor = world.getBlock(posX + dir.offsetX, posY + dir.offsetY, posZ + dir.offsetZ); - boolean isSolid = neighbor.isNormalCube(); - - switch(dir) { - case DOWN: if(neighbor == Blocks.water) canGenPlant = true; - if(!isSolid && neighbor != Blocks.water) canGenFluid = false; - break; - case UP: if(neighbor.getMaterial() != Material.air) canGenFluid = false; - if(isSolid) canGenVine = 0; - break; - case NORTH: if(isSolid) canGenVine |= 4; - if(!isSolid && neighbor != Blocks.water) canGenFluid = false; - break; - case SOUTH: if(isSolid) canGenVine |= 1; - if(!isSolid && neighbor != Blocks.water) canGenFluid = false; - break; - case EAST: if(isSolid) canGenVine |= 8; - if(!isSolid && neighbor != Blocks.water) canGenFluid = false; - break; - case WEST: if(isSolid) canGenVine |= 2; - if(!isSolid && neighbor != Blocks.water) canGenFluid = false; - break; - default: //shut the fuck up! - if(!isSolid && neighbor != Blocks.water) canGenFluid = false; - break; - } - } - - if(canGenFluid) - world.setBlock(posX, posY, posZ, Blocks.water); - else { - if(canGenVine >= 0) { - if(rand.nextInt(3) == 0) - canGenVine |= 1 << rand.nextInt(4); - - world.setBlock(posX, posY, posZ, Blocks.vine, canGenVine, 2); - - if(canGenVine > 0) { - int i = posY; - while(world.getBlock(posX, --i, posZ).getMaterial() == Material.air) - world.setBlock(posX, i, posZ, Blocks.vine, canGenVine, 2); - } - } - - if(canGenPlant) { - int value = rand.nextInt(2); - - if(value <= 0) { - int rY = posY + rand.nextInt(10) - rand.nextInt(10); - if(rY == posY) - world.setBlock(posX, posY, posZ, Blocks.waterlily, 0, 2); - } else if(value <= 1) { - int rY = posY + rand.nextInt(10) - rand.nextInt(10); - if(rY == posY) - world.setBlock(posX, posY, posZ, ModBlocks.reeds, 0, 2); - } - } - } - } - } - } - } - } - } - - public static class UtilityCloset extends Bunker { - - boolean energy = false; //if false, this is a water closet. if true, this is an energy closet - boolean hasLoot = false; - - public UtilityCloset() { } - - public UtilityCloset(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType); - this.coordBaseMode = coordBaseMode; - this.boundingBox = box; - - energy = rand.nextBoolean(); - hasLoot = rand.nextInt(3) == 0; - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else {*/ - - fillWithAir(world, box, 1, 1, 1, 3, 3, 2); - //Floor - placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 0, 2, 0, 0, box); - fillWithBlocks(world, box, 1, 0, 1, 3, 0, 2, ModBlocks.vinyl_tile); - //Wall - fillWithBlocks(world, box, 0, 1, 1, 0, 1, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 1, 0, 2, 2, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 1, 0, 3, 2, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 1, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 1, 2, 0, box); - fillWithBlocks(world, box, 1, 3, 0, 3, 3, 0, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 3, 1, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 3, 2, 0, box); - fillWithBlocks(world, box, 4, 1, 1, 4, 1, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 4, 2, 1, 4, 2, 2, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 4, 3, 1, 4, 3, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 1, 3, 3, 1, 3, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 3, 3, 2, 3, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 3, 3, 3, 3, ModBlocks.reinforced_brick); - //Ceiling - fillWithBlocks(world, box, 1, 4, 1, 3, 4, 2, ModBlocks.reinforced_brick); - - int decoMetaS = getDecoMeta(2); - int decoMetaN = getDecoMeta(3); - int decoMetaW = getDecoMeta(4); - - if(energy) { - placeBlockAtCurrentPosition(world, ModBlocks.red_wire_coated, 0, 0, 3, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.machine_transformer, 0, 1, 3, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.red_connector, getDecoMeta(5), 2, 3, 2, box); - fillWithMetadataBlocks(world, box, 2, 1, 2, 2, 2, 2, ModBlocks.red_connector, decoMetaW); - - makeConnection(world, 2, 3, 2, 2, 2, 2); - makeConnection(world, 2, 2, 2, 2, 1, 2); - - fillWithMetadataBlocks(world, box,3, 1, 1, 3, 2, 1, ModBlocks.steel_wall, decoMetaS); - placeBlockAtCurrentPosition(world, ModBlocks.steel_roof, 0, 3, 3, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.cable_diode, decoMetaS, 3, 1, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.cable_diode, decoMetaW, 3, 2, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.deco_red_copper, 0, 3, 1, 3, box); - placeBlockAtCurrentPosition(world, ModBlocks.deco_red_copper, 0, 4, 2, 2, box); - - int cabinetMeta = getDecoModelMeta(0) | 4; - if(hasLoot) - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, cabinetMeta, 1, 1, 2, HbmChestContents.machineParts, 4); - } else { - fillWithMetadataBlocks(world, box, 1, 1, 2, 2, 1, 2, ModBlocks.deco_pipe_quad_green_rusted, getPillarMeta(4)); - placeBlockAtCurrentPosition(world, ModBlocks.machine_boiler_off, decoMetaN, 3, 1, 2, box); - fillWithBlocks(world, box, 3, 2, 2, 3, 3, 2, ModBlocks.deco_pipe_rusted); - - int cabinetMeta = getDecoModelMeta(3) | 4; - if(hasLoot) - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, cabinetMeta, 1, 1, 1, HbmChestContents.machineParts, 4); - } - - //Door - placeDoor(world, box, ModBlocks.door_bunker, 1, 2, 1, 0); - - fillWithCobwebs(world, box, rand, 1, 1, 1, 3, 3, 2); - - return true; - //} - } - - protected void makeConnection(World world, int x1, int y1, int z1, int x2, int y2, int z2) { - int posX1 = getXWithOffset(x1, z1); - int posY1 = getYWithOffset(y1); - int posZ1 = getZWithOffset(x1, z1); - - int posX2 = getXWithOffset(x2, z2); - int posY2 = getYWithOffset(y2); - int posZ2 = getZWithOffset(x2, z2); - - TileEntity tile1 = world.getTileEntity(posX1, posY1, posZ1); - TileEntity tile2 = world.getTileEntity(posX2, posY2, posZ2); - if(tile1 instanceof TileEntityPylonBase && tile2 instanceof TileEntityPylonBase) { - TileEntityPylonBase pylon1 = (TileEntityPylonBase)tile1; - pylon1.addConnection(posX2, posY2, posZ2); - TileEntityPylonBase pylon2 = (TileEntityPylonBase)tile2; - pylon2.addConnection(posX1, posY1, posZ1); - } - } - - /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ - public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { - StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 5, 4, mode); - return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new UtilityCloset(type, rand, box, mode) : null; - } - } - - public static class SupplyRoom extends Bunker { - - BlockSelector crateSelector = new BlockSelector() { - public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { - float chance = rand.nextFloat(); - - if(chance < 0.001) - this.field_151562_a = ModBlocks.crate_red; - else if(chance < 0.05) - this.field_151562_a = ModBlocks.crate_ammo; - else if(chance < 0.10) - this.field_151562_a = ModBlocks.crate_metal; - else if(chance < 0.20) - this.field_151562_a = ModBlocks.crate_weapon; - else if(chance < 0.35) - this.field_151562_a = ModBlocks.crate; - else if(chance < 0.50) - this.field_151562_a = ModBlocks.crate_can; - else - this.field_151562_a = Blocks.air; - } - }; - - public SupplyRoom() { } - - public SupplyRoom(int componentType, Random rand, StructureBoundingBox box, int coordModeBase) { - super(componentType); - this.coordBaseMode = coordModeBase; - this.boundingBox = box; - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else {*/ - fillWithAir(world, box, 5, 1, 0, 7, 3, 0); - fillWithAir(world, box, 1, 1, 1, 11, 3, 11); - - //Floor - fillWithMetadataBlocks(world, box, 1, 0, 2, 1, 0, 10, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 2, 0, 1, 3, 0, 11, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 4, 0, 1, 4, 0, 11, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 5, 0, 0, 7, 0, 10, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 5, 0, 11, 7, 0, 11, ModBlocks.vinyl_tile, 1); - fillWithMetadataBlocks(world, box, 8, 0, 1, 8, 0, 11, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 9, 0, 1, 10, 0, 11, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 11, 0, 2, 11, 0, 10, ModBlocks.vinyl_tile, 1); - //Walls - fillWithBlocks(world, box, 2, 1, 0, 4, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 2, 2, 0, 4, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 2, 3, 0, 4, 3, 0, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 1, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 1, 2, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 3, 1, box); - fillWithBlocks(world, box, 0, 1, 2, 0, 1, 10, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 2, 0, 2, 10, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 2, 0, 3, 10, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 1, 11, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 1, 2, 11, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 3, 11, box); - fillWithBlocks(world, box, 2, 1, 12, 10, 1, 12, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 2, 2, 12, 10, 2, 12, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 2, 3, 12, 10, 3, 12, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 1, 0, 10, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 2, 0, 10, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 8, 3, 0, 10, 3, 0, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 11, 1, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 11, 2, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 11, 3, 1, box); - fillWithBlocks(world, box, 12, 1, 2, 12, 1, 10, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 12, 2, 2, 12, 2, 10, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 12, 3, 2, 12, 3, 10, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 11, 1, 11, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 11, 2, 11, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 11, 3, 11, box); - //Ceiling - int pillarMetaNS = getPillarMeta(8); - int pillarMetaWE = getPillarMeta(4); - - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 5, 4, 0, box); - fillWithBlocks(world, box, 2, 4, 1, 5, 4, 5, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 4, 2, 1, 4, 5, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 1, 4, 6, 5, 4, 6, ModBlocks.concrete_pillar, pillarMetaWE); - fillWithBlocks(world, box, 1, 4, 7, 1, 4, 10, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 2, 4, 7, 5, 4, 11, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 7, 4, 0, box); - fillWithBlocks(world, box, 7, 4, 1, 10, 4, 5, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 11, 4, 2, 11, 4, 5, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 7, 4, 6, 11, 4, 6, ModBlocks.concrete_pillar, pillarMetaWE); - fillWithBlocks(world, box, 11, 4, 7, 11, 4, 10, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 7, 4, 7, 10, 4, 11, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 7, 4, 0, box); - fillWithMetadataBlocks(world, box, 6, 4, 0, 6, 4, 2, ModBlocks.concrete_pillar, pillarMetaNS); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 5, 4, 0, box); - for(int i = 3; i <= 9; i += 3) { - placeLamp(world, box, rand, 6, 4, i); - fillWithMetadataBlocks(world, box, 6, 4, i + 1, 6, 4, i + 2, ModBlocks.concrete_pillar, pillarMetaNS); - } - //Shelves Right - for(int i = 1; i <= 11; i += i == 4 ? 4 : 3) { - if(i % 2 == 0) { - for(int j = 1; j <= 11; j += 10) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 1, j, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, i, 2, j, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 3, j, box); - } - } - - fillWithMetadataBlocks(world, box, i, 2, 2, i, 2, 4, ModBlocks.brick_slab, 8); //b100 = dense stone, top position - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 1, 5, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, i, 2, 5, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 3, 5, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 1, 7, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, i, 2, 7, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 3, 7, box); - fillWithMetadataBlocks(world, box, i, 2, 8, i, 2, 10, ModBlocks.brick_slab, 8); - //Crates - fillWithRandomizedBlocks(world, box, i, 1, 2, i, 1, 4, rand, crateSelector); - fillWithRandomizedBlocks(world, box, i, 3, 2, i, 3, 4, rand, crateSelector); - if(i % 2 != 0) { - placeBlockAtCurrentPosition(world, ModBlocks.brick_slab, 8, i, 2, 6, box); //middle shelf part - fillWithRandomizedBlocks(world, box, i, 1, 6, i, 1, 6, rand, crateSelector); - fillWithRandomizedBlocks(world, box, i, 3, 6, i, 3, 6, rand, crateSelector); - } - fillWithRandomizedBlocks(world, box, i, 1, 8, i, 1, 10, rand, crateSelector); - fillWithRandomizedBlocks(world, box, i, 3, 8, i, 3, 10, rand, crateSelector); - } - - fillWithMetadataBlocks(world, box, 5, 2, 11, 7, 2, 11, ModBlocks.brick_slab, 8); - generateInvContents(world, box, rand, ModBlocks.crate_iron, 6, 3, 11, HbmChestContents.machineParts, 10); - generateInvContents(world, box, rand, ModBlocks.crate_iron, 7, 1, 11, HbmChestContents.vault1, 8); - - if(underwater) { - fillWithWater(world, box, rand, 1, 1, 1, 11, 3, 11, 1); - fillWithWater(world, box, rand, 5, 1, 0, 7, 3, 0, 1); - } else - fillWithCobwebs(world, box, rand, 1, 1, 0, 11, 3, 11); - - return true; - //} - } - - /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ - public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { - StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -5, -1, 0, 13, 6, 13, mode); - return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new SupplyRoom(type, rand, box, mode) : null; - } - } - //what 'waste'? - public static class WasteDisposal extends Bunker { - - private static ConcreteBricks conBrick = new ConcreteBricks(); - private static ConcreteBricksStairs conBrickStairs = new ConcreteBricksStairs(); - private static ConcreteBricksSlabs conBrickSlabs = new ConcreteBricksSlabs(); - - public WasteDisposal() { } - - public WasteDisposal(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType); - this.coordBaseMode = coordBaseMode; - this.boundingBox = box; - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else {*/ - fillWithAir(world, box, 1, 1, 1, 7, 3, 7); - - //Floor - placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 4, 0, 0, box); - fillWithBlocks(world, box, 1, 0, 1, 1, 0, 2, ModBlocks.concrete_brick_slab); - fillWithBlocks(world, box, 1, 0, 3, 1, 0, 7, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 2, 0, 1, 2, 0, 7, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 3, 0, 1, 5, 0, 3, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 3, 0, 4, 5, 0, 4, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 3, 0, 5, 5, 0, 7, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 6, 0, 1, 6, 0, 7, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 7, 0, 1, 7, 0, 2, ModBlocks.concrete_brick_slab); - fillWithBlocks(world, box, 7, 0, 3, 7, 0, 7, ModBlocks.vinyl_tile); - //Wall - fillWithBlocks(world, box, 1, 0, 0, 1, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 2, 1, 0, 3, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 0, 3, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 7, 0, 0, 7, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 5, 1, 0, 6, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 5, 2, 0, 7, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 0, 7, 3, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 0, 1, 0, 1, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 1, 3, 0, 1, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 1, 0, 2, 7, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 1, 0, 3, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 1, 8, 7, 1, 8, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 8, 7, 2, 8, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 8, 7, 3, 8, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 1, 3, 8, 1, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 0, 1, 8, 1, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 2, 1, 8, 2, 7, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 8, 3, 1, 8, 3, 7, ModBlocks.reinforced_brick); - //Ceiling - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 4, 1, box); - fillWithBlocks(world, box, 1, 4, 1, 3, 4, 7, ModBlocks.reinforced_brick); - placeLamp(world, box, rand, 4, 4, 2); - fillWithBlocks(world, box, 4, 4, 3, 4, 4, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 5, 4, 1, 7, 4, 7, ModBlocks.reinforced_brick); - //Decorations - fillWithMetadataBlocks(world, box, 1, 1, 1, 1, 1, 2, ModBlocks.steel_grate, 7); - placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, getDecoMeta(3), 1, 1, 3, box); - placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, getDecoMeta(2), 1, 1, 5, box); - fillWithMetadataBlocks(world, box, 1, 1, 6, 1, 1, 7, ModBlocks.steel_grate, 7); - generateInvContents(world, box, rand, ModBlocks.crate_iron, 1, 2, 7, HbmChestContents.filingCabinet, 10); - fillWithMetadataBlocks(world, box, 7, 1, 1, 7, 1, 2, ModBlocks.steel_grate, 7); - placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, getDecoMeta(3), 7, 1, 3, box); - if(rand.nextInt(3) == 0) placeRandomBobble(world, box, rand, 7, 2, 1); - //Cremator - int pillarMetaWE = getPillarMeta(4); - - //fillWithMetadataBlocks(world, box, 3, 1, 5, 5, 1, 7, ModBlocks.heater_firebox, 4); - //placeholder, but how the hell am i to guarantee that this multiblock shit won't spill into unloaded chunks? - fillWithBlocks(world, box, 3, 1, 5, 3, 1, 7, ModBlocks.brick_fire); - fillWithMetadataBlocks(world, box, 4, 1, 5, 4, 1, 6, ModBlocks.brick_slab, 6); - placeBlockAtCurrentPosition(world, ModBlocks.brick_fire, 0, 4, 1, 7, box); - fillWithBlocks(world, box, 5, 1, 5, 5, 1, 7, ModBlocks.brick_fire); - //i genuinely cannot be bothered to go to the effort of block selectors for the stairs n shit - fillWithRandomizedBlocksMeta(world, box, 3, 2, 5, 3, 2, 6, rand, conBrickStairs, getStairMeta(1)); - fillWithRandomizedBlocksMeta(world, box, 3, 2, 7, 3, 2, 7, rand, conBrickStairs, getStairMeta(2)); - fillWithRandomizedBlocksMeta(world, box, 4, 2, 5, 4, 2, 5, rand, conBrickSlabs, 0); - fillWithRandomizedBlocksMeta(world, box, 4, 2, 7, 4, 2, 7, rand, conBrickStairs, getStairMeta(2)); - fillWithRandomizedBlocksMeta(world, box, 5, 2, 5, 5, 2, 6, rand, conBrickStairs, getStairMeta(0)); - fillWithRandomizedBlocksMeta(world, box, 5, 2, 7, 5, 2, 7, rand, conBrickStairs, getStairMeta(2)); - fillWithRandomizedBlocks(world, box, 3, 3, 5, 3, 3, 7, rand, conBrick); - fillWithRandomizedBlocksMeta(world, box, 4, 3, 5, 4, 3, 5, rand, conBrickSlabs, 8); - fillWithRandomizedBlocks(world, box, 4, 3, 7, 4, 3, 7, rand, conBrick); - fillWithRandomizedBlocks(world, box, 5, 3, 5, 5, 3, 7, rand, conBrick); - fillWithMetadataBlocks(world, box, 1, 3, 6, 2, 3, 6, ModBlocks.deco_pipe_quad_rusted, pillarMetaWE); - fillWithMetadataBlocks(world, box, 6, 3, 6, 7, 3, 6, ModBlocks.deco_pipe_quad_rusted, pillarMetaWE); - placeDoor(world, box, ModBlocks.door_bunker, 1, 4, 1, 0); - - if(underwater) { //against all odds, building remains unflooded - fillWithWater(world, box, rand, 1, 1, 1, 7, 3, 7, 0); - } else { - fillWithCobwebs(world, box, rand, 1, 1, 1, 7, 3, 7); - } - - return true; - //} - } - - /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ - public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { - StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); - return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new WasteDisposal(type, rand, box, mode) : null; - } - } - - public static class Bedroom extends Bunker { - - int decorationType = 0; - - public Bedroom() { } - - public Bedroom(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType); - this.coordBaseMode = coordBaseMode; - this.boundingBox = box; - this.decorationType = rand.nextInt(4); - } - - protected void func_143012_a(NBTTagCompound data) { - super.func_143012_a(data); - data.setInteger("decoration", decorationType); - } - - protected void func_143011_b(NBTTagCompound data) { - super.func_143011_b(data); - decorationType = data.getInteger("decoration"); - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - - /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else {*/ - fillWithAir(world, box, 1, 1, 1, 6, 3, 8); - - //Floor - placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 2, 0, 0, box); - fillWithMetadataBlocks(world, box, 1, 0, 1, 6, 0, 8, ModBlocks.vinyl_tile, 1); - //Wall - fillWithBlocks(world, box, 3, 1, 0, 6, 1, 0, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 1, 0, box); - fillWithBlocks(world, box, 3, 2, 0, 6, 3, 0, ModBlocks.concrete_colored); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_colored, 0, 2, 3, 0, box); - fillWithBlocks(world, box, 1, 2, 0, 1, 3, 0, ModBlocks.concrete_colored); - fillWithBlocks(world, box, 0, 1, 1, 0, 1, 8, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 1, 0, 3, 8, ModBlocks.concrete_colored); - fillWithBlocks(world, box, 1, 1, 9, 6, 1, 9, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 9, 3, 3, 9, ModBlocks.concrete_colored); - fillWithBlocks(world, box, 4, 2, 9, 6, 2, 9, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 4, 3, 9, 6, 3, 9, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 7, 1, 1, 7, 1, 8, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 7, 2, 1, 7, 3, 4, ModBlocks.concrete_colored); - fillWithBlocks(world, box, 7, 2, 5, 7, 2, 8, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 7, 3, 5, 7, 3, 8, ModBlocks.reinforced_brick); - //Interior Wall - fillWithBlocks(world, box, 5, 1, 5, 6, 1, 5, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 5, 2, 5, 6, 3, 5, ModBlocks.concrete_colored); - fillWithBlocks(world, box, 4, 1, 6, 4, 1, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 4, 2, 6, 4, 3, 7, ModBlocks.concrete_colored); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_colored, 0, 4, 3, 8, box); - //Ceiling - fillWithBlocks(world, box, 1, 4, 1, 6, 4, 1, ModBlocks.concrete); - for(int i = 1; i <= 4; i += 3) { - fillWithBlocks(world, box, i, 4, 2, i, 4, 3, ModBlocks.concrete); - placeLamp(world, box, rand, i + 1, 4, 2); - placeLamp(world, box, rand, i + 1, 4, 3); - fillWithBlocks(world, box, i + 2, 4, 2, i + 2, 4, 3, ModBlocks.concrete); - } - fillWithBlocks(world, box, 1, 4, 4, 1, 4, 8, ModBlocks.concrete); - fillWithBlocks(world, box, 2, 4, 4, 2, 4, 6, ModBlocks.concrete); - placeLamp(world, box, rand, 2, 4, 7); - fillWithBlocks(world, box, 2, 4, 8, 4, 4, 8, ModBlocks.concrete); - fillWithBlocks(world, box, 3, 4, 4, 4, 4, 7, ModBlocks.concrete); - fillWithBlocks(world, box, 5, 4, 4, 6, 4, 5, ModBlocks.concrete); - fillWithBlocks(world, box, 5, 4, 6, 5, 4, 8, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 6, 4, 6, box); - placeLamp(world, box, rand, 6, 4, 7); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 6, 4, 8, box); - - //Decorations - int stairMetaW = getStairMeta(0); - int stairMetaE = getStairMeta(1); - int stairMetaN = getStairMeta(2); - int stairMetaS = getStairMeta(3); - - //Bathroom - placeDoor(world, box, ModBlocks.door_metal, 4, 4, 1, 8); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 5, 1, 6, box); - placeBlockAtCurrentPosition(world, Blocks.cauldron, 0, 6, 1, 6, box); - placeBlockAtCurrentPosition(world, Blocks.tripwire_hook, getTripwireMeta(0), 6, 2, 6, box); - placeBlockAtCurrentPosition(world, Blocks.hopper, getDecoMeta(3), 6, 1, 8, box); - placeBlockAtCurrentPosition(world, Blocks.trapdoor, getDecoModelMeta(0), 6, 2, 8, box); - //Furnishing - switch(this.decorationType) { - case 0: - placeBed(world, box, 2, 4, 1, 2); - placeBed(world, box, 2, 5, 1, 2); - fillWithMetadataBlocks(world, box, 6, 1, 1, 6, 1, 4, ModBlocks.concrete_slab, 9); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, 5, 1, 4, box); - placeBlockAtCurrentPosition(world, ModBlocks.radiorec, getDecoMeta(5), 6, 2, 1, box); - if(rand.nextInt(2) == 0) placeRandomBobble(world, box, rand, 6, 2, 3); - placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(2), 6, 2, 4, box); - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(4), 4, 1, 5, HbmChestContents.bedroom1, 8); - //Kitchen - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaS | 4, 1, 1, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaN | 4, 1, 1, 3, box); - placeBlockAtCurrentPosition(world, ModBlocks.machine_electric_furnace_off, getDecoMeta(5), 1, 1, 4, box); - fillWithMetadataBlocks(world, box, 1, 3, 2, 1, 3, 4, ModBlocks.reinforced_brick_stairs, stairMetaE); - //Dining Table - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, 1, 1, 6, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaW | 4, 2, 1, 7, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 1, 1, 7, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 1, 1, 8, box); - break; - case 1: - placeBed(world, box, 1, 2, 1, 3); - placeBed(world, box, 1, 2, 1, 4); - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(7), 1, 1, 2, HbmChestContents.bedroom2, 8); - placeBlockAtCurrentPosition(world, ModBlocks.hev_battery, 0, 1, 2, 2, box); - //Desk - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaS | 4, 1, 1, 5, box); - fillWithMetadataBlocks(world, box, 1, 1, 6, 1, 1, 7, ModBlocks.concrete_slab, 9); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaN | 4, 1, 1, 8, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, 2, 1, 6, box); - placeBlockAtCurrentPosition(world, ModBlocks.tape_recorder, getDecoMeta(5), 1, 2, 6, box); - placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(3), 1, 2, 7, box); - //Kitchen - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaE | 4, 4, 1, 1, box); - fillWithMetadataBlocks(world, box, 5, 1, 1, 6, 1, 1, ModBlocks.brick_slab, 9); - placeBlockAtCurrentPosition(world, ModBlocks.brick_slab, 9, 6, 1, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaN | 4, 6, 1, 3, box); - placeBlockAtCurrentPosition(world, ModBlocks.machine_electric_furnace_off, getDecoMeta(4), 6, 1, 4, box); - fillWithMetadataBlocks(world, box, 6, 3, 1, 6, 3, 4, ModBlocks.reinforced_brick_stairs, stairMetaW); - placeBlockAtCurrentPosition(world, ModBlocks.machine_microwave, getDecoMeta(3), 5, 2, 1, box); - if(rand.nextInt(2) == 0) placeRandomBobble(world, box, rand, 6, 2, 2); - break; - case 2: - placeBed(world, box, 2, 5, 1, 3); - placeBed(world, box, 2, 6, 1, 3); - //Desk - placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 4, 1, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaS | 4, 5, 1, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 6, 1, 1, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 4, 1, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(1), 4, 2, 1, box); - placeBlockAtCurrentPosition(world, Blocks.flower_pot, 3 + rand.nextInt(4), 5, 2, 1, box); - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(5), 6, 2, 1, HbmChestContents.officeTrash, 4); - //Dining Table - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, 1, 1, 2, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 1, 1, 4, box); - placeBlockAtCurrentPosition(world, Blocks.fence, 0, 1, 1, 3, box); - placeBlockAtCurrentPosition(world, Blocks.heavy_weighted_pressure_plate, 0, 1, 2, 3, box); - //Kitchen - placeBlockAtCurrentPosition(world, ModBlocks.machine_electric_furnace_off, getDecoMeta(5), 1, 1, 8, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_slab, 9, 1, 1, 7, box); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaS | 4, 1, 1, 6, box); - fillWithMetadataBlocks(world, box, 1, 3, 6, 1, 3, 8, ModBlocks.reinforced_brick_stairs, stairMetaE); - // - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(6), 3, 1, 6, HbmChestContents.bedroom3, 6); //TODO: add bedroom3 - if(rand.nextInt(2) == 0) placeRandomBobble(world, box, rand, 3, 2, 6); - break; - case 3: - placeBed(world, box, 1, 2, 1, 7); - placeBed(world, box, 1, 2, 1, 8); - //Kitchen & Nightstand - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaE | 4, 1, 1, 6, box); - placeBlockAtCurrentPosition(world, ModBlocks.radiorec, getDecoMeta(4), 1, 2, 6, box); - placeBlockAtCurrentPosition(world, ModBlocks.machine_electric_furnace_off, getDecoMeta(5), 1, 1, 4, box); - fillWithMetadataBlocks(world, box, 1, 1, 2, 1, 1, 3, ModBlocks.concrete_slab, 9); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaS | 4, 1, 1, 1, box); - fillWithMetadataBlocks(world, box, 1, 3, 1, 1, 3, 4, ModBlocks.reinforced_brick_stairs, stairMetaE); - //Workspace - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaE | 4, 4, 1, 1, box); - fillWithMetadataBlocks(world, box, 5, 1, 1, 6, 1, 1, ModBlocks.concrete_slab, 9); - fillWithMetadataBlocks(world, box, 6, 1, 2, 6, 1, 3, ModBlocks.concrete_slab, 9); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_stairs, stairMetaN | 4, 6, 1, 4, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 5, 1, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(0), 5, 1, 4, box); - if(rand.nextInt(2) == 0) placeRandomBobble(world, box, rand, 4, 1, 4); - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(6), 6, 2, 3, HbmChestContents.bedroom4, 6); - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(6), 6, 2, 4, HbmChestContents.bedroom4, 6); - placeBlockAtCurrentPosition(world, ModBlocks.deco_loot, 0, 5, 2, 1, box); //TODO: change LootGenerator to use a proper 'registry' instead of cumbersome methods - LootGenerator.lootMakeshiftGun(world, getXWithOffset(5, 1), getYWithOffset(2), getZWithOffset(5, 1)); - break; - } - - - placeDoor(world, box, ModBlocks.door_metal, 1, 2, 1, 0); - - if(underwater) { //against all odds, building remains unflooded - fillWithWater(world, box, rand, 1, 1, 1, 6, 3, 8, 0); - } else { - fillWithCobwebs(world, box, rand, 1, 1, 1, 6, 3, 8); - } - - return true; - //} - } - - /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ - public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { - StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 8, 6, 10, mode); - return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new Bedroom(type, rand, box, mode) : null; - } - } - - //This one will be a doozy - public static class Reactor extends Bunker { - - boolean destroyed = false; - - static BlockSelector coriumSelector = new BlockSelector() { - public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { - float chance = rand.nextFloat(); - - if(chance < 0.10) - this.field_151562_a = ModBlocks.block_corium; - else if(chance < 0.70) - this.field_151562_a = ModBlocks.block_corium_cobble; - else - this.field_151562_a = Blocks.gravel; - } - }; - - private static ConcreteBricks conBrick = new ConcreteBricks(); - private static ConcreteBricksStairs conBrickStairs = new ConcreteBricksStairs(); - - public Reactor() { } - - public Reactor(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType); - this.coordBaseMode = coordBaseMode; - this.boundingBox = box; - } - - protected void func_143012_a(NBTTagCompound data) { - super.func_143012_a(data); - data.setBoolean("destroyed", destroyed); - } - - protected void func_143011_b(NBTTagCompound data) { - super.func_143011_b(data); - destroyed = data.getBoolean("destroyed"); - } - - @Override - public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { - checkModifiers(original); - - destroyed = underwater ? rand.nextInt(5) == 0 : false; - //destroyed = true; - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - - /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else {*/ - fillWithAir(world, box, 5, 2, 0, 7, 4, 0); - fillWithAir(world, box, 3, 1, 3, 9, 1, 9); - fillWithAir(world, box, 1, 2, 1, 11, 7, 11); - fillWithAir(world, box, 12, 2, 3, 14, 4, 7); - //Floor - fillWithBlocks(world, box, 3, 0, 3, 9, 0, 9, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 5, 1, 0, 7, 1, 0, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 1, 1, 1, 11, 1, 1, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 3, 1, 2, 10, 1, 2, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 1, 1, 2, 1, 1, 10, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 2, 1, 2, 2, 1, 10, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 1, 1, 11, 11, 1, 11, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 3, 1, 10, 10, 1, 10, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 11, 1, 2, 11, 1, 10, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 10, 1, 3, 10, 1, 9, ModBlocks.vinyl_tile, 1); - fillWithMetadataBlocks(world, box, 13, 1, 3, 14, 1, 7, ModBlocks.vinyl_tile, 1); - fillWithMetadataBlocks(world, box, 12, 1, 5, 12, 1, 7, ModBlocks.vinyl_tile, 1); - //Walls - fillWithBlocks(world, box, 1, 2, 0, 4, 2, 0, ModBlocks.reinforced_brick); //jesus christ - fillWithBlocks(world, box, 1, 3, 0, 4, 3, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 4, 0, 4, 4, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 2, 0, 11, 2, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 3, 0, 11, 3, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 8, 4, 0, 11, 4, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 5, 0, 11, 7, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 1, 0, 2, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 3, 1, 0, 3, 11, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 4, 1, 0, 7, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 12, 11, 2, 12, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 3, 12, 11, 3, 12, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 4, 12, 11, 7, 12, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 12, 2, 8, 12, 2, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 12, 3, 8, 12, 3, 11, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 12, 2, 1, 12, 2, 4, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 12, 3, 1, 12, 3, 4, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 12, 4, 1, 12, 7, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 13, 2, 8, 14, 2, 8, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 13, 3, 8, 14, 3, 8, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 13, 4, 8, 14, 4, 8, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 15, 2, 3, 15, 2, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 15, 3, 3, 15, 3, 7, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 15, 4, 3, 15, 4, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 14, 2, 2, 14, 4, 2, ModBlocks.red_wire_coated); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 13, 2, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 13, 3, 2, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 13, 4, 2, box); - //Ceiling - fillWithBlocks(world, box, 1, 8, 1, 11, 8, 4, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 8, 5, 4, 8, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 8, 8, 11, 8, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 8, 5, 11, 8, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 13, 5, 3, 14, 5, 7, ModBlocks.reinforced_brick); - for(int i = 5; i <= 7; i++) { - for(int j = 5; j <= 7; j++) { - if(i != 6 && j != 6 || i == 6 && j == 6) placeLamp(world, box, rand, i, 8, j); - else placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, i, 8, j, box); - } - } - - //Reactor Casing - int decoMetaS = getDecoMeta(2); - int decoMetaN = getDecoMeta(3); - int decoMetaE = getDecoMeta(4); - int decoMetaW = getDecoMeta(5); - for(int i = 4; i <= 8; i += 4) { - for(int j = 4; j <= 8; j += 4) { - placeBlockAtCurrentPosition(world, ModBlocks.steel_scaffold, decoMetaN, i, 1, j, box); - fillWithMetadataBlocks(world, box, i, 5, j, i, 7, j, ModBlocks.steel_scaffold, decoMetaN); - } - } - int stairMetaW = getStairMeta(0); - int stairMetaE = getStairMeta(1); - int stairMetaN = getStairMeta(2); - int stairMetaS = getStairMeta(3); - fillWithBlocks(world, box, 6, 1, 5, 6, 1, 7, ModBlocks.deco_pipe_quad_rusted); - fillWithBlocks(world, box, 6, 2, 5, 6, 2, 7, ModBlocks.reactor_conductor); - fillWithRandomizedBlocks(world, box, 4, 2, 5, 5, 2, 7, rand, conBrick); - fillWithRandomizedBlocks(world, box, 5, 2, 4, 7, 2, 4, rand, conBrick); - fillWithRandomizedBlocks(world, box, 5, 2, 8, 7, 2, 8, rand, conBrick); - fillWithRandomizedBlocks(world, box, 7, 2, 5, 8, 2, 7, rand, conBrick); - fillWithRandomizedBlocksMeta(world, box, 5, 2, 3, 7, 2, 3, rand, conBrickStairs, stairMetaN | 4); - fillWithRandomizedBlocks(world, box, 5, 3, 3, 7, 4, 3, rand, conBrick); - fillWithRandomizedBlocks(world, box, 4, 2, 4, 4, 4, 4, rand, conBrick); - fillWithRandomizedBlocksMeta(world, box, 3, 2, 5, 3, 2, 7, rand, conBrickStairs, stairMetaW | 4); - fillWithRandomizedBlocks(world, box, 3, 3, 5, 3, 4, 7, rand, conBrick); - fillWithRandomizedBlocks(world, box, 4, 2, 8, 4, 4, 8, rand, conBrick); - fillWithRandomizedBlocksMeta(world, box, 5, 2, 9, 7, 2, 9, rand, conBrickStairs, stairMetaS | 4); - fillWithRandomizedBlocks(world, box, 5, 3, 9, 7, 4, 9, rand, conBrick); - fillWithRandomizedBlocks(world, box, 8, 2, 8, 8, 4, 8, rand, conBrick); - fillWithRandomizedBlocksMeta(world, box, 9, 2, 5, 9, 2, 7, rand, conBrickStairs, stairMetaE | 4); - fillWithRandomizedBlocks(world, box, 9, 3, 5, 9, 4, 7, rand, conBrick); - fillWithRandomizedBlocks(world, box, 8, 2, 4, 8, 4, 4, rand, conBrick); - //Reactor Core - for(int i = 4; i <= 8; i += 1) { - for(int j = 4; j <= 8; j += 1) { - if((i == 4 || i == 8) && (j == 4 || j == 8)) continue; - - int check = i % 2 == 0 ? 0 : 1; - if(j % 2 == check) - placeBlockAtCurrentPosition(world, ModBlocks.reactor_control, 0, i, 3, j, box); - else { - Block choice = i < 5 || i > 7 || j < 5 || j > 7 ? ModBlocks.reactor_element : ModBlocks.machine_generator; - placeBlockAtCurrentPosition(world, choice, 0, i, 3, j, box); - } - } - } - - if(destroyed) { - randomlyFillWithBlocks(world, box, rand, 0.20F, 4, 4, 4, 8, 4, 8, Blocks.gravel); - fillWithRandomizedBlocks(world, box, 5, 1, 4, 7, 3, 8, rand, coriumSelector); - fillWithRandomizedBlocks(world, box, 4, 1, 5, 4, 3, 7, rand, coriumSelector); - fillWithRandomizedBlocks(world, box, 8, 1, 5, 8, 3, 7, rand, coriumSelector); - } else { - //Reactor Shield/Top - fillWithBlocks(world, box, 5, 4, 4, 7, 4, 8, ModBlocks.glass_lead); - fillWithBlocks(world, box, 4, 4, 5, 4, 4, 7, ModBlocks.glass_lead); - fillWithBlocks(world, box, 8, 4, 5, 8, 4, 7, ModBlocks.glass_lead); - fillWithBlocks(world, box, 5, 5, 4, 7, 5, 8, ModBlocks.steel_roof); - fillWithBlocks(world, box, 4, 5, 5, 4, 5, 7, ModBlocks.steel_roof); - fillWithBlocks(world, box, 8, 5, 5, 8, 5, 7, ModBlocks.steel_roof); - } - - //Scaffolding - //Grates - for(int i = 4; i <= 9; i++) { //Steps - int meta = i % 2 == 0 ? 3 : 7; - placeBlockAtCurrentPosition(world, ModBlocks.steel_grate, meta, 1, i / 2, i, box); - } - fillWithMetadataBlocks(world, box, 2, 4, 8, 3, 4, 9, ModBlocks.steel_grate, 7); - placeBlockAtCurrentPosition(world, ModBlocks.steel_grate, 7, 4, 4, 9, box); - fillWithMetadataBlocks(world, box, 3, 4, 1, 9, 4, 2, ModBlocks.steel_grate, 7); - fillWithMetadataBlocks(world, box, 3, 4, 3, 4, 4, 3, ModBlocks.steel_grate, 7); - placeBlockAtCurrentPosition(world, ModBlocks.steel_grate, 7, 3, 4, 4, box); - fillWithMetadataBlocks(world, box, 8, 4, 3, 9, 4, 3, ModBlocks.steel_grate, 7); - placeBlockAtCurrentPosition(world, ModBlocks.steel_grate, 7, 9, 4, 4, box); - //Barriers - fillWithMetadataBlocks(world, box, 3, 5, 1, 3, 5, 7, ModBlocks.steel_wall, decoMetaW); - placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaN, 2, 5, 8, box); - fillWithMetadataBlocks(world, box, 1, 5, 9, 7, 5, 9, ModBlocks.steel_wall, decoMetaS); - placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaW, 8, 5, 9, box); - fillWithMetadataBlocks(world, box, 9, 5, 1, 9, 5, 7, ModBlocks.steel_wall, decoMetaE); - placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaN, 9, 5, 8, box); - //Decoration - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, stairMetaE | 4, 4, 5, 1, box); - fillWithMetadataBlocks(world, box, 5, 5, 1, 7, 5, 1, ModBlocks.brick_slab, 9); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, stairMetaW | 4, 8, 5, 1, box); - fillWithMetadataBlocks(world, box, 4, 6, 1, 5, 6, 1, ModBlocks.tape_recorder, decoMetaN); - placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(1), 7, 6, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.geiger, decoMetaS, 6, 6, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.machine_storage_drum, 0, 4, 5, 3, box); - placeRandomBobble(world, box, rand, 4, 6, 3); - placeBlockAtCurrentPosition(world, ModBlocks.machine_storage_drum, 0, 1, 2, 11, box); - placeBlockAtCurrentPosition(world, ModBlocks.machine_storage_drum, 0, 9, 2, 10, box); - placeBlockAtCurrentPosition(world, ModBlocks.machine_storage_drum, 0, 11, 2, 9, box); - placeBlockAtCurrentPosition(world, ModBlocks.machine_storage_drum, 0, 11, 2, 11, box); - //Turbines/Transformers - placeBlockAtCurrentPosition(world, ModBlocks.machine_turbine, 0, 14, 2, 6, box); - placeBlockAtCurrentPosition(world, ModBlocks.deco_pipe_quad_rusted, getPillarMeta(8), 14, 2, 7, box); - placeBlockAtCurrentPosition(world, ModBlocks.machine_turbine, 0, 14, 4, 6, box); - placeBlockAtCurrentPosition(world, ModBlocks.deco_pipe_quad_rusted, getPillarMeta(8), 14, 4, 7, box); - placeBlockAtCurrentPosition(world, ModBlocks.deco_pipe_rim_rusted, 0, 14, 3, 6, box); - placeBlockAtCurrentPosition(world, ModBlocks.red_connector, decoMetaE, 13, 2, 6, box); - placeBlockAtCurrentPosition(world, ModBlocks.red_connector, decoMetaE, 13, 4, 6, box); - placeBlockAtCurrentPosition(world, ModBlocks.red_connector, decoMetaN, 13, 3, 4, box); - makeConnection(world, 13, 2, 6, 13, 3, 4); - makeConnection(world, 13, 4, 6, 13, 3, 4); - fillWithMetadataBlocks(world, box, 13, 2, 3, 13, 3, 3, ModBlocks.machine_battery, decoMetaN); - fillWithMetadataBlocks(world, box, 14, 2, 3, 14, 3, 3, ModBlocks.cable_diode, decoMetaN); - - generateInvContents(world, box, rand, ModBlocks.crate_iron, 8, 5, 3, HbmChestContents.nuclear, 10); - generateInvContents(world, box, rand, ModBlocks.crate_iron, 10, 2, 1, HbmChestContents.nuclearFuel, 12); - - if(underwater) { - fillWithWater(world, box, rand, 5, 2, 0, 7, 4, 0, 1); - fillWithWater(world, box, rand, 1, 1, 1, 11, 7, 11, 2); - fillWithWater(world, box, rand, 12, 2, 3, 14, 4, 7, 1); - } else { - fillWithCobwebs(world, box, rand, 1, 1, 0, 11, 7, 11); - fillWithCobwebs(world, box, rand, 12, 2, 3, 14, 4, 7); - } - - return true; - //} - } - - protected void makeConnection(World world, int x1, int y1, int z1, int x2, int y2, int z2) { - int posX1 = getXWithOffset(x1, z1); - int posY1 = getYWithOffset(y1); - int posZ1 = getZWithOffset(x1, z1); - - int posX2 = getXWithOffset(x2, z2); - int posY2 = getYWithOffset(y2); - int posZ2 = getZWithOffset(x2, z2); - - TileEntity tile1 = world.getTileEntity(posX1, posY1, posZ1); - TileEntity tile2 = world.getTileEntity(posX2, posY2, posZ2); - if(tile1 instanceof TileEntityPylonBase && tile2 instanceof TileEntityPylonBase) { - TileEntityPylonBase pylon1 = (TileEntityPylonBase)tile1; - pylon1.addConnection(posX2, posY2, posZ2); - TileEntityPylonBase pylon2 = (TileEntityPylonBase)tile2; - pylon2.addConnection(posX1, posY1, posZ1); - } - } - - /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ - public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { - StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -5, -2, 0, 16, 10, 13, mode); - return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new Reactor(type, rand, box, mode) : null; - } - } - - public static class RTG extends Bunker { - - public RTG() { } - - public RTG(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType); - this.coordBaseMode = coordBaseMode; - this.boundingBox = box; - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - - /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else {*/ - fillWithAir(world, box, 4, 1, 0, 6, 3, 0); - fillWithAir(world, box, 1, 1, 1, 9, 3, 9); - - //Floor - fillWithMetadataBlocks(world, box, 4, 0, 0, 6, 0, 0, ModBlocks.vinyl_tile, 1); - fillWithMetadataBlocks(world, box, 1, 0, 1, 9, 0, 1, ModBlocks.vinyl_tile, 1); - fillWithMetadataBlocks(world, box, 1, 0, 2, 1, 0, 8, ModBlocks.vinyl_tile, 1); - fillWithMetadataBlocks(world, box, 1, 0, 9, 9, 0, 9, ModBlocks.vinyl_tile, 1); - fillWithMetadataBlocks(world, box, 9, 0, 2, 9, 0, 8, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 2, 0, 2, 8, 0, 8, ModBlocks.vinyl_tile); - //Walls - fillWithBlocks(world, box, 1, 1, 0, 3, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 0, 3, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 0, 3, 3, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 1, 1, 0, 1, 9, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 1, 0, 2, 9, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 1, 0, 3, 9, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 1, 10, 9, 1, 10, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 10, 9, 2, 10, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 10, 9, 3, 10, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 10, 1, 6, 10, 1, 9, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.red_wire_coated, 0, 10, 1, 5, box); - fillWithBlocks(world, box, 10, 1, 1, 10, 1, 4, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 10, 2, 1, 10, 2, 9, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 10, 3, 1, 10, 3, 9, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 7, 1, 0, 9, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 7, 2, 0, 9, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 7, 3, 0, 9, 3, 0, ModBlocks.reinforced_brick); - //Ceiling - int pillarMetaWE = getPillarMeta(4); - fillWithBlocks(world, box, 4, 4, 0, 6, 4, 0, ModBlocks.reinforced_brick); - for(int i = 1; i <= 9; i += 3) { - fillWithBlocks(world, box, 2, 4, i, 8, 4, i, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 4, i, 1, 4, i + 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 2, 4, i + 2, 8, 4, i + 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 9, 4, i, 9, 4, i + 2, ModBlocks.reinforced_brick); - placeLamp(world, box, rand, 2, 4, i + 1); - fillWithMetadataBlocks(world, box, 3, 4, i + 1, 4, 4, i + 1, ModBlocks.concrete_pillar, pillarMetaWE); - placeLamp(world, box, rand, 5, 4, i + 1); - fillWithMetadataBlocks(world, box, 6, 4, i + 1, 7, 4, i + 1, ModBlocks.concrete_pillar, pillarMetaWE); - placeLamp(world, box, rand, 8, 4, i + 1); - } - - //Decoration - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(7), 1, 1, 3, box); //Desk - fillWithMetadataBlocks(world, box, 1, 1, 4, 1, 1, 6, ModBlocks.brick_slab, 9); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(6), 1, 1, 7, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(0), 2, 1, 4, box); - placeBlockAtCurrentPosition(world, ModBlocks.deco_computer, getDecoModelMeta(3), 1, 2, 4, box); - - fillWithBlocks(world, box, 1, 1, 9, 2, 1, 9, ModBlocks.crate_lead); - placeBlockAtCurrentPosition(world, ModBlocks.barrel_corroded, 0, 1, 2, 9, box); - fillWithMetadataBlocks(world, box, 4, 1, 9, 4, 2, 9, ModBlocks.tape_recorder, getDecoMeta(2)); - placeBlockAtCurrentPosition(world, ModBlocks.barrel_corroded, 0, 7, 1, 9, box); - placeBlockAtCurrentPosition(world, ModBlocks.barrel_corroded, 0, 9, 1, 8, box); - - //The boy - placeBlockAtCurrentPosition(world, ModBlocks.machine_radiolysis, getDirection(ForgeDirection.EAST).ordinal() + BlockDummyable.offset, 5, 1, 5, box); - fillSpace(world, box, 5, 1, 5, new int[] {2, 0, 1, 1, 1, 1}, ModBlocks.machine_radiolysis, ForgeDirection.EAST); - makeExtra(world, box, ModBlocks.machine_radiolysis, 5 + 1, 1, 5); - makeExtra(world, box, ModBlocks.machine_radiolysis, 5 - 1, 1, 5); - makeExtra(world, box, ModBlocks.machine_radiolysis, 5, 1, 5 + 1); - makeExtra(world, box, ModBlocks.machine_radiolysis, 5, 1, 5 - 1); - - int decoMetaS = getDecoMeta(2); - int decoMetaN = getDecoMeta(3); - int decoMetaE = getDecoMeta(4); - int decoMetaW = getDecoMeta(5); - fillWithMetadataBlocks(world, box, 4, 1, 3, 6, 3, 3, ModBlocks.steel_wall, decoMetaS); - fillWithMetadataBlocks(world, box, 3, 1, 4, 3, 3, 6, ModBlocks.steel_wall, decoMetaE); - fillWithMetadataBlocks(world, box, 4, 1, 7, 6, 3, 7, ModBlocks.steel_wall, decoMetaN); - fillWithMetadataBlocks(world, box, 7, 1, 4, 7, 3, 4, ModBlocks.steel_wall, decoMetaW); - placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaW, 7, 3, 5, box); - fillWithMetadataBlocks(world, box, 7, 1, 6, 7, 3, 6, ModBlocks.steel_wall, decoMetaW); - - //Cable - placeBlockAtCurrentPosition(world, ModBlocks.red_cable, 0, 7, 1, 5, box); - placeBlockAtCurrentPosition(world, ModBlocks.red_wire_coated, 0, 8, 1, 5, box); - placeBlockAtCurrentPosition(world, ModBlocks.red_cable, 0, 9, 1, 5, box); - placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaN, 8, 1, 6, box); - placeBlockAtCurrentPosition(world, ModBlocks.steel_wall, decoMetaS, 8, 1, 4, box); - fillWithBlocks(world, box, 7, 2, 5, 9, 2, 5, ModBlocks.steel_roof); - - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(3) | 4, 1, 1, 2, HbmChestContents.filingCabinet, 4); - generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(3) | 4, 1, 2, 2, HbmChestContents.filingCabinet, 4); - - if(underwater) { - fillWithWater(world, box, rand, 4, 1, 0, 6, 3, 0, 1); - fillWithWater(world, box, rand, 1, 1, 1, 9, 3, 9, 1); - } else - fillWithCobwebs(world, box, rand, 1, 1, 0, 9, 3, 9); - - return true; - //} - } - - - /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ - public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { - StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -4, -1, 0, 11, 6, 11, mode); - return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new RTG(type, rand, box, mode) : null; - } - } - - public static class Atrium extends ControlComponent { - - public boolean underwater = false; - - public Atrium() { } - - public Atrium(int componentType, Random rand, int posX, int posZ) { //TODO: change basically everything about this component - super(componentType); - this.coordBaseMode = rand.nextInt(4); - this.boundingBox = new StructureBoundingBox(posX, 64, posZ, posX + 12, 68, posZ + 12); - } - - @Override - public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { - - StructureComponent component = getNextComponentNormal(instance, original, components, rand, 3, 1); - System.out.println("ComponentPZ:" + component); - - StructureComponent componentAN = getNextComponentAntiNormal(instance, original, components, rand, 3, 1); - System.out.println("ComponentNZ:" + componentAN); - - StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 3, 1); - System.out.println("ComponentNX:" + componentN); - - StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 3, 1); - System.out.println("ComponentPX:" + componentP); - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - fillWithBlocks(world, box, 0, 0, 0, 12, 4, 12, ModBlocks.reinforced_brick, Blocks.air, false); - - return true; - } - } - - public static class Corridor extends Bunker { - - boolean expandsNX = false; - boolean expandsPX = false; - boolean extendsPZ = true; - - public Corridor() { } - - public Corridor(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType); - this.coordBaseMode = coordBaseMode; - this.boundingBox = box; - - } - - protected void func_143012_a(NBTTagCompound data) { - super.func_143012_a(data); - data.setBoolean("expandsNX", expandsNX); - data.setBoolean("expandsPX", expandsPX); - data.setBoolean("extendsPZ", extendsPZ); - } - - protected void func_143011_b(NBTTagCompound data) { - super.func_143011_b(data); - expandsNX = data.getBoolean("expandsNX"); - expandsPX = data.getBoolean("expandsPX"); - extendsPZ = data.getBoolean("extendsPZ"); - } - - @Override - public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { - checkModifiers(original); - - StructureComponent component = getNextComponentNormal(instance, original, components, rand, 1, 1); - extendsPZ = component != null; - - if(rand.nextInt(3) > 0) { - StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 6, 1); - expandsNX = componentN != null; - } - - if(rand.nextInt(3) > 0) { - StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 6, 1); - expandsPX = componentP != null; - } - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - - /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else {*/ - int end = extendsPZ ? 14 : 13; - - fillWithAir(world, box, 1, 1, 0, 3, 3, end); - fillWithBlocks(world, box, 1, 0, 0, 3, 0, end, ModBlocks.vinyl_tile); - - //Walls - for(int x = 0; x <= 4; x += 4) { - fillWithBlocks(world, box, x, 1, 0, x, 1, 4, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, x, 1, 10, x, 1, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, x, 2, 0, x, 2, 4, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, x, 2, 10, x, 2, end, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, x, 3, 10, x, 3, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, x, 3, 0, x, 3, 4, ModBlocks.reinforced_brick); - } - - if(!extendsPZ) { - fillWithBlocks(world, box, 1, 1, 14, 3, 1, 14, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 14, 3, 2, 14, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 14, 3, 3, 14, ModBlocks.reinforced_brick); - } - - //ExpandsNX - if(expandsNX) { - fillWithBlocks(world, box, 0, 0, 6, 0, 0, 8, ModBlocks.vinyl_tile); //Floor - fillWithBlocks(world, box, 0, 1, 5, 0, 3, 5, ModBlocks.concrete_pillar); //Walls - fillWithBlocks(world, box, 0, 1, 9, 0, 3, 9, ModBlocks.concrete_pillar); - fillWithAir(world, box, 0, 1, 6, 0, 3, 8); - fillWithBlocks(world, box, 0, 4, 6, 0, 4, 8, ModBlocks.reinforced_brick); //Ceiling - } else { - fillWithBlocks(world, box, 0, 1, 5, 0, 1, 9, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 5, 0, 2, 9, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 5, 0, 3, 9, ModBlocks.reinforced_brick); - } - - //ExpandsPX - if(expandsPX) { - fillWithBlocks(world, box, 4, 0, 6, 4, 0, 8, ModBlocks.vinyl_tile); - fillWithBlocks(world, box, 4, 1, 5, 4, 3, 5, ModBlocks.concrete_pillar); - fillWithBlocks(world, box, 4, 1, 9, 4, 3, 9, ModBlocks.concrete_pillar); - fillWithAir(world, box, 4, 1, 6, 4, 3, 8); - fillWithBlocks(world, box, 4, 4, 6, 4, 4, 8, ModBlocks.reinforced_brick); - } else { - fillWithBlocks(world, box, 4, 1, 5, 4, 1, 9, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 4, 2, 5, 4, 2, 9, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 4, 3, 5, 4, 3, 9, ModBlocks.reinforced_brick); - } - - //Ceiling - fillWithBlocks(world, box, 1, 4, 0, 1, 4, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 3, 4, 0, 3, 4, end, ModBlocks.reinforced_brick); - int pillarMeta = getPillarMeta(8); - for(int i = 0; i <= 12; i += 3) { - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 2, 4, i, box); - placeLamp(world, box, rand, 2, 4, i + 1); - - if(extendsPZ || i < 12) - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 2, 4, i + 2, box); - } - - if(underwater) { - fillWithWater(world, box, rand, 1, 1, 0, 3, 3, end, 1); - if(expandsNX) fillWithWater(world, box, rand, 0, 1, 6, 0, 3, 8, 1); - if(expandsPX) fillWithWater(world, box, rand, 4, 1, 6, 4, 3, 8, 1); - } else - fillWithCobwebs(world, box, rand, expandsNX ? 0 : 1, 1, 0, expandsPX ? 4 : 3, 3, end); - - return true; - //} - } - - /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ - public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { - StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 15, mode); //Corridor and Wide version - if(box.minY > 10 && StructureComponent.findIntersecting(components, box) == null) return new WideCorridor(type, rand, box, mode); - - box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 15, mode); - return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new Corridor(type, rand, box, mode) : null; - } - } - - private interface Wide { } //now you may ask yourself - where is that beautiful house? you may ask yourself - where does that highway go to? - //you may ask yourself - am i right, am i wrong? you may say to yourself - my god, no multiple inheritance to be done! - private interface Bulkhead { public void setBulkheadNZ(boolean bool); - public default void flipConstituentBulkhead(StructureComponent component, Random rand) { - if(component instanceof Bulkhead) { - Bulkhead head = (Bulkhead) component; - head.setBulkheadNZ(rand.nextInt(4) == 0); - } - } - } - - public static class WideCorridor extends Corridor implements Wide, Bulkhead { - - boolean bulkheadNZ = true; - public void setBulkheadNZ(boolean bool) { bulkheadNZ = bool; } - - boolean bulkheadPZ = true; - - public WideCorridor() { } - - public WideCorridor(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType, rand, box, coordBaseMode); - } - - protected void func_143012_a(NBTTagCompound data) { - super.func_143012_a(data); - data.setBoolean("bulkheadNZ", bulkheadNZ); - data.setBoolean("bulkheadPZ", bulkheadPZ); - } - - protected void func_143011_b(NBTTagCompound data) { - super.func_143011_b(data); - bulkheadNZ = data.getBoolean("bulkheadNZ"); - bulkheadPZ = data.getBoolean("bulkheadPZ"); - } - - @Override - public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { - checkModifiers(original); - - StructureComponent component = getNextComponentNormal(instance, original, components, rand, 3, 1); - extendsPZ = component != null; - - if(component instanceof Wide) { - bulkheadPZ = false; - flipConstituentBulkhead(component, rand); - } - - if(rand.nextInt(3) > 0) { - StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 6, 1); - expandsNX = componentN != null; - } - - if(rand.nextInt(3) > 0) { - StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 6, 1); - expandsPX = componentP != null; - } - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - - /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else {*/ - int begin = bulkheadNZ ? 1 : 0; - int end = bulkheadPZ ? 13 : 14; //for the bulkhead - int endExtend = !extendsPZ ? 13 : 14; //for parts that would be cut off if it doesn't extend further - - fillWithAir(world, box, 1, 1, begin, 7, 3, end); - - //Floor - fillWithBlocks(world, box, 1, 0, begin, 1, 0, end, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 2, 0, begin, 2, 0, end, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 3, 0, 0, 5, 0, endExtend, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 6, 0, begin, 6, 0, end, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 7, 0, begin, 7, 0, end, ModBlocks.vinyl_tile); - - int pillarMeta = getPillarMeta(8); - //Walls - if(expandsNX) { - fillWithBlocks(world, box, 0, 1, begin, 0, 1, 4, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, begin, 0, 2, 4, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, begin, 0, 3, 4, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 1, 10, 0, 1, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 10, 0, 2, end, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 10, 0, 3, end, ModBlocks.reinforced_brick); - - fillWithBlocks(world, box, 0, 0, 6, 0, 0, 8, ModBlocks.vinyl_tile); - fillWithBlocks(world, box, 0, 1, 5, 0, 3, 5, ModBlocks.concrete_pillar); - fillWithBlocks(world, box, 0, 1, 9, 0, 3, 9, ModBlocks.concrete_pillar); - fillWithMetadataBlocks(world, box, 0, 4, 6, 0, 4, 8, ModBlocks.concrete_pillar, pillarMeta); - fillWithAir(world, box, 0, 1, 6, 0, 3, 8); - - } else { - fillWithBlocks(world, box, 0, 1, begin, 0, 1, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, begin, 0, 2, end, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, begin, 0, 3, end, ModBlocks.reinforced_brick); - } - - if(expandsPX) { - fillWithBlocks(world, box, 8, 1, begin, 8, 1, 4, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 2, begin, 8, 2, 4, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 8, 3, begin, 8, 3, 4, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 1, 10, 8, 1, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 2, 10, 8, 2, end, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 8, 3, 10, 8, 3, end, ModBlocks.reinforced_brick); - - fillWithBlocks(world, box, 8, 0, 6, 8, 0, 8, ModBlocks.vinyl_tile); - fillWithBlocks(world, box, 8, 1, 5, 8, 3, 5, ModBlocks.concrete_pillar); - fillWithBlocks(world, box, 8, 1, 9, 8, 3, 9, ModBlocks.concrete_pillar); - fillWithMetadataBlocks(world, box, 8, 4, 6, 8, 4, 8, ModBlocks.concrete_pillar, pillarMeta); - fillWithAir(world, box, 8, 1, 6, 8, 3, 8); - - } else { - fillWithBlocks(world, box, 8, 1, begin, 8, 1, end, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 2, begin, 8, 2, end, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 8, 3, begin, 8, 3, end, ModBlocks.reinforced_brick); - } - - if(bulkheadNZ) { - fillWithBlocks(world, box, 1, 1, 0, 2, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 0, 2, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 0, 2, 3, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 1, 0, 7, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 2, 0, 7, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 6, 3, 0, 7, 3, 0, ModBlocks.reinforced_brick); - fillWithAir(world, box, 3, 1, 0, 5, 3, 0); - } - - if(bulkheadPZ) { - fillWithBlocks(world, box, 1, 1, 14, 2, 1, 14, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 14, 2, 2, 14, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 14, 2, 3, 14, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 1, 14, 7, 1, 14, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 2, 14, 7, 2, 14, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 6, 3, 14, 7, 3, 14, ModBlocks.reinforced_brick); - - if(!extendsPZ) { - fillWithBlocks(world, box, 3, 1, 14, 5, 1, 14, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 3, 2, 14, 5, 2, 14, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 3, 3, 14, 5, 3, 14, ModBlocks.reinforced_brick); - } else - fillWithAir(world, box, 3, 1, 14, 5, 3, 14); - } - - //Ceiling - fillWithBlocks(world, box, 1, 4, begin, 1, 4, end, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 2, 4, begin, 2, 4, end, ModBlocks.concrete_pillar, pillarMeta); - fillWithBlocks(world, box, 3, 4, 0, 3, 4, endExtend, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 5, 4, 0, 5, 4, endExtend, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 6, 4, begin, 6, 4, end, ModBlocks.concrete_pillar, pillarMeta); - fillWithBlocks(world, box, 7, 4, begin, 7, 4, end, ModBlocks.reinforced_brick); - - for(int i = 0; i <= 12; i += 3) { - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 4, 4, i, box); - placeLamp(world, box, rand, 4, 4, i + 1); - - if(extendsPZ || i < 12) - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 4, 4, i + 2, box); - } - - if(underwater) { - fillWithWater(world, box, rand, 1, 1, 0, 7, 3, endExtend, 1); - if(expandsNX) fillWithWater(world, box, rand, 0, 1, 6, 0, 3, 8, 1); - if(expandsPX) fillWithWater(world, box, rand, 8, 1, 6, 8, 3, 8, 1); - } else - fillWithCobwebs(world, box, rand, expandsNX ? 0 : 1, 1, 0, expandsPX ? 8 : 7, 3, endExtend); - - return true; - //} - } - } - - public static class Turn extends ProceduralComponent { - - public Turn() { } - - public Turn(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType); - this.coordBaseMode = coordBaseMode; - this.boundingBox = box; - - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - return true; - } - } - - public static class WideTurn extends Turn implements Wide { - - public WideTurn() { } - - public WideTurn(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType, rand, box, coordBaseMode); - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - return true; - } - } - - public static class Intersection extends Bunker { - - boolean opensNX = false; - boolean opensPX = false; - boolean opensPZ = false; - - public Intersection() { } - - public Intersection(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType); - this.coordBaseMode = coordBaseMode; - this.boundingBox = box; - - } - - @Override - public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { - checkModifiers(original); - - StructureComponent component = getNextComponentNormal(instance, original, components, rand, 1, 1); - opensPZ = component != null; - - StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 1, 1); - opensNX = componentN != null; - - StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 1, 1); - opensPX = componentP != null; - } - - protected void func_143012_a(NBTTagCompound data) { - super.func_143012_a(data); - data.setBoolean("opensNX", opensNX); - data.setBoolean("opensPX", opensPX); - data.setBoolean("opensPZ", opensPZ); - } - - protected void func_143011_b(NBTTagCompound data) { - super.func_143011_b(data); - opensNX = data.getBoolean("opensNX"); - opensPX = data.getBoolean("opensPX"); - opensPZ = data.getBoolean("opensPZ"); - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else {*/ - - fillWithAir(world, box, 1, 1, 0, 3, 3, 3); - //Floor - fillWithBlocks(world, box, 1, 0, 0, 3, 0, 3, ModBlocks.vinyl_tile); - //Ceiling - int pillarMetaWE = getPillarMeta(4); - int pillarMetaNS = getPillarMeta(8); - - fillWithBlocks(world, box, 3, 4, 0, 3, 4, 1, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 2, 4, 0, 2, 4, 1, ModBlocks.concrete_pillar, pillarMetaNS); - fillWithBlocks(world, box, 1, 4, 0, 1, 4, 1, ModBlocks.reinforced_brick); - - placeLamp(world, box, rand, 2, 4, 2); - - if(opensPZ) { - fillWithBlocks(world, box, 1, 0, 4, 3, 0, 4, ModBlocks.vinyl_tile); //Floor - fillWithBlocks(world, box, 1, 4, 3, 1, 4, 4, ModBlocks.reinforced_brick); //Ceiling - fillWithMetadataBlocks(world, box, 2, 4, 3, 2, 4, 4, ModBlocks.concrete_pillar, pillarMetaNS); - fillWithBlocks(world, box, 3, 4, 3, 3, 4, 4, ModBlocks.reinforced_brick); - fillWithAir(world, box, 1, 1, 4, 3, 3, 4); //Opening - } else { - fillWithBlocks(world, box, 1, 4, 3, 3, 4, 3, ModBlocks.reinforced_brick); //Ceiling - fillWithBlocks(world, box, 1, 1, 4, 3, 1, 4, ModBlocks.reinforced_brick); //Wall - fillWithBlocks(world, box, 1, 2, 4, 3, 2, 4, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 4, 3, 3, 4, ModBlocks.reinforced_brick); - } - - if(opensNX) { - fillWithBlocks(world, box, 0, 0, 1, 0, 0, 3, ModBlocks.vinyl_tile); //Floor - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 1, box); //Ceiling - fillWithMetadataBlocks(world, box, 0, 4, 2, 1, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 3, box); - fillWithAir(world, box, 0, 1, 1, 0, 3, 3); //Opening - } else { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 1, 4, 2, box); //Ceiling - fillWithBlocks(world, box, 0, 1, 1, 0, 1, 3, ModBlocks.reinforced_brick); //Wall - fillWithBlocks(world, box, 0, 2, 1, 0, 2, 3, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 1, 0, 3, 3, ModBlocks.reinforced_brick); - } - - if(opensPX) { - fillWithBlocks(world, box, 4, 0, 1, 4, 0, 3, ModBlocks.vinyl_tile); //Floor - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 4, 1, box); //Ceiling - fillWithMetadataBlocks(world, box, 3, 4, 2, 4, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 4, 3, box); - fillWithAir(world, box, 4, 1, 1, 4, 3, 3); //Opening - } else { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 3, 4, 2, box); - fillWithBlocks(world, box, 4, 1, 1, 4, 1, 3, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 4, 2, 1, 4, 2, 3, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 4, 3, 1, 4, 3, 3, ModBlocks.reinforced_brick); - } - - //Pillars - if(opensNX) - fillWithBlocks(world, box, 0, 1, 0, 0, 3, 0, ModBlocks.concrete_pillar); - else { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 1, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 0, 2, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 3, 0, box); - } - - if(opensPX) - fillWithBlocks(world, box, 4, 1, 0, 4, 3, 0, ModBlocks.concrete_pillar); - else { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 1, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 4, 2, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 3, 0, box); - } - - if(opensNX && opensPZ) - fillWithBlocks(world, box, 0, 1, 4, 0, 3, 4, ModBlocks.concrete_pillar); - else if(opensNX || opensPZ) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 1, 4, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 0, 2, 4, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 3, 4, box); - } - - if(opensPX && opensPZ) - fillWithBlocks(world, box, 4, 1, 4, 4, 3, 4, ModBlocks.concrete_pillar); - else if(opensPX || opensPZ) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 1, 4, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 4, 2, 4, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 3, 4, box); - } - - if(underwater) { - fillWithWater(world, box, rand, 1, 1, 0, 3, 3, opensPZ ? 4 : 3, 1); - if(opensNX) fillWithWater(world, box, rand, 0, 1, 1, 0, 3, 3, 1); - if(opensPX) fillWithWater(world, box, rand, 4, 1, 1, 4, 3, 3, 1); - } else - fillWithCobwebs(world, box, rand, opensNX ? 0 : 1, 1, 0, opensPX ? 4 : 3, 3, opensPZ ? 4 : 3); - - return true; - //} - } - - /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ - public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { - StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -3, -1, 0, 9, 6, 9, mode); - if(box.minY > 10 && StructureComponent.findIntersecting(components, box) == null) return new WideIntersection(type, rand, box, mode); - - if(rand.nextInt(2) == 0) { - box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 5, mode); - return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new Intersection(type, rand, box, mode) : null; - } else { - box = getComponentToAddBoundingBox(x, y, z, -1, -1, 0, 5, 6, 4, mode); - return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new DeadEnd(type, rand, box, mode) : null; - } - } - } - - public static class WideIntersection extends Intersection implements Wide, Bulkhead { - - boolean bulkheadNZ = true; - public void setBulkheadNZ(boolean bool) { bulkheadNZ = bool; } - - boolean bulkheadPZ = true; - boolean bulkheadNX = true; - boolean bulkheadPX = true; - - public WideIntersection() { } - - public WideIntersection(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType, rand, box, coordBaseMode); - } - - protected void func_143012_a(NBTTagCompound data) { - super.func_143012_a(data); - data.setBoolean("bulkheadNZ", bulkheadNZ); - data.setBoolean("bulkheadPZ", bulkheadPZ); - data.setBoolean("bulkheadNX", bulkheadNX); - data.setBoolean("bulkheadPX", bulkheadPX); - } - - protected void func_143011_b(NBTTagCompound data) { - super.func_143011_b(data); - bulkheadNZ = data.getBoolean("bulkheadNZ"); - bulkheadPZ = data.getBoolean("bulkheadPZ"); - bulkheadNX = data.getBoolean("bulkheadNX"); - bulkheadPX = data.getBoolean("bulkheadPX"); - } - - @Override - public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { - checkModifiers(original); - - StructureComponent component = getNextComponentNormal(instance, original, components, rand, 3, 1); - opensPZ = component != null; - - if(component instanceof Wide) { - bulkheadPZ = false; - flipConstituentBulkhead(component, rand); - } - - StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 3, 1); - opensNX = componentN != null; - - if(componentN instanceof Wide) { - bulkheadNX = false; - flipConstituentBulkhead(component, rand); - } - - StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 3, 1); - opensPX = componentP != null; - - if(componentP instanceof Wide) { - bulkheadPX = false; - flipConstituentBulkhead(component, rand); - } - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else {*/ - - int start = bulkheadNZ ? 1 : 0; - int end = bulkheadPZ ? 7 : 8; - int right = bulkheadNX ? 1 : 0; - int left = bulkheadPX ? 7 : 8; - - int pillarMetaNS = getPillarMeta(8); - int pillarMetaWE = getPillarMeta(4); - - fillWithAir(world, box, 1, 1, 0, 7, 3, end); - //Floor - fillWithBlocks(world, box, 3, 0, 0, 5, 0, 1, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 2, 0, start, 2, 0, 6, ModBlocks.vinyl_tile, 1); - fillWithMetadataBlocks(world, box, 3, 0, 2, 5, 0, 2, ModBlocks.vinyl_tile, 1); - fillWithMetadataBlocks(world, box, 3, 0, 6, 5, 0, 6, ModBlocks.vinyl_tile, 1); - fillWithMetadataBlocks(world, box, 6, 0, start, 6, 0, 6, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 3, 0, 3, 5, 0, 5, ModBlocks.vinyl_tile); - //Wall - if(!bulkheadNZ || (opensNX && !bulkheadNX)) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 1, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 0, 2, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 3, 0, box); - } - - if(!bulkheadNZ || (opensPX && !bulkheadPX)) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 1, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 8, 2, 0, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 3, 0, box); - } - //Ceiling - fillWithBlocks(world, box, 1, 4, start, 1, 4, 1, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 2, 4, start, 2, 4, 1, ModBlocks.concrete_pillar, pillarMetaNS); - fillWithBlocks(world, box, 3, 4, 0, 3, 4, 3, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 4, 4, 0, 4, 4, 3, ModBlocks.concrete_pillar, pillarMetaNS); - fillWithBlocks(world, box, 5, 4, 0, 5, 4, 3, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 6, 4, start, 6, 4, 1, ModBlocks.concrete_pillar, pillarMetaNS); - fillWithBlocks(world, box, 7, 4, start, 7, 4, 1, ModBlocks.reinforced_brick); - placeLamp(world, box, rand, 2, 4, 2); - placeLamp(world, box, rand, 2, 4, 6); - placeLamp(world, box, rand, 4, 4, 4); - placeLamp(world, box, rand, 6, 4, 2); - placeLamp(world, box, rand, 6, 4, 6); - - if(bulkheadNZ) { - fillWithBlocks(world, box, 1, 1, 0, 2, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 0, 2, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 0, 2, 3, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 1, 0, 7, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 2, 0, 7, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 6, 3, 0, 7, 3, 0, ModBlocks.reinforced_brick); - fillWithAir(world, box, 3, 1, 0, 5, 3, 0); - } else - fillWithAir(world, box, 1, 1, 0, 7, 3, 0); - - if(opensPZ) { - fillWithBlocks(world, box, 1, 0, 7, 1, 0, end, ModBlocks.vinyl_tile); //Floor - fillWithMetadataBlocks(world, box, 2, 0, 7, 2, 0, end, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 3, 0, 7, 5, 0, 8, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 6, 0, 7, 6, 0, end, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 7, 0, 7, 7, 0, end, ModBlocks.vinyl_tile); - fillWithBlocks(world, box, 1, 4, 7, 1, 4, end, ModBlocks.reinforced_brick); //Ceiling - fillWithMetadataBlocks(world, box, 2, 4, 7, 2, 4, end, ModBlocks.concrete_pillar, pillarMetaNS); - fillWithBlocks(world, box, 3, 4, 5, 3, 4, 8, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 4, 4, 5, 4, 4, 8, ModBlocks.concrete_pillar, pillarMetaNS); - fillWithBlocks(world, box, 5, 4, 5, 5, 4, 8, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 6, 4, 7, 6, 4, end, ModBlocks.concrete_pillar, pillarMetaNS); - fillWithBlocks(world, box, 7, 4, 7, 7, 4, end, ModBlocks.reinforced_brick); - - if(bulkheadPZ) { - fillWithBlocks(world, box, 1, 1, 8, 2, 1, 8, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 8, 2, 2, 8, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 8, 2, 3, 8, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 1, 8, 7, 1, 8, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 2, 8, 7, 2, 8, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 6, 3, 8, 7, 3, 8, ModBlocks.reinforced_brick); - fillWithAir(world, box, 3, 1, 8, 5, 3, 8); - } else - fillWithAir(world, box, 1, 1, 8, 7, 3, 8); - } else { - fillWithBlocks(world, box, 1, 0, 7, 7, 0, 7, ModBlocks.vinyl_tile); //Floor - fillWithBlocks(world, box, 1, 1, 8, 7, 1, 8, ModBlocks.reinforced_brick); //Wall - fillWithBlocks(world, box, 1, 2, 8, 7, 2, 8, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 8, 7, 3, 8, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 3, 4, 5, 5, 4, 6, ModBlocks.reinforced_brick); //Ceiling - fillWithBlocks(world, box, 1, 4, 7, 7, 4, 7, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 4, 5, box); - } - - if(opensNX) { - fillWithBlocks(world, box, 1, 0, start, 1, 0, 1, ModBlocks.vinyl_tile); //Floor - - fillWithMetadataBlocks(world, box, right, 0, 2, 1, 0, 2, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 0, 0, 3, 1, 0, 5, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, right, 0, 6, 1, 0, 6, ModBlocks.vinyl_tile, 1); - - //Ceiling - fillWithMetadataBlocks(world, box, right, 4, 2, 1, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); - fillWithBlocks(world, box, 0, 4, 3, 2, 4, 3, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 0, 4, 4, 3, 4, 4, ModBlocks.concrete_pillar, pillarMetaWE); - fillWithBlocks(world, box, 0, 4, 5, 2, 4, 5, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, right, 4, 6, 1, 4, 6, ModBlocks.concrete_pillar, pillarMetaWE); - - if(bulkheadNX) { - fillWithBlocks(world, box, 0, 1, 1, 0, 1, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 1, 0, 2, 2, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 1, 0, 3, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 1, 6, 0, 1, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 6, 0, 2, 7, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 6, 0, 3, 7, ModBlocks.reinforced_brick); - fillWithAir(world, box, 0, 1, 3, 0, 3, 5); - } else { - fillWithAir(world, box, 0, 1, 1, 0, 3, 7); - placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 0, 0, 0, 1, box); //outlier single-block placing operations - placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 0, 0, 0, 7, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 4, 7, box); - } - } else { - fillWithBlocks(world, box, 1, 0, start, 1, 0, 6, ModBlocks.vinyl_tile); //Floor - fillWithBlocks(world, box, 0, 1, 1, 0, 1, 7, ModBlocks.reinforced_brick); //Wall - fillWithBlocks(world, box, 0, 2, 1, 0, 2, 7, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 1, 0, 3, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 4, 2, 1, 4, 6, ModBlocks.reinforced_brick); //Ceiling - fillWithBlocks(world, box, 2, 4, 3, 2, 4, 5, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 3, 4, 4, box); - } - - if(opensPX) { - //Floor - fillWithBlocks(world, box, 7, 0, start, 7, 0, 1, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 7, 0, 2, left, 0, 2, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 7, 0, 3, 8, 0, 5, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 7, 0, 6, left, 0, 6, ModBlocks.vinyl_tile, 1); - //Ceiling - fillWithMetadataBlocks(world, box, 7, 4, 2, left, 4, 2, ModBlocks.concrete_pillar, pillarMetaWE); - fillWithBlocks(world, box, 6, 4, 3, 8, 4, 3, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 5, 4, 4, 8, 4, 4, ModBlocks.concrete_pillar, pillarMetaWE); - fillWithBlocks(world, box, 6, 4, 5, 8, 4, 5, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 7, 4, 6, left, 4, 6, ModBlocks.concrete_pillar, pillarMetaWE); - - if(bulkheadPX) { - fillWithBlocks(world, box, 8, 1, 1, 8, 1, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 2, 1, 8, 2, 2, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 8, 3, 1, 8, 3, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 1, 6, 8, 1, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 8, 2, 6, 8, 2, 7, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 8, 3, 6, 8, 3, 7, ModBlocks.reinforced_brick); - fillWithAir(world, box, 8, 1, 3, 8, 3, 5); - } else { - fillWithAir(world, box, 8, 1, 1, 8, 3, 7); - placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 0, 8, 0, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 0, 8, 0, 7, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 4, 1, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 4, 7, box); - } - } else { - fillWithBlocks(world, box, 7, 0, start, 7, 0, 6, ModBlocks.vinyl_tile); //Floor - fillWithBlocks(world, box, 8, 1, 1, 8, 1, 7, ModBlocks.reinforced_brick); //Wall - fillWithBlocks(world, box, 8, 2, 1, 8, 2, 7, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 8, 3, 1, 8, 3, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 4, 3, 6, 4, 5, ModBlocks.reinforced_brick); //Ceiling - fillWithBlocks(world, box, 7, 4, 2, 7, 4, 6, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 5, 4, 4, box); - } - //Wall corners - if(opensNX || opensPZ) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 1, 8, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 0, 2, 8, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 0, 3, 8, box); - } - - if(opensPX || opensPZ) { - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 1, 8, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_stone, 0, 8, 2, 8, box); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 8, 3, 8, box); - } - - if(underwater) { - fillWithWater(world, box, rand, 1, 1, 0, 7, 3, opensPZ ? 8 : 7, 1); - if(opensNX) fillWithWater(world, box, rand, 0, 1, bulkheadNX ? 3 : 1, 0, 3, bulkheadNX ? 5 : 7, 1); - if(opensPX) fillWithWater(world, box, rand, 8, 1, bulkheadPX ? 3 : 1, 8, 3, bulkheadPX ? 5 : 7, 1); - } else - fillWithCobwebs(world, box, rand, opensNX ? 0 : 1, 1, 0, opensPX ? 8 : 7, 3, opensPZ ? 8 : 7); - - return true; - //} - } - } - - //fuck you intersection stop clogging my vaults - public static class DeadEnd extends Bunker { - - BlockSelector plantSelector = new BlockSelector() { - public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { - int chance = rand.nextInt(10); - - switch(chance) { - case 0: - this.field_151562_a = Blocks.yellow_flower; - break; - case 1: - case 2: - case 3: - case 4: - this.field_151562_a = Blocks.red_flower; - this.selectedBlockMetaData = rand.nextInt(9); - break; - case 5: - case 6: - this.field_151562_a = Blocks.tallgrass; - this.selectedBlockMetaData = rand.nextInt(2) + 1; - break; - default: - this.field_151562_a = Blocks.air; - } - } - }; - - int decorationType = 0; - - public DeadEnd() { } - - public DeadEnd(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType); - this.coordBaseMode = coordBaseMode; - this.boundingBox = box; - this.decorationType = rand.nextInt(4); - } - - protected void func_143012_a(NBTTagCompound data) { - super.func_143012_a(data); - data.setInteger("decoration", decorationType); - } - - protected void func_143011_b(NBTTagCompound data) { - super.func_143011_b(data); - decorationType = data.getInteger("decoration"); - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else {*/ - fillWithAir(world, box, 1, 1, 0, 3, 3, 2); - - //Floor - fillWithBlocks(world, box, 1, 0, 0, 3, 0, 2, ModBlocks.vinyl_tile); - //Wall - fillWithBlocks(world, box, 0, 1, 0, 0, 1, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 0, 0, 2, 2, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 0, 0, 3, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 1, 3, 3, 1, 3, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 3, 3, 2, 3, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 3, 3, 3, 3, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 4, 1, 0, 4, 1, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 4, 2, 0, 4, 2, 2, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 4, 3, 0, 4, 3, 2, ModBlocks.reinforced_brick); - //Ceiling - fillWithBlocks(world, box, 1, 4, 0, 1, 4, 2, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 2, 4, 2, box); - fillWithBlocks(world, box, 3, 4, 0, 3, 4, 2, ModBlocks.reinforced_brick); - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, getPillarMeta(8), 2, 4, 0, box); - placeLamp(world, box, rand, 2, 4, 1); - - //Decoration - switch(this.decorationType) { - case 0: break; - case 1: - fillWithBlocks(world, box, 1, 1, 2, 3, 1, 2, Blocks.grass); - fillWithBlocks(world, box, 1, 1, 1, 3, 1, 1, ModBlocks.reinforced_brick); - fillWithRandomizedBlocks(world, box, 1, 2, 2, 3, 2, 2, rand, plantSelector); - break; - case 2: - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(1), 1, 1, 2, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(2), 2, 1, 2, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(0), 3, 1, 2, box); - break; - case 3: - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(1), 1, 1, 2, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, getStairMeta(0), 3, 1, 2, box); - placeBlockAtCurrentPosition(world, Blocks.fence, 0, 2, 1, 2, box); - placeBlockAtCurrentPosition(world, Blocks.heavy_weighted_pressure_plate, 0, 2, 2, 2, box); - break; - } - - if(underwater) - fillWithWater(world, box, rand, 1, 1, 0, 3, 3, 2, 1); - else - fillWithCobwebs(world, box, rand, 1, 1, 0, 3, 3, 2); - - return true; - //} - } - } - - public static class CenterCrossing extends Bunker { - - BlockSelector plantSelector = new BlockSelector() { - public void selectBlocks(Random rand, int posX, int posY, int posZ, boolean notInterior) { - int chance = rand.nextInt(10); - - switch(chance) { - case 0: - this.field_151562_a = Blocks.yellow_flower; - break; - case 1: - case 2: - case 3: - case 4: - this.field_151562_a = Blocks.red_flower; - this.selectedBlockMetaData = rand.nextInt(9); - break; - case 5: - case 6: - this.field_151562_a = Blocks.tallgrass; - this.selectedBlockMetaData = rand.nextInt(2) + 1; - break; - default: - this.field_151562_a = Blocks.air; - } - } - }; - - boolean expandsNX; - boolean expandsPX; - - int decorationType = 0; - - public CenterCrossing() { } - - public CenterCrossing(int componentType, Random rand, StructureBoundingBox box, int coordBaseMode) { - super(componentType); - this.coordBaseMode = coordBaseMode; - this.boundingBox = box; - this.decorationType = rand.nextInt(2); - } - - protected void func_143012_a(NBTTagCompound data) { - super.func_143012_a(data); - data.setBoolean("expandsNX", expandsNX); - data.setBoolean("expandsPX", expandsPX); - data.setInteger("decoration", decorationType); - } - - protected void func_143011_b(NBTTagCompound data) { - super.func_143011_b(data); - expandsNX = data.getBoolean("expandsNX"); - expandsPX = data.getBoolean("expandsPX"); - decorationType = data.getInteger("decoration"); - } - - @Override - public void buildComponent(ProceduralComponents instance, ControlComponent original, List components, Random rand) { - checkModifiers(original); - - StructureComponent componentN = getNextComponentNX(instance, original, components, rand, 3, 1); - expandsNX = componentN != null; - - StructureComponent componentP = getNextComponentPX(instance, original, components, rand, 7, 1); - expandsPX = componentP != null; - } - - @Override - public boolean addComponentParts(World world, Random rand, StructureBoundingBox box) { - - /*if(!underwater && isLiquidInStructureBoundingBox(world, boundingBox)) { - return false; - } else {*/ - fillWithAir(world, box, 6, 1, 0, 8, 3, 0); - fillWithAir(world, box, 1, 1, 1, 13, 3, 11); - fillWithAir(world, box, 2, 4, 2, 12, 5, 10); - - //Floor - fillWithMetadataBlocks(world, box, 6, 0, 0, 8, 0, 0, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 1, 0, 1, 4, 0, 1, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 1, 0, 2, 5, 0, 2, ModBlocks.vinyl_tile, 1); - placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 5, 0, 1, box); - fillWithBlocks(world, box, 6, 0, 1, 8, 0, 2, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 9, 0, 2, 13, 0, 2, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 10, 0, 1, 13, 0, 1, ModBlocks.vinyl_tile); - placeBlockAtCurrentPosition(world, ModBlocks.vinyl_tile, 1, 9, 0, 1, box); - fillWithBlocks(world, box, 1, 0, 3, 13, 0, 5, ModBlocks.vinyl_tile); - fillWithBlocks(world, box, 1, 0, 7, 3, 0, 11, ModBlocks.vinyl_tile); - fillWithMetadataBlocks(world, box, 1, 0, 6, 13, 0, 6, ModBlocks.vinyl_tile, 1); - fillWithMetadataBlocks(world, box, 4, 0, 7, 10, 0, 11, ModBlocks.vinyl_tile, 1); - fillWithBlocks(world, box, 11, 0, 7, 13, 0, 11, ModBlocks.vinyl_tile); - //Wall - fillWithBlocks(world, box, 1, 1, 0, 5, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 0, 5, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 0, 5, 3, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 4, 0, 13, 4, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 9, 1, 0, 13, 1, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 9, 2, 0, 13, 2, 0, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 9, 3, 0, 13, 3, 0, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 1, 12, 13, 1, 12, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 1, 2, 12, 13, 2, 12, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 1, 3, 12, 13, 4, 12, ModBlocks.reinforced_brick); - //Upper lining - for(int i = 1; i <= 11; i += 10) { - fillWithMetadataBlocks(world, box, 1, 4, i, 13, 4, i, ModBlocks.brick_slab, 8); - fillWithBlocks(world, box, 8, 5, i, 13, 5, i, ModBlocks.reinforced_brick); - placeLamp(world, box, rand, 7, 5, i); - fillWithBlocks(world, box, 1, 5, i, 6, 5, i, ModBlocks.reinforced_brick); - } - - for(int i = 1; i <= 13; i += 12) { - fillWithMetadataBlocks(world, box, i, 4, 2, i, 4, 10, ModBlocks.brick_slab, 8); - fillWithBlocks(world, box, i, 5, 2, i, 5, 5, ModBlocks.reinforced_brick); - placeLamp(world, box, rand, i, 5, 6); - fillWithBlocks(world, box, i, 5, 7, i, 5, 10, ModBlocks.reinforced_brick); - } - //Ceiling - int pillarMeta = getPillarMeta(4); - - fillWithBlocks(world, box, 2, 6, 2, 12, 6, 5, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 2, 6, 7, 12, 6, 10, ModBlocks.reinforced_brick); - for(int i = 2; i <= 10; i += 2) { - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, i, 6, 6, box); - placeLamp(world, box, rand, i + 1, 6, 6); - } - placeBlockAtCurrentPosition(world, ModBlocks.concrete_pillar, pillarMeta, 12, 6, 6, box); - - if(expandsNX) { - fillWithMetadataBlocks(world, box, 0, 0, 3, 0, 0, 5, ModBlocks.vinyl_tile, 1); //Floor - fillWithBlocks(world, box, 0, 1, 1, 0, 1, 2, ModBlocks.reinforced_brick); //Wall - fillWithBlocks(world, box, 0, 2, 1, 0, 2, 2, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 1, 0, 3, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 4, 1, 0, 4, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 1, 6, 0, 1, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 6, 0, 2, 11, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 6, 0, 3, 11, ModBlocks.reinforced_brick); - fillWithAir(world, box, 0, 1, 3, 0, 3, 5); - } else { - fillWithBlocks(world, box, 0, 1, 1, 0, 1, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 0, 2, 1, 0, 2, 11, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 0, 3, 1, 0, 4, 11, ModBlocks.reinforced_brick); - } - - if(expandsPX) { - fillWithMetadataBlocks(world, box, 14, 0, 3, 14, 0, 5, ModBlocks.vinyl_tile, 1); //Floor - fillWithBlocks(world, box, 14, 1, 1, 14, 1, 2, ModBlocks.reinforced_brick); //Wall - fillWithBlocks(world, box, 14, 2, 1, 14, 2, 2, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 14, 3, 1, 14, 3, 2, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 14, 4, 1, 14, 4, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 14, 1, 6, 14, 1, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 14, 2, 6, 14, 2, 11, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 14, 3, 6, 14, 3, 11, ModBlocks.reinforced_brick); - fillWithAir(world, box, 14, 1, 3, 14, 3, 5); - } else { - fillWithBlocks(world, box, 14, 1, 1, 14, 1, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 14, 2, 1, 14, 2, 11, ModBlocks.reinforced_stone); - fillWithBlocks(world, box, 14, 3, 1, 14, 4, 11, ModBlocks.reinforced_brick); - } - - //Decorations - int stairMetaW = getStairMeta(0); - int stairMetaE = getStairMeta(1); - int stairMetaN = getStairMeta(2); - int stairMetaS = getStairMeta(3); - - switch(decorationType) { - case 0: - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, 1, 1, 8, box); //Bench 1 - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, 1, 1, 9, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 1, 1, 10, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, 4, 1, 8, box); //Bench 2 - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, 4, 1, 9, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 4, 1, 10, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, 10, 1, 8, box); //Bench 3 - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, 10, 1, 9, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 10, 1, 10, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, 13, 1, 8, box); //Bench 4 - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, 13, 1, 9, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaN, 13, 1, 10, box); - if(!expandsNX) { - for(int i = 3; i <= 5; i += 2) { - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, 2, 1, i, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, 4, 1, i, box); - placeBlockAtCurrentPosition(world, Blocks.fence, 0, 3, 1, i, box); - placeBlockAtCurrentPosition(world, Blocks.heavy_weighted_pressure_plate, 0, 3, 2, i, box); - } - } - if(!expandsPX) { - for(int i = 3; i <= 5; i += 2) { - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, 10, 1, i, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, 12, 1, i, box); - placeBlockAtCurrentPosition(world, Blocks.fence, 0, 11, 1, i, box); - placeBlockAtCurrentPosition(world, Blocks.heavy_weighted_pressure_plate, 0, 11, 2, i, box); - } - } - //Fountain - fillWithBlocks(world, box, 5, 1, 8, 5, 1, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 6, 1, 7, 8, 1, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 9, 1, 8, 9, 1, 11, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 7, 1, 9, 7, 2, 9, ModBlocks.concrete_pillar); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_light, 0, 7, 3, 9, box); - placeBlockAtCurrentPosition(world, Blocks.flowing_water, 0, 7, 4, 9, box); //meh! regular stronghold does it too - fillWithMetadataBlocks(world, box, 5, 2, 9, 5, 2, 10, ModBlocks.brick_slab, 1); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(2), 5, 2, 11, box); - fillWithMetadataBlocks(world, box, 9, 2, 9, 9, 2, 10, ModBlocks.brick_slab, 1); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick_stairs, getStairMeta(2), 9, 2, 11, box); - break; - case 1: - //Right Planter - fillWithBlocks(world, box, 1, 1, 1, 4, 1, 1, Blocks.grass); - fillWithMetadataBlocks(world, box, 5, 1, 1, 5, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaE); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 4, 1, 2, box); - if(!expandsNX) { - fillWithMetadataBlocks(world, box, 2, 1, 2, 3, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); - fillWithMetadataBlocks(world, box, 2, 1, 3, 2, 1, 5, ModBlocks.reinforced_brick_stairs, stairMetaE); - fillWithBlocks(world, box, 1, 1, 2, 1, 1, 5, Blocks.grass); - } else - fillWithMetadataBlocks(world, box, 1, 1, 2, 3, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); - //Left Planter - fillWithBlocks(world, box, 10, 1, 1, 13, 1, 1, Blocks.grass); - fillWithMetadataBlocks(world, box, 9, 1, 1, 9, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaW); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_brick, 0, 10, 1, 2, box); - if(!expandsPX) { - fillWithMetadataBlocks(world, box, 11, 1, 2, 12, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); - fillWithMetadataBlocks(world, box, 12, 1, 3, 12, 1, 5, ModBlocks.reinforced_brick_stairs, stairMetaW); - fillWithBlocks(world, box, 13, 1, 2, 13, 1, 5, Blocks.grass); - } else - fillWithMetadataBlocks(world, box, 11, 1, 2, 13, 1, 2, ModBlocks.reinforced_brick_stairs, stairMetaS); - //Main planter with conversation pits - fillWithBlocks(world, box, 1, 1, 7, 2, 1, 11, Blocks.grass); //Planter - fillWithBlocks(world, box, 7, 1, 8, 7, 1, 10, Blocks.grass); - fillWithBlocks(world, box, 12, 1, 7, 13, 1, 10, Blocks.grass); - fillWithBlocks(world, box, 3, 1, 11, 13, 1, 11, Blocks.grass); - fillWithBlocks(world, box, 1, 1, 6, 2, 1, 6, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 3, 1, 6, 3, 1, 7, ModBlocks.reinforced_brick); - fillWithMetadataBlocks(world, box, 6, 1, 7, 8, 1, 7, ModBlocks.reinforced_brick_stairs, stairMetaN); - fillWithBlocks(world, box, 11, 1, 6, 11, 1, 7, ModBlocks.reinforced_brick); - fillWithBlocks(world, box, 12, 1, 6, 13, 1, 6, ModBlocks.reinforced_brick); - for(int i = 3; i <= 8; i += 5) { //Conversation pits - fillWithMetadataBlocks(world, box, i, 1, 10, i + 3, 1, 10, Blocks.spruce_stairs, stairMetaN); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaE, i, 1, 9, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, i, 1, 8, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaW, i + 3, 1, 9, box); - placeBlockAtCurrentPosition(world, Blocks.spruce_stairs, stairMetaS, i + 3, 1, 8, box); - } - //Hanging lights - for(int i = 4; i <= 10; i += 3) { - fillWithBlocks(world, box, i, 4, 9, i, 5, 9, ModBlocks.chain); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_light, 0, i, 3, 9, box); - } - for(int i = 3; i <= 11; i += 8) { - fillWithBlocks(world, box, i, 4, 2, i, 5, 2, ModBlocks.chain); - placeBlockAtCurrentPosition(world, ModBlocks.reinforced_light, 0, i, 3, 2, box); - } - //Plant life - fillWithRandomizedBlocks(world, box, 1, 2, 1, 4, 2, 1, rand, plantSelector); - fillWithRandomizedBlocks(world, box, 10, 2, 1, 13, 2, 1, rand, plantSelector); - fillWithRandomizedBlocks(world, box, 1, 2, 7, 2, 2, 11, rand, plantSelector); - fillWithRandomizedBlocks(world, box, 3, 2, 11, 11, 2, 11, rand, plantSelector); - fillWithRandomizedBlocks(world, box, 12, 2, 7, 13, 2, 11, rand, plantSelector); - fillWithRandomizedBlocks(world, box, 7, 2, 8, 7, 2, 10, rand, plantSelector); - if(!expandsNX) fillWithRandomizedBlocks(world, box, 1, 2, 2, 1, 2, 5, rand, plantSelector); - if(!expandsPX) fillWithRandomizedBlocks(world, box, 13, 2, 2, 13, 2, 5, rand, plantSelector); - break; - } - - if(!underwater) - fillWithCobwebs(world, box, rand, 0, 1, 0, 14, 5, 12); - else { - fillWithWater(world, box, rand, 6, 1, 0, 8, 3, 0, 1); - fillWithWater(world, box, rand, 0, 1, 3, 0, 3, 5, 1); - fillWithWater(world, box, rand, 14, 1, 3, 14, 3, 5, 1); - fillWithWater(world, box, rand, 1, 1, 1, 13, 5, 11, 1); - } - - return true; - //} - } - - /** Finds valid placement, using input information. Should be passed as a method reference to its respective Weight. */ - public static ProceduralComponent findValidPlacement(List components, Random rand, int x, int y, int z, int mode, int type) { - StructureBoundingBox box = getComponentToAddBoundingBox(x, y, z, -6, -1, 0, 15, 8, 13, mode); - return box.minY > 10 && StructureComponent.findIntersecting(components, box) == null ? new CenterCrossing(type, rand, box, mode) : null; - } - } - -} \ No newline at end of file From cd70fc7c10529bc3d8864dacc14d8e4cb8b82303 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sun, 6 Nov 2022 12:45:15 -0800 Subject: [PATCH 29/30] BlockDecoModel moved to BlockEnumMulti, more lore, vinyl tile crafting --- .../java/com/hbm/blocks/BlockEnumMulti.java | 2 +- src/main/java/com/hbm/blocks/BlockEnums.java | 12 ++++ src/main/java/com/hbm/blocks/ModBlocks.java | 11 +-- .../blocks/generic/BlockDecoContainer.java | 57 +++++++-------- .../hbm/blocks/generic/BlockDecoModel.java | 61 ++++------------ .../com/hbm/inventory/gui/GUIBookLore.java | 11 ++- .../com/hbm/items/special/ItemBookLore.java | 5 ++ .../java/com/hbm/lib/HbmChestContents.java | 69 +++---------------- .../java/com/hbm/main/CraftingManager.java | 7 +- .../render/block/RenderBlockDecoModel.java | 4 +- .../render/tileentity/RenderFileCabinet.java | 10 +-- .../hbm/world/worldgen/MapGenNTMFeatures.java | 2 +- .../worldgen/components/CivilianFeatures.java | 1 + .../world/worldgen/components/Component.java | 14 ++-- .../worldgen/components/OfficeFeatures.java | 15 ++-- src/main/resources/assets/hbm/lang/en_US.lang | 30 +++++++- 16 files changed, 142 insertions(+), 169 deletions(-) diff --git a/src/main/java/com/hbm/blocks/BlockEnumMulti.java b/src/main/java/com/hbm/blocks/BlockEnumMulti.java index 94b4d7519..8c92a8384 100644 --- a/src/main/java/com/hbm/blocks/BlockEnumMulti.java +++ b/src/main/java/com/hbm/blocks/BlockEnumMulti.java @@ -41,7 +41,7 @@ public class BlockEnumMulti extends BlockMulti { @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { - return this.icons[meta % this.icons.length]; + return multiTexture ? this.icons[meta % this.icons.length] : this.blockIcon; } @Override diff --git a/src/main/java/com/hbm/blocks/BlockEnums.java b/src/main/java/com/hbm/blocks/BlockEnums.java index 00858aae8..91ddd90e4 100644 --- a/src/main/java/com/hbm/blocks/BlockEnums.java +++ b/src/main/java/com/hbm/blocks/BlockEnums.java @@ -14,8 +14,20 @@ public class BlockEnums { ASBESTOS } + /** DECO / STRUCTURE ENUMS */ + //i apologize in advance + public static enum TileType { LARGE, SMALL } + + public static enum DecoComputerEnum { + IBM_300PL + } + + public static enum DecoCabinetEnum { + GREEN, + STEEL + } } diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index d32485948..ea28c4f5d 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -3,7 +3,8 @@ package com.hbm.blocks; import com.hbm.blocks.generic.*; import com.hbm.blocks.generic.BlockHazard.ExtDisplayEffect; import com.hbm.blocks.generic.BlockMotherOfAllOres.ItemRandomOreBlock; -import com.hbm.blocks.BlockEnums.TileType; +import com.hbm.blocks.BlockEnums.DecoComputerEnum; +import com.hbm.blocks.BlockEnums.*; import com.hbm.blocks.bomb.*; import com.hbm.blocks.fluid.*; import com.hbm.blocks.gas.*; @@ -1680,9 +1681,9 @@ public class ModBlocks { brick_forgotten = new BlockGeneric(Material.rock).setBlockName("brick_forgotten").setCreativeTab(MainRegistry.blockTab).setBlockUnbreakable().setResistance(1000000).setBlockTextureName(RefStrings.MODID + ":brick_forgotten"); - deco_computer = new BlockDecoModel(Material.iron, 1).setBlockBoundsTo(.160749F, 0F, 0F, .839251F, .867849F, .622184F).setBlockName("deco_computer").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_computer"); + deco_computer = new BlockDecoModel(Material.iron, DecoComputerEnum.class, true, false).setBlockBoundsTo(.160749F, 0F, 0F, .839251F, .867849F, .622184F).setBlockName("deco_computer").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_computer"); - filing_cabinet = new BlockDecoContainer(Material.iron, 2, TileEntityFileCabinet.class).setBlockBoundsTo(.1875F, 0F, 0F, .8125F, 1F, .75F).setBlockName("filing_cabinet").setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":block_steel"); + filing_cabinet = new BlockDecoContainer(Material.iron, DecoCabinetEnum.class, true, false, TileEntityFileCabinet.class).setBlockBoundsTo(.1875F, 0F, 0F, .8125F, 1F, .75F).setBlockName("filing_cabinet").setCreativeTab(MainRegistry.blockTab).setHardness(10.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":block_steel"); tape_recorder = new DecoTapeRecorder(Material.iron).setBlockName("tape_recorder").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder"); steel_poles = new DecoSteelPoles(Material.iron).setBlockName("steel_poles").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam"); @@ -2798,8 +2799,8 @@ public class ModBlocks { GameRegistry.registerBlock(brick_dungeon_tile, brick_dungeon_tile.getUnlocalizedName()); GameRegistry.registerBlock(brick_dungeon_circle, brick_dungeon_circle.getUnlocalizedName()); GameRegistry.registerBlock(brick_forgotten, brick_forgotten.getUnlocalizedName()); - GameRegistry.registerBlock(deco_computer, deco_computer.getUnlocalizedName()); - GameRegistry.registerBlock(filing_cabinet, ItemBlockMeta.class, filing_cabinet.getUnlocalizedName()); + GameRegistry.registerBlock(deco_computer, ItemBlockBase.class, deco_computer.getUnlocalizedName()); + GameRegistry.registerBlock(filing_cabinet, ItemBlockBase.class, filing_cabinet.getUnlocalizedName()); GameRegistry.registerBlock(tape_recorder, tape_recorder.getUnlocalizedName()); GameRegistry.registerBlock(steel_poles, steel_poles.getUnlocalizedName()); GameRegistry.registerBlock(pole_top, pole_top.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java b/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java index e9f65a120..9640095d5 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java +++ b/src/main/java/com/hbm/blocks/generic/BlockDecoContainer.java @@ -1,37 +1,40 @@ package com.hbm.blocks.generic; -import java.util.List; import java.util.Random; +import com.hbm.items.ModItems; +import com.hbm.items.tool.ItemLock; import com.hbm.main.MainRegistry; +import com.hbm.tileentity.machine.TileEntityLockableBase; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; import net.minecraft.world.World; + + public class BlockDecoContainer extends BlockDecoModel implements ITileEntityProvider { Class tile; - public BlockDecoContainer(Material mat, int types, Class tile) { - super(mat, types); + public BlockDecoContainer(Material mat, Class theEnum, boolean multiName, boolean multiTexture, Class tile) { + super(mat, theEnum, multiName, multiTexture); this.tile = tile; } + @Override + public int getRenderType() { + return -1; + } + @Override public TileEntity createNewTileEntity(World world, int metadata) { try { @@ -54,30 +57,22 @@ public class BlockDecoContainer extends BlockDecoModel implements ITileEntityPro if(world.isRemote) { return true; - } else if(!player.isSneaking()) { - - FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z); - return true; } else { - return true; + TileEntity entity = world.getTileEntity(x, y, z); + if(entity instanceof TileEntityLockableBase) { //annoying accommodations for the filing cabinet, but whatever, could potentially be useful + if(player.getHeldItem() != null && (player.getHeldItem().getItem() instanceof ItemLock || player.getHeldItem().getItem() == ModItems.key_kit)) + return false; + else if(!player.isSneaking() && ((TileEntityLockableBase) entity).canAccess(player)) { + FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z); + return true; + } + } else if(!player.isSneaking()) { + FMLNetworkHandler.openGui(player, MainRegistry.instance, 0, world, x, y, z); + return true; + } } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) { - super.registerBlockIcons(iconRegister); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) { - return this.blockIcon; - } - - @Override - public int getRenderType() { - return -1; + + return false; } @Override diff --git a/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java b/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java index 78320789c..019d2dc2c 100644 --- a/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java +++ b/src/main/java/com/hbm/blocks/generic/BlockDecoModel.java @@ -2,6 +2,7 @@ package com.hbm.blocks.generic; import java.util.List; +import com.hbm.blocks.BlockEnumMulti; import com.hbm.lib.RefStrings; import cpw.mods.fml.client.registry.RenderingRegistry; @@ -20,56 +21,14 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class BlockDecoModel extends Block { +public class BlockDecoModel extends BlockEnumMulti { - //Allows between 1-4 differently colored/textured sub-blocks altogether. - int subTypes; - - public BlockDecoModel(Material mat, int types) { - super(mat); - subTypes = types; - } - - @SideOnly(Side.CLIENT) - protected IIcon[] icons; - - @Override - public int damageDropped(int meta) { - return meta & 12; - } - - @Override - @SideOnly(Side.CLIENT) - public void getSubBlocks(Item item, CreativeTabs tabs, List list) { - for(byte i = 0; i < subTypes; i++) { - list.add(new ItemStack(item, 1, i << 2)); - } - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) { - super.registerBlockIcons(iconRegister); - icons = new IIcon[subTypes]; - - if(subTypes == 1) - return; - - for(byte i = 0; i < subTypes; i++) - icons[i] = iconRegister.registerIcon(this.textureName + "_" + i); - } - - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) { - if(subTypes > 1) - return this.icons[(meta >> 2) % this.icons.length]; - - return this.blockIcon; + public BlockDecoModel(Material mat, Class theEnum, boolean multiName, boolean multiTexture) { + super(mat, theEnum, multiName, multiTexture); } public static int renderID = RenderingRegistry.getNextAvailableRenderId(); - + @Override public int getRenderType() { return renderID; @@ -105,7 +64,12 @@ public class BlockDecoModel extends Block { meta = 3; //For East(b01>b11), just set to 3 } - world.setBlockMetadataWithNotify(x, y, z, meta | stack.getItemDamage(), 2); + world.setBlockMetadataWithNotify(x, y, z, (meta << 2) | stack.getItemDamage(), 2); + } + + @Override + public int damageDropped(int meta) { + return meta & 3; } //These are separate because they have to be constant @@ -129,7 +93,7 @@ public class BlockDecoModel extends Block { @Override public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) { - switch(world.getBlockMetadata(x, y, z) & 3) { + switch(world.getBlockMetadata(x, y, z) >> 2) { case 0://North this.setBlockBounds(1 - mxX, mnY, 1 - mxZ, 1 - mnX, mxY, 1 - mnZ); break; @@ -150,5 +114,4 @@ public class BlockDecoModel extends Block { this.setBlockBoundsBasedOnState(world, x, y, z); return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ); } - } \ No newline at end of file diff --git a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java index 329d470dc..85f3658f4 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIBookLore.java +++ b/src/main/java/com/hbm/inventory/gui/GUIBookLore.java @@ -23,7 +23,6 @@ import net.minecraft.world.World; // and I would answer, shut the fuck up nerd, the guide book system is too involved for my small // brain to use for god knows how many tidbits of lore. i'll settle for a text box and cool textures, thanks public class GUIBookLore extends GuiScreen { - //TODO: refactor some of these variables protected int xSize; protected int ySize; protected int guiLeft; @@ -252,7 +251,17 @@ public class GUIBookLore extends GuiScreen { int indent = renderer.getStringWidth(words[0]); for(int w = 1; w < words.length; w++) { + + if(words[w].equals("$")) { + if(w + 1 < words.length && !words[w + 1].equals("$")) { + lines.add(words[++w]); + indent = renderer.getStringWidth(words[w]); + } else + lines.add(""); + continue; + } + indent += renderer.getStringWidth(" " + words[w]); if(indent <= widthScaled) { diff --git a/src/main/java/com/hbm/items/special/ItemBookLore.java b/src/main/java/com/hbm/items/special/ItemBookLore.java index 5c40c867d..9dc5cc635 100644 --- a/src/main/java/com/hbm/items/special/ItemBookLore.java +++ b/src/main/java/com/hbm/items/special/ItemBookLore.java @@ -126,6 +126,11 @@ public class ItemBookLore extends Item implements IGUIProvider { public String resolveKey(String key, NBTTagCompound tag) { return I18nUtil.resolveKey(key, tag.getInteger("mku_slot")); }}, + RESIGNATION_NOTE(true, "resignation_note", 3, GUIAppearance.NOTEBOOK), + MEMO_STOCKS(false, "memo_stocks", 1, GUIAppearance.LOOSEPAPER), + MEMO_SCHRAB_GSA(false, "memo_schrab_gsa", 2, GUIAppearance.LOOSEPAPERS), + MEMO_SCHRAB_RD(false, "memo_schrab_rd", 4, GUIAppearance.LOOSEPAPERS), + MEMO_SCHRAB_NUKE(true, "memo_schrab_nuke", 3, GUIAppearance.LOOSEPAPERS), ; //Why? it's quite simple; i am too burnt out and also doing it the other way diff --git a/src/main/java/com/hbm/lib/HbmChestContents.java b/src/main/java/com/hbm/lib/HbmChestContents.java index 80b520b54..7bed23262 100644 --- a/src/main/java/com/hbm/lib/HbmChestContents.java +++ b/src/main/java/com/hbm/lib/HbmChestContents.java @@ -6,6 +6,7 @@ import com.hbm.blocks.ModBlocks; import com.hbm.inventory.fluid.Fluids; import com.hbm.items.ModItems; import com.hbm.items.machine.ItemBreedingRod.*; +import com.hbm.items.special.ItemBookLore.BookLoreType; import net.minecraft.init.Items; import net.minecraft.item.Item; @@ -368,67 +369,15 @@ public class HbmChestContents { new WeightedRandomChestContent(ModItems.ink, 0, 1, 1, 1), //make that mf rare; 1:555 weight }; - public static WeightedRandomChestContent[] bedroom1 = new WeightedRandomChestContent[] { //soda enjoyer who really needs to charge their radio - new WeightedRandomChestContent(ModItems.can_empty, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.can_creature, 0, 1, 2, 2), - new WeightedRandomChestContent(ModItems.can_smart, 0, 1, 3, 2), - new WeightedRandomChestContent(ModItems.can_mrsugar, 0, 1, 2, 2), - new WeightedRandomChestContent(ModItems.med_ipecac, 0, 1, 1, 1), - new WeightedRandomChestContent(ModItems.radx, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.dust_tiny, 0, 1, 3, 2), - new WeightedRandomChestContent(ModItems.dust, 0, 1, 1, 1), - new WeightedRandomChestContent(Items.paper, 0, 1, 12, 7), - new WeightedRandomChestContent(Items.book, 0, 1, 3, 5), - new WeightedRandomChestContent(ModItems.battery_su, 0, 1, 1, 3), - new WeightedRandomChestContent(ModItems.canteen_13, 0, 1, 1, 1), + /** ITEMBOOKLORE ARRAYS */ + //might make a wrapper class for this, if game-state knowledge using the nbt system becomes that relevant + public final static BookLoreType[] books_office_sch = new BookLoreType[] { + BookLoreType.RESIGNATION_NOTE, + BookLoreType.MEMO_STOCKS, + BookLoreType.MEMO_SCHRAB_GSA, + BookLoreType.MEMO_SCHRAB_RD, + BookLoreType.MEMO_SCHRAB_NUKE, }; - public static WeightedRandomChestContent[] bedroom2 = new WeightedRandomChestContent[] { //overworking nuka-cola enthusiast - new WeightedRandomChestContent(ModItems.twinkie, 0, 1, 3, 7), - new WeightedRandomChestContent(ModItems.coffee, 0, 1, 1, 5), - new WeightedRandomChestContent(ModItems.bottle_nuka, 0, 1, 1, 3), - new WeightedRandomChestContent(ModItems.bottle_quantum, 0, 1, 1, 4), - new WeightedRandomChestContent(ModItems.bottle_cherry, 0, 1, 1, 3), - new WeightedRandomChestContent(ModItems.bottle_opener, 0, 1, 1, 3), - new WeightedRandomChestContent(ModItems.radaway, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.dust_tiny, 0, 1, 3, 2), - new WeightedRandomChestContent(ModItems.dust, 0, 1, 1, 1), - new WeightedRandomChestContent(ModItems.battery_su_l, 0, 1, 1, 1), - new WeightedRandomChestContent(Items.paper, 0, 1, 12, 10), - new WeightedRandomChestContent(Items.book, 0, 1, 3, 5), - new WeightedRandomChestContent(ModItems.canteen_13, 0, 1, 1, 1), - }; - - public static WeightedRandomChestContent[] bedroom3 = new WeightedRandomChestContent[] { //secretly alcoholic journaling fan who drinks straight from the canister - new WeightedRandomChestContent(Items.writable_book, 0, 1, 12, 10), - new WeightedRandomChestContent(Items.feather, 0, 1, 2, 5), - new WeightedRandomChestContent(new ItemStack(ModItems.canister_full, 1, Fluids.ETHANOL.getID()), 1, 2, 10), - new WeightedRandomChestContent(ModItems.scrumpy, 0, 1, 1, 1), - new WeightedRandomChestContent(ModItems.dust_tiny, 0, 1, 3, 3), - new WeightedRandomChestContent(ModItems.dust, 0, 1, 1, 2), - new WeightedRandomChestContent(Items.paper, 0, 1, 12, 10), - new WeightedRandomChestContent(Items.book, 0, 1, 3, 10), - new WeightedRandomChestContent(ModItems.canteen_13, 0, 1, 1, 2), - }; - - public static WeightedRandomChestContent[] bedroom4 = new WeightedRandomChestContent[] { //gun nut with a knack for self-made weapons - new WeightedRandomChestContent(ModItems.armor_polish, 0, 1, 1, 3), - new WeightedRandomChestContent(ModItems.gun_kit_1, 0, 1, 2, 2), - new WeightedRandomChestContent(ModItems.mechanism_revolver_1, 0, 1, 2, 2), - new WeightedRandomChestContent(ModItems.mechanism_revolver_2, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.mechanism_rifle_1, 0, 1, 2, 1), - new WeightedRandomChestContent(ModItems.mechanism_rifle_2, 0, 1, 1, 1), - new WeightedRandomChestContent(ModItems.battery_su_l, 0, 1, 1, 1), - new WeightedRandomChestContent(ModItems.bolt_tungsten, 0, 1, 4, 1), - new WeightedRandomChestContent(ModItems.wire_aluminium, 0, 1, 5, 1), - new WeightedRandomChestContent(ModItems.steel_plate, 0, 1, 3, 1), - new WeightedRandomChestContent(ModItems.screwdriver, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.wrench, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.hand_drill, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.clip_revolver_nopip, 0, 1, 1, 2), - new WeightedRandomChestContent(ModItems.ammo_20gauge, 0, 1, 8, 2), - new WeightedRandomChestContent(ModItems.gun_revolver_nopip, 0, 1, 1, 3), - new WeightedRandomChestContent(ModItems.canteen_13, 0, 1, 1, 1), - }; } diff --git a/src/main/java/com/hbm/main/CraftingManager.java b/src/main/java/com/hbm/main/CraftingManager.java index 30977623a..fad8be6de 100644 --- a/src/main/java/com/hbm/main/CraftingManager.java +++ b/src/main/java/com/hbm/main/CraftingManager.java @@ -3,6 +3,7 @@ package com.hbm.main; import java.util.ArrayList; import java.util.List; +import com.hbm.blocks.BlockEnums.DecoCabinetEnum; import com.hbm.blocks.ModBlocks; import com.hbm.blocks.generic.BlockGenericStairs; import com.hbm.blocks.generic.BlockMultiSlab; @@ -975,7 +976,11 @@ public class CraftingManager { addRecipeAuto(new ItemStack(ModBlocks.brick_fire), new Object[] { "BB", "BB", 'B', ModItems.ingot_firebrick }); addShapelessAuto(new ItemStack(ModItems.ingot_firebrick, 4), new Object[] { ModBlocks.brick_fire }); - addRecipeAuto(new ItemStack(ModBlocks.filing_cabinet, 1, 4), new Object[] { " P ", "PIP", " P ", 'P', STEEL.plate(), 'I', ModItems.plate_polymer }); + addRecipeAuto(new ItemStack(ModBlocks.filing_cabinet, 1, DecoCabinetEnum.STEEL.ordinal()), new Object[] { " P ", "PIP", " P ", 'P', STEEL.plate(), 'I', ModItems.plate_polymer }); + + addRecipeAuto(new ItemStack(ModBlocks.vinyl_tile, 4), new Object[] { " I ", "IBI", " I ", 'I', ModItems.plate_polymer, 'B', ModBlocks.brick_light }); + addRecipeAuto(new ItemStack(ModBlocks.vinyl_tile, 4, 1), new Object[] { "BB", "BB", 'B', new ItemStack(ModBlocks.vinyl_tile, 1, 0) }); + addShapelessAuto(new ItemStack(ModBlocks.vinyl_tile), new Object[] { new ItemStack(ModBlocks.vinyl_tile, 1, 1) }); addShapelessAuto(new ItemStack(ModItems.upgrade_5g), new Object[] { ModItems.upgrade_template, ModItems.gem_alexandrite }); diff --git a/src/main/java/com/hbm/render/block/RenderBlockDecoModel.java b/src/main/java/com/hbm/render/block/RenderBlockDecoModel.java index 660cf8f13..171cba047 100644 --- a/src/main/java/com/hbm/render/block/RenderBlockDecoModel.java +++ b/src/main/java/com/hbm/render/block/RenderBlockDecoModel.java @@ -50,7 +50,7 @@ public class RenderBlockDecoModel implements ISimpleBlockRenderingHandler { Tessellator tessellator = Tessellator.instance; int meta = world.getBlockMetadata(x, y, z); - IIcon iicon = block.getIcon(0, meta & 12); + IIcon iicon = block.getIcon(0, meta & 3); tessellator.setColorOpaque_F(1, 1, 1); if(renderer.hasOverrideBlockTexture()) { @@ -62,7 +62,7 @@ public class RenderBlockDecoModel implements ISimpleBlockRenderingHandler { float rotation = 0; - switch(meta & 3) { + switch(meta >> 2) { default: //North rotation = (float) Math.PI; break; case 1: //South diff --git a/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java b/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java index bbe0119b6..4793c46fb 100644 --- a/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java +++ b/src/main/java/com/hbm/render/tileentity/RenderFileCabinet.java @@ -23,7 +23,7 @@ public class RenderFileCabinet extends TileEntitySpecialRenderer implements IIte GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_CULL_FACE); - switch(tile.getBlockMetadata() & 3) { //rotation + switch(tile.getBlockMetadata() >> 2) { //rotation case 0: GL11.glRotatef(180, 0F, 1F, 0F); break; @@ -38,8 +38,8 @@ public class RenderFileCabinet extends TileEntitySpecialRenderer implements IIte break; } - switch(tile.getBlockMetadata() >> 2) { - case 0: + switch(tile.getBlockMetadata() & 3) { + default: bindTexture(ResourceManager.file_cabinet_tex); break; case 1: bindTexture(ResourceManager.file_cabinet_steel_tex); //sadge @@ -81,8 +81,8 @@ public class RenderFileCabinet extends TileEntitySpecialRenderer implements IIte GL11.glTranslated(0, -1.25D, 0); GL11.glScaled(2.75D, 2.75D, 2.75D); - switch(stack.getItemDamage() >> 2) { - case 0: + switch(stack.getItemDamage()) { + default: bindTexture(ResourceManager.file_cabinet_tex); break; case 1: bindTexture(ResourceManager.file_cabinet_steel_tex); diff --git a/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java b/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java index f578cb70c..cba55afdf 100644 --- a/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/MapGenNTMFeatures.java @@ -139,7 +139,7 @@ public class MapGenNTMFeatures extends MapGenStructure { NTMWorkshop1 workshop1 = new NTMWorkshop1(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); this.components.add(workshop1); } else { //Everything else - switch(rand.nextInt(3)) { + switch(rand.nextInt(4)) { case 0: NTMLab2 lab2 = new NTMLab2(rand, chunkX * 16 + 8, posY, chunkZ * 16 + 8); this.components.add(lab2); break; diff --git a/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java b/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java index bbd9bab87..05b02c604 100644 --- a/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/CivilianFeatures.java @@ -568,6 +568,7 @@ public class CivilianFeatures { this.fillWithBlocks(world, box, sizeX - 4, 3, sizeZ - 2, sizeX - 2, 3, sizeZ - 2, ModBlocks.steel_roof, Blocks.air, false); if(!hasPlacedLoot[1]) { this.hasPlacedLoot[1] = this.generateInvContents(world, box, rand, ModBlocks.crate_iron, sizeX - 2, 1, 3, HbmChestContents.nukeTrash, 9); + generateLoreBook(world, box, rand, sizeX - 2, 1, 3, 1, HbmChestContents.books_office_sch); } return true; diff --git a/src/main/java/com/hbm/world/worldgen/components/Component.java b/src/main/java/com/hbm/world/worldgen/components/Component.java index 88b8dd3bf..fb9c13813 100644 --- a/src/main/java/com/hbm/world/worldgen/components/Component.java +++ b/src/main/java/com/hbm/world/worldgen/components/Component.java @@ -8,6 +8,8 @@ import com.hbm.blocks.generic.BlockBobble.BobbleType; import com.hbm.blocks.generic.BlockBobble.TileEntityBobble; import com.hbm.config.StructureConfig; import com.hbm.handler.MultiblockHandlerXR; +import com.hbm.items.ModItems; +import com.hbm.items.special.ItemBookLore.BookLoreType; import com.hbm.lib.HbmChestContents; import com.hbm.tileentity.machine.TileEntityLockableBase; import com.hbm.tileentity.machine.storage.TileEntityCrateIron; @@ -194,7 +196,7 @@ abstract public class Component extends StructureComponent { break; } - return metadata; + return metadata << 2; //To accommodate for BlockDecoModel's shift in the rotation bits; otherwise, simply bit-shift right and or any non-rotation meta after } /** @@ -369,7 +371,7 @@ abstract public class Component extends StructureComponent { return false; } - protected void generateLoreBook(World world, StructureBoundingBox box, int featureX, int featureY, int featureZ, int slot, String key) { + protected void generateLoreBook(World world, StructureBoundingBox box, Random rand, int featureX, int featureY, int featureZ, int slot, BookLoreType[] books) { int posX = this.getXWithOffset(featureX, featureZ); int posY = this.getYWithOffset(featureY); int posZ = this.getZWithOffset(featureX, featureZ); @@ -377,9 +379,11 @@ abstract public class Component extends StructureComponent { IInventory inventory = (IInventory) world.getTileEntity(posX, posY, posZ); if(inventory != null) { - //ItemStack book = HbmChestContents.genetateBook(key); - //TODO: replace this with ItemBookLore version - //inventory.setInventorySlotContents(slot, book); + ItemStack book = new ItemStack(ModItems.book_lore); + int i = rand.nextInt(books.length); + + BookLoreType.setTypeForStack(book, books[i]); + inventory.setInventorySlotContents(slot, book); } } diff --git a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java index ee632225a..25bba3f1b 100644 --- a/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java +++ b/src/main/java/com/hbm/world/worldgen/components/OfficeFeatures.java @@ -208,13 +208,12 @@ public class OfficeFeatures { //Woot if(!this.hasPlacedLoot[0]) - this.hasPlacedLoot[0] = generateInvContents(world, box, rand, Blocks.chest, sizeX - 4, 1, sizeZ - 1, HbmChestContents.officeTrash, 10); + this.hasPlacedLoot[0] = generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), sizeX - 4, 1, sizeZ - 1, HbmChestContents.officeTrash, 8); if(!this.hasPlacedLoot[1]) { - this.hasPlacedLoot[1] = generateLockableContents(world, box, rand, ModBlocks.safe, 6, 1, 1, HbmChestContents.machineParts, 10, 0.5D); - generateLoreBook(world, box, 6, 1, 1, 7, "office" + rand.nextInt(1)); + this.hasPlacedLoot[1] = generateLockableContents(world, box, rand, ModBlocks.safe, getDecoMeta(3), 6, 1, 1, HbmChestContents.machineParts, 10, 0.5D); + generateLoreBook(world, box, rand, 6, 1, 1, 7, HbmChestContents.books_office_sch); } - //TODO: add book with funny lore to safe, add cobwebs too //0b00/0 West, 0b01/1 East, 0b10/2 North, 0b11/3 South, 0b100/4 West UD, 0b101 East UD, 0b110 North UD, 0b111 South UD return true; } @@ -527,7 +526,6 @@ public class OfficeFeatures { placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 5, 13, 9, box); placeBlockAtCurrentPosition(world, Blocks.flower_pot, 0, 7, 13, 11, box); - //almost certainly a fucking astronomically better way to do this generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(3), 9, 1, 7, HbmChestContents.filingCabinet, 4); generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(1), 7, 5, 4, HbmChestContents.filingCabinet, 4); generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(1), 7, 6, 4, HbmChestContents.filingCabinet, 4); @@ -535,14 +533,19 @@ public class OfficeFeatures { generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 10, 5, 12, HbmChestContents.filingCabinet, 4); generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 10, 6, 12, HbmChestContents.filingCabinet, 4); generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 2, 9, 5, HbmChestContents.filingCabinet, 4); + generateLockableContents(world, box, rand, ModBlocks.safe, getDecoMeta(2), 1, 9, 13, HbmChestContents.officeTrash, 10, 1.0D); + generateLoreBook(world, box, rand, 1, 9, 13, 7, HbmChestContents.books_office_sch); + generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 2, 9, 13, HbmChestContents.filingCabinet, 4); generateInvContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 3, 9, 13, HbmChestContents.filingCabinet, 4); generateLockableContents(world, box, rand, ModBlocks.filing_cabinet, getDecoModelMeta(0), 3, 10, 13, HbmChestContents.expensive, 8, 0.1D); placeBlockAtCurrentPosition(world, ModBlocks.deco_loot, 0, 6, 13, 11, box); LootGenerator.lootCapStash(world, this.getXWithOffset(6, 11), this.getYWithOffset(13), this.getZWithOffset(6, 11)); - + placeBlockAtCurrentPosition(world, ModBlocks.deco_loot, 0, 1, 10, 11, box); + LootGenerator.lootMedicine(world, this.getXWithOffset(1, 11), this.getYWithOffset(10), this.getZWithOffset(1, 11)); + //this hurt my soul return true; diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index adcadbee4..bc78aee2b 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -355,6 +355,31 @@ book_lore.book_syringe.author=Dave book_lore.book_syringe.page.1=a little addendum to my fifth message, obviously you have to store this MKU stuff in a container. the R&D nuts used regular metal syringes that they got from medical. surplus ware i presume, they got thousands of needles just lying around. the metal book_lore.book_syringe.page.2=syringe goes into slot %d +book_lore.resignation_note.name=Letter of Resignation +book_lore.resignation_note.author=Kosma +book_lore.resignation_note.page.1=Management downsized our department again yesterday. Those idiots only have themselves to blame, I don't know what they were expecting after that fiasco. Who the hell leaks that sort of information? We're losing millions and +book_lore.resignation_note.page.2=it's ME who's the one out of a job now. I'M the one being asked to resign. I hope you asshats finally learn from your overabundance of mistakes and take that stick out of your ass. +book_lore.resignation_note.page.3=I'm not coming back on Friday. Just send the paycheck. + +book_lore.memo_stocks.name=Intracorporate Memorandum +book_lore.memo_stocks.page.1=Investor Relations - $ $ There's been some glaring discrepancies in the figures provided for the latest quarterly report. It would be prudent for the financial department to make some adjustments, so there won't be any concern. + +book_lore.memo_schrab_gsa.name=Internal Memorandum +book_lore.memo_schrab_gsa.page.1=Contract Management - $ $ Legal has made a breakthrough with the DLA. They've awarded us with a 45 BILLION GSA Schedule for further procurement and research of saralloy. At current estimates, that would be at minimum +book_lore.memo_schrab_gsa.page.2=a 40%% profit on related operations, let alone the possibility of future contracts. Due to the confidential nature, all fiscal evidence is to remain private. + +book_lore.memo_schrab_rd.name=Internal Memorandum +book_lore.memo_schrab_rd.page.1=Research & Development - $ $ Our main production method of saralloy has been through the new particle accelerator. However, the energy costs are exorbitantly high compared to the amount of output. +book_lore.memo_schrab_rd.page.2=Doctor Schrabauer, however, has discovered a new interaction - called "Strange Lepton Oscillation" - that could significantly reduce costs. Through a not entirely understood process, supplied electrons are transmuted into extremely +book_lore.memo_schrab_rd.page.3=high-energy photons, through a strange charm. This is an extreme exception to many established particle conversion laws, but preliminary experiments have proved that these protons transmute into up and down quarks, eventually creating saralloy. +book_lore.memo_schrab_rd.page.4=Strangely, the prototype requires Tungsten alloyed with small amounts of saralloy. In addition, a special capacitor is required to negate the leftover positive charge. + +book_lore.memo_schrab_nuke.name=Research Report +book_lore.memo_schrab_nuke.author=Doctor Schrabauer +book_lore.memo_schrab_nuke.page.1=Our most recent investigation led us to the effects of nuclear explosions on materials. Thanks to our grant money, we *accidentally* tested our theory on direct saralloy synthesis from uranium. +book_lore.memo_schrab_nuke.page.2=Only our cyclotron has actually created saralloy previously. However, at our underground shot at Everwerpen, miniscule traces of saralloy were found in uranium ore at the site. All pure, metallic uranium nearby had fissioned. +book_lore.memo_schrab_nuke.page.3=As such, given enough uranium ore concentrated around an explosive, or perhaps even a dirty bomb rich in waste containing fissionable material, one could hypothetically create enough saralloy to collect manually. + cannery.f1=[ Press F1 for help ] cannery.centrifuge=Gas Centrifuge @@ -3885,7 +3910,7 @@ tile.crystal_virus.name=Dark Crystal tile.deco_aluminium.name=Aluminium Deco Block tile.deco_asbestos.name=Asbestos Roof tile.deco_beryllium.name=Beryllium Deco Block -tile.deco_computer.name=IBM Personal Computer 300PL +tile.deco_computer.ibm_300pl.name=IBM Personal Computer 300PL tile.deco_emitter.name=Deco Light Emitter tile.deco_lead.name=Lead Deco Block tile.deco_rbmk.name=RBMK Deco Block @@ -3956,7 +3981,8 @@ tile.factory_titanium_hull.name=Factory Block tile.fallout.name=Fallout tile.fence_metal.name=Chainlink Fence tile.field_disturber.name=High Energy Field Jammer -tile.filing_cabinet.name=Filing Cabinet +tile.filing_cabinet.green.name=Dusty Filing Cabinet +tile.filing_cabinet.steel.name=Steel Filing Cabinet tile.fire_digamma.name=Lingering Digamma tile.fire_door.name=Fire Door tile.fireworks.name=Firework Battery From 3e0af26a30be10f4dc9ceaec8ea63a2c4deba328 Mon Sep 17 00:00:00 2001 From: Vaern Date: Sun, 6 Nov 2022 12:51:50 -0800 Subject: [PATCH 30/30] ach --- src/main/java/com/hbm/blocks/ModBlocks.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index ea28c4f5d..9788eb1ba 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -3,7 +3,6 @@ package com.hbm.blocks; import com.hbm.blocks.generic.*; import com.hbm.blocks.generic.BlockHazard.ExtDisplayEffect; import com.hbm.blocks.generic.BlockMotherOfAllOres.ItemRandomOreBlock; -import com.hbm.blocks.BlockEnums.DecoComputerEnum; import com.hbm.blocks.BlockEnums.*; import com.hbm.blocks.bomb.*; import com.hbm.blocks.fluid.*;