From 7e8611bebcd3f488a9032ea998c22b1896c6a8be Mon Sep 17 00:00:00 2001 From: Vaern Date: Sun, 16 Oct 2022 20:28:07 -0700 Subject: [PATCH] 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