diff --git a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index b21759af..8c1211cf 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -496,12 +496,18 @@ public class AlchemicalWizardry { public static boolean disableBoundToolsRightClick; public static boolean allowPotionRepair; - public static BlockStack[] secondTierRunes = new BlockStack[10]; - public static BlockStack[] thirdTierRunes = new BlockStack[10]; - public static BlockStack[] fourthTierRunes = new BlockStack[10]; - public static BlockStack[] fifthTierRunes = new BlockStack[10]; - public static BlockStack[] sixthTierRunes = new BlockStack[10]; - public static BlockStack[] specialAltarBlock = new BlockStack[7]; + public static List secondTierRunes; + public static List thirdTierRunes; + public static List fourthTierRunes; + public static List fifthTierRunes; + public static List sixthTierRunes; + public static List fifthTierBeacons; + public static List thirdTierCaps; + public static List thirdTierPillars; + public static List fourthTierCaps; + public static List fourthTierPillars; + public static List sixthTierCaps; + public static List sixthTierPillars; public static int lpPerSelfSacrifice = 200; public static int lpPerSelfSacrificeSoulFray = 20; diff --git a/src/main/java/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java b/src/main/java/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java index ba48df4d..bafcd85e 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java +++ b/src/main/java/WayofTime/alchemicalWizardry/BloodMagicConfiguration.java @@ -16,7 +16,6 @@ import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.monster.EntitySlime; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityVillager; -import net.minecraft.init.Blocks; import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Property; import net.minecraftforge.oredict.OreDictionary; @@ -624,66 +623,63 @@ public class BloodMagicConfiguration { } public static void finishLoading() { - AlchemicalWizardry.secondTierRunes = BloodMagicConfiguration.getAltarRunesForTier( - "secondTier", - new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), - new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), - new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), - new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), - new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5), - new BlockStack(ModBlocks.bloodRune, 6) }); - AlchemicalWizardry.thirdTierRunes = BloodMagicConfiguration.getAltarRunesForTier( - "thirdTier", - new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), - new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), - new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), - new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), - new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5), - new BlockStack(ModBlocks.bloodRune, 6) }); - AlchemicalWizardry.fourthTierRunes = BloodMagicConfiguration.getAltarRunesForTier( - "fourthTier", - new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), - new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), - new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), - new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), - new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5), - new BlockStack(ModBlocks.bloodRune, 6) }); - AlchemicalWizardry.fifthTierRunes = BloodMagicConfiguration.getAltarRunesForTier( - "fifthTier", - new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), - new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), - new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), - new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), - new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5), - new BlockStack(ModBlocks.bloodRune, 6) }); - AlchemicalWizardry.sixthTierRunes = BloodMagicConfiguration.getAltarRunesForTier( - "sixthTier", - new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), - new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), - new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), - new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), - new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5), - new BlockStack(ModBlocks.bloodRune, 6) }); - AlchemicalWizardry.specialAltarBlock = getAltarRunesForTier( - "specialBlocks", - new BlockStack[] { new BlockStack(Blocks.air, 0), new BlockStack(Blocks.glowstone, 0), - new BlockStack(Blocks.air, 0), new BlockStack(ModBlocks.largeBloodStoneBrick, 0), - new BlockStack(Blocks.beacon, 0), new BlockStack(Blocks.air, 0), - new BlockStack(ModBlocks.blockCrystal, 0) }, - "Set the special blocks for the altar with the format mod:block(:meta) in the following order:\n" - + "Tier 3 pillar\n" - + "Tier 3 cap\n" - + "Tier 4 pillar\n" - + "Tier 4 cap\n" - + "Tier 5 beacon\n" - + "Tier 6 pillar\n" - + "Tier 6 cap\n" - + "Set any of these to minecraft:air to allow for that component to be any block EXCEPT air (e.g., let any block be used for a pillar)."); + String[] defaultRunes = { "AWWayofTime:AlchemicalWizardrybloodRune", "AWWayofTime:speedRune", + "AWWayofTime:efficiencyRune", "AWWayofTime:runeOfSacrifice", "AWWayofTime:runeOfSelfSacrifice", + "AWWayofTime:AlchemicalWizardrybloodRune:1", "AWWayofTime:AlchemicalWizardrybloodRune:2", + "AWWayofTime:AlchemicalWizardrybloodRune:3", "AWWayofTime:AlchemicalWizardrybloodRune:4", + "AWWayofTime:AlchemicalWizardrybloodRune:5", "AWWayofTime:AlchemicalWizardrybloodRune:6" }; + + AlchemicalWizardry.secondTierRunes = readRuneOverrides("secondTier", defaultRunes); + AlchemicalWizardry.thirdTierRunes = readRuneOverrides("thirdTier", defaultRunes); + AlchemicalWizardry.fourthTierRunes = readRuneOverrides("fourthTier", defaultRunes); + AlchemicalWizardry.fifthTierRunes = readRuneOverrides("fifthTier", defaultRunes); + AlchemicalWizardry.sixthTierRunes = readRuneOverrides("sixthTier", defaultRunes); + + AlchemicalWizardry.fifthTierBeacons = readBlockConfig( + "altar blocks", + "fifthTierBeacons", + new String[] { "minecraft:beacon", "etfuturum:beacon", "chisel:beacon:*" }, + "Valid blocks for the Blood Altar's tier 5 beacons:\n" + + "Use the following format for all of these entries: mod:block(:meta). Meta * or 32767 allows for any meta.\n" + + "An empty entry allows for any non-air block to be used for that part of the structure.\n" + + "Invalid or missing blocks are skipped. If all entries are invalid, any block can be used as a fallback."); + AlchemicalWizardry.thirdTierCaps = readBlockConfig( + "altar blocks", + "thirdTierCaps", + new String[] { "minecraft:glowstone", "BloodArsenal:blood_infused_glowstone", "Botania:seaLamp", + "chisel:glowstone:*", "etfuturum:sea_lantern", "etfuturum:shroomlight", + "ExtraUtilities:color_lightgem:*" }, + "Valid blocks for the Blood Altar's tier 3 caps:"); + AlchemicalWizardry.thirdTierPillars = readBlockConfig( + "altar blocks", + "thirdTierPillars", + new String[] {}, + "Valid blocks for the Blood Altar's tier 3 pillars:"); + AlchemicalWizardry.fourthTierCaps = readBlockConfig( + "altar blocks", + "fourthTierCaps", + new String[] { "AWWayofTime:largeBloodStoneBrick" }, + "Valid blocks for the Blood Altar's tier 4 caps:"); + AlchemicalWizardry.fourthTierPillars = readBlockConfig( + "altar blocks", + "fourthTierPillars", + new String[] {}, + "Valid blocks for the Blood Altar's tier 4 pillars."); + AlchemicalWizardry.sixthTierCaps = readBlockConfig( + "altar blocks", + "sixthTierCaps", + new String[] { "AWWayofTime:blockCrystal" }, + "Valid blocks for the Blood Altar's tier 6 caps:"); + AlchemicalWizardry.sixthTierPillars = readBlockConfig( + "altar blocks", + "sixthTierPillars", + new String[] {}, + "Valid blocks for the Blood Altar's tier 6 pillars:"); config.save(); } public static void loadCustomLPValues() { - AlchemicalWizardry.lpPerSactificeCustom = new HashMap, Integer>(); + AlchemicalWizardry.lpPerSactificeCustom = new HashMap<>(); for (Object object : EntityList.stringToClassMapping.entrySet()) { Entry entry = (Entry) object; String entityName = (String) entry.getKey(); @@ -798,7 +794,6 @@ public class BloodMagicConfiguration { // Check if it's an int, if so, parse it. If not, set meta to 0 to avoid crashing. if (isInteger(blockData[2])) meta = Integer.parseInt(blockData[2]); else if (blockData[2].equals("*")) meta = OreDictionary.WILDCARD_VALUE; - else meta = 0; } AlchemicalWizardryEventHooks.teleposerBlacklist.add(new BlockStack(block, meta)); @@ -808,53 +803,43 @@ public class BloodMagicConfiguration { private static boolean isInteger(String s) { try { Integer.parseInt(s); - } catch (NumberFormatException e) { - return false; - } catch (NullPointerException e) { + } catch (NumberFormatException | NullPointerException e) { return false; } - // only got here if we didn't return false return true; } - private static BlockStack[] getAltarRunesForTier(String tierName, BlockStack[] defaultValues) { - return getAltarRunesForTier(tierName, defaultValues, ""); + private static List readRuneOverrides(String key, String[] defaultValues) { + return readBlockConfig("rune overrides", key, defaultValues, ""); } - private static BlockStack[] getAltarRunesForTier(String tierName, BlockStack[] defaultValues, String comment) { - String[] defaultNames = new String[defaultValues.length]; - for (int i = 0; i < defaultValues.length; i++) { - defaultNames[i] = Block.blockRegistry.getNameForObject(defaultValues[i].getBlock()) + ":" - + defaultValues[i].getMeta(); - } - Property property = config.get("rune overrides", tierName, defaultNames, comment); - String[] names = property.getStringList(); - if (names.length != defaultNames.length) { - property.set(defaultNames); - return defaultValues; - } - BlockStack[] blockStacks = new BlockStack[names.length]; - for (int i = 0; i < names.length; i++) { - String[] parts = names[i].split(":"); - if (parts.length < 2 || parts.length > 3) { - property.set(defaultNames); - return defaultValues; - } - Block block = GameRegistry.findBlock(parts[0], parts[1]); - int metadata = 0; - if (parts.length == 3) { - try { - metadata = Integer.parseInt(parts[2]); - } catch (NumberFormatException exception) { - metadata = 0; - } + private static List readBlockConfig(String category, String key, String[] defaultValues, + String comment) { + Property property = config.get(category, key, defaultValues, comment); + List validStacks = new ArrayList<>(); + + for (String name : property.getStringList()) { + String[] blockData = name.split(":"); + if (blockData.length < 2 || blockData.length > 3) { + continue; } + + Block block = GameRegistry.findBlock(blockData[0], blockData[1]); if (block == null) { - property.set(defaultNames); - return defaultValues; + AlchemicalWizardry.logger.info("Block not found for {} {}: {}", category, key, name); + continue; } - blockStacks[i] = new BlockStack(block, metadata); + + int meta = 0; + if (blockData.length == 3) { + if (isInteger(blockData[2])) meta = Integer.parseInt(blockData[2]); + else if (blockData[2].equals("*")) meta = OreDictionary.WILDCARD_VALUE; + } + + validStacks.add(new BlockStack(block, meta)); } - return blockStacks; + + return validStacks; } + } diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/BlockStack.java b/src/main/java/WayofTime/alchemicalWizardry/api/BlockStack.java index 5de59b55..577f5db5 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/BlockStack.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/BlockStack.java @@ -9,8 +9,8 @@ import cpw.mods.fml.common.registry.GameData; */ public class BlockStack { - private Block block; - private int meta; + private final Block block; + private final int meta; public BlockStack(Block block, int meta) { this.block = block; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/AltarComponent.java b/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/AltarComponent.java index d5a9465d..cdb6cb9c 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/AltarComponent.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/AltarComponent.java @@ -1,23 +1,37 @@ package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade; +import java.util.ArrayList; +import java.util.List; + import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraftforge.oredict.OreDictionary; + +import WayofTime.alchemicalWizardry.api.BlockStack; public class AltarComponent { - private int x; - private int y; - private int z; - private Block block; - private int metadata; - private boolean isBloodRune; - private boolean isUpgradeSlot; + private final int x, y, z; + private final List validBlocks; + + private final boolean isBloodRune, isUpgradeSlot; public AltarComponent(int x, int y, int z, Block block, int metadata, boolean isBloodRune, boolean isUpgradeSlot) { this.x = x; this.y = y; this.z = z; - this.block = block; - this.metadata = metadata; + this.validBlocks = new ArrayList<>(); + this.validBlocks.add(new BlockStack(block, metadata)); + this.isBloodRune = isBloodRune; + this.isUpgradeSlot = isUpgradeSlot; + } + + public AltarComponent(int x, int y, int z, List validBlocks, boolean isBloodRune, + boolean isUpgradeSlot) { + this.x = x; + this.y = y; + this.z = z; + this.validBlocks = validBlocks; this.isBloodRune = isBloodRune; this.isUpgradeSlot = isUpgradeSlot; } @@ -35,11 +49,17 @@ public class AltarComponent { } public Block getBlock() { - return block; + if (anyBlockMatches()) { + return Blocks.air; + } + return validBlocks.get(0).getBlock(); } public int getMetadata() { - return metadata; + if (anyBlockMatches()) { + return OreDictionary.WILDCARD_VALUE; + } + return validBlocks.get(0).getMeta(); } public boolean isBloodRune() { @@ -49,4 +69,24 @@ public class AltarComponent { public boolean isUpgradeSlot() { return isUpgradeSlot; } + + public List getValidBlocks() { + return validBlocks; + } + + public boolean matches(Block block, int meta) { + if (anyBlockMatches()) return true; + + for (BlockStack pair : validBlocks) { + if (pair.getBlock() == block + && (pair.getMeta() == meta || pair.getMeta() == OreDictionary.WILDCARD_VALUE)) { + return true; + } + } + return false; + } + + public boolean anyBlockMatches() { + return validBlocks.isEmpty(); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/UpgradedAltars.java b/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/UpgradedAltars.java index 0004468c..e5d57858 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/UpgradedAltars.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/bloodAltarUpgrade/UpgradedAltars.java @@ -1,11 +1,9 @@ package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import net.minecraft.block.Block; -import net.minecraft.init.Blocks; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -47,21 +45,15 @@ public class UpgradedAltars { return true; } - private static BlockStack[] getRuneOverrides(int altarTier) { - switch (altarTier) { - case 2: - return AlchemicalWizardry.secondTierRunes; - case 3: - return AlchemicalWizardry.thirdTierRunes; - case 4: - return AlchemicalWizardry.fourthTierRunes; - case 5: - return AlchemicalWizardry.fifthTierRunes; - case 6: - return AlchemicalWizardry.sixthTierRunes; - default: - return null; - } + private static List getRuneOverrides(int altarTier) { + return switch (altarTier) { + case 2 -> AlchemicalWizardry.secondTierRunes; + case 3 -> AlchemicalWizardry.thirdTierRunes; + case 4 -> AlchemicalWizardry.fourthTierRunes; + case 5 -> AlchemicalWizardry.fifthTierRunes; + case 6 -> AlchemicalWizardry.sixthTierRunes; + default -> null; + }; } private static boolean checkAltarComponent(AltarComponent altarComponent, IBlockAccess world, int x, int y, int z, @@ -69,28 +61,29 @@ public class UpgradedAltars { int compX = x + altarComponent.getX(); int compY = y + altarComponent.getY(); int compZ = z + altarComponent.getZ(); - if (altarComponent.getBlock() == Blocks.air) { + if (altarComponent.anyBlockMatches()) { return !world.isAirBlock(compX, compY, compZ); } + Block block = world.getBlock(compX, compY, compZ); - int metadata = world.getBlockMetadata(compX, compY, compZ); - if (altarComponent.isBloodRune()) { - boolean result = false; - BlockStack[] runes = getRuneOverrides(altarTier); - if (runes == null) { - return false; - } - for (BlockStack rune : runes) { - result |= altarComponent.isUpgradeSlot() ? block == rune.getBlock() && metadata == rune.getMeta() - : block == altarComponent.getBlock() && metadata == altarComponent.getMetadata(); - } - return result; - } else { - if (altarComponent.getBlock() != block || altarComponent.getMetadata() != metadata) { - return false; + int meta = world.getBlockMetadata(compX, compY, compZ); + if (!altarComponent.isBloodRune()) { + return altarComponent.matches(block, meta); + } + + List runes = getRuneOverrides(altarTier); + if (runes == null) { + return false; + } + + for (BlockStack rune : runes) { + if (altarComponent.isUpgradeSlot() ? block == rune.getBlock() && meta == rune.getMeta() + : altarComponent.matches(block, meta)) { + return true; } } - return true; + + return false; } public static AltarUpgradeComponent getUpgrades(World world, int x, int y, int z, int altarTier) { @@ -99,683 +92,132 @@ public class UpgradedAltars { } AltarUpgradeComponent upgrades = new AltarUpgradeComponent(); List list = UpgradedAltars.getAltarUpgradeListForTier(altarTier); - BlockStack[] runes = getRuneOverrides(altarTier); + List runes = getRuneOverrides(altarTier); if (list == null || runes == null) { return upgrades; } for (AltarComponent altarComponent : list) { - if (altarComponent.isUpgradeSlot()) { - Block block = world - .getBlock(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); - int metadata = world.getBlockMetadata( - x + altarComponent.getX(), - y + altarComponent.getY(), - z + altarComponent.getZ()); - BlockStack blockStack = new BlockStack(block, metadata); - switch (Arrays.asList(runes).indexOf(blockStack)) { - case 1: - upgrades.addSpeedUpgrade(); - break; + if (!altarComponent.isUpgradeSlot()) { + continue; + } - case 2: - upgrades.addEfficiencyUpgrade(); - break; - - case 3: - upgrades.addSacrificeUpgrade(); - break; - - case 4: - upgrades.addSelfSacrificeUpgrade(); - break; - - case 5: - upgrades.addaltarCapacitiveUpgrade(); - break; - - case 6: - upgrades.addDisplacementUpgrade(); - break; - - case 7: - upgrades.addorbCapacitiveUpgrade(); - break; - - case 8: - upgrades.addBetterCapacitiveUpgrade(); - break; - - case 9: - upgrades.addAccelerationUpgrade(); - break; - - case 10: - upgrades.addQuicknessUpgrade(); - break; - } + Block block = world + .getBlock(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); + int metadata = world + .getBlockMetadata(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ()); + BlockStack blockStack = new BlockStack(block, metadata); + switch (runes.indexOf(blockStack)) { + case 1 -> upgrades.addSpeedUpgrade(); + case 2 -> upgrades.addEfficiencyUpgrade(); + case 3 -> upgrades.addSacrificeUpgrade(); + case 4 -> upgrades.addSelfSacrificeUpgrade(); + case 5 -> upgrades.addaltarCapacitiveUpgrade(); + case 6 -> upgrades.addDisplacementUpgrade(); + case 7 -> upgrades.addorbCapacitiveUpgrade(); + case 8 -> upgrades.addBetterCapacitiveUpgrade(); + case 9 -> upgrades.addAccelerationUpgrade(); + case 10 -> upgrades.addQuicknessUpgrade(); } } return upgrades; } public static void loadAltars() { - secondTierAltar.add( - new AltarComponent( - -1, - -1, - -1, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - false)); - secondTierAltar.add( - new AltarComponent( - 0, - -1, - -1, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - true)); - secondTierAltar.add( - new AltarComponent( - 1, - -1, - -1, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - false)); - secondTierAltar.add( - new AltarComponent( - -1, - -1, - 0, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - true)); - secondTierAltar.add( - new AltarComponent( - 1, - -1, - 0, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - true)); - secondTierAltar.add( - new AltarComponent( - -1, - -1, - 1, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - false)); - secondTierAltar.add( - new AltarComponent( - 0, - -1, - 1, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - true)); - secondTierAltar.add( - new AltarComponent( - 1, - -1, - 1, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - false)); + secondTierAltar.add(new AltarComponent(-1, -1, -1, AlchemicalWizardry.secondTierRunes, true, false)); + secondTierAltar.add(new AltarComponent(0, -1, -1, AlchemicalWizardry.secondTierRunes, true, true)); + secondTierAltar.add(new AltarComponent(1, -1, -1, AlchemicalWizardry.secondTierRunes, true, false)); + secondTierAltar.add(new AltarComponent(-1, -1, 0, AlchemicalWizardry.secondTierRunes, true, true)); + secondTierAltar.add(new AltarComponent(1, -1, 0, AlchemicalWizardry.secondTierRunes, true, true)); + secondTierAltar.add(new AltarComponent(-1, -1, 1, AlchemicalWizardry.secondTierRunes, true, false)); + secondTierAltar.add(new AltarComponent(0, -1, 1, AlchemicalWizardry.secondTierRunes, true, true)); + secondTierAltar.add(new AltarComponent(1, -1, 1, AlchemicalWizardry.secondTierRunes, true, false)); - thirdTierAltar.add( - new AltarComponent( - -1, - -1, - -1, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - true)); - thirdTierAltar.add( - new AltarComponent( - 0, - -1, - -1, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - true)); - thirdTierAltar.add( - new AltarComponent( - 1, - -1, - -1, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - true)); - thirdTierAltar.add( - new AltarComponent( - -1, - -1, - 0, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - true)); - thirdTierAltar.add( - new AltarComponent( - 1, - -1, - 0, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - true)); - thirdTierAltar.add( - new AltarComponent( - -1, - -1, - 1, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - true)); - thirdTierAltar.add( - new AltarComponent( - 0, - -1, - 1, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - true)); - thirdTierAltar.add( - new AltarComponent( - 1, - -1, - 1, - AlchemicalWizardry.secondTierRunes[0].getBlock(), - AlchemicalWizardry.secondTierRunes[0].getMeta(), - true, - true)); - thirdTierAltar.add( - new AltarComponent( - -3, - -1, - -3, - AlchemicalWizardry.specialAltarBlock[0].getBlock(), - AlchemicalWizardry.specialAltarBlock[0].getMeta(), - false, - false)); - thirdTierAltar.add( - new AltarComponent( - -3, - 0, - -3, - AlchemicalWizardry.specialAltarBlock[0].getBlock(), - AlchemicalWizardry.specialAltarBlock[0].getMeta(), - false, - false)); - thirdTierAltar.add( - new AltarComponent( - 3, - -1, - -3, - AlchemicalWizardry.specialAltarBlock[0].getBlock(), - AlchemicalWizardry.specialAltarBlock[0].getMeta(), - false, - false)); - thirdTierAltar.add( - new AltarComponent( - 3, - 0, - -3, - AlchemicalWizardry.specialAltarBlock[0].getBlock(), - AlchemicalWizardry.specialAltarBlock[0].getMeta(), - false, - false)); - thirdTierAltar.add( - new AltarComponent( - -3, - -1, - 3, - AlchemicalWizardry.specialAltarBlock[0].getBlock(), - AlchemicalWizardry.specialAltarBlock[0].getMeta(), - false, - false)); - thirdTierAltar.add( - new AltarComponent( - -3, - 0, - 3, - AlchemicalWizardry.specialAltarBlock[0].getBlock(), - AlchemicalWizardry.specialAltarBlock[0].getMeta(), - false, - false)); - thirdTierAltar.add( - new AltarComponent( - 3, - -1, - 3, - AlchemicalWizardry.specialAltarBlock[0].getBlock(), - AlchemicalWizardry.specialAltarBlock[0].getMeta(), - false, - false)); - thirdTierAltar.add( - new AltarComponent( - 3, - 0, - 3, - AlchemicalWizardry.specialAltarBlock[0].getBlock(), - AlchemicalWizardry.specialAltarBlock[0].getMeta(), - false, - false)); - thirdTierAltar.add( - new AltarComponent( - -3, - 1, - -3, - AlchemicalWizardry.specialAltarBlock[1].getBlock(), - AlchemicalWizardry.specialAltarBlock[1].getMeta(), - false, - false)); - thirdTierAltar.add( - new AltarComponent( - 3, - 1, - -3, - AlchemicalWizardry.specialAltarBlock[1].getBlock(), - AlchemicalWizardry.specialAltarBlock[1].getMeta(), - false, - false)); - thirdTierAltar.add( - new AltarComponent( - -3, - 1, - 3, - AlchemicalWizardry.specialAltarBlock[1].getBlock(), - AlchemicalWizardry.specialAltarBlock[1].getMeta(), - false, - false)); - thirdTierAltar.add( - new AltarComponent( - 3, - 1, - 3, - AlchemicalWizardry.specialAltarBlock[1].getBlock(), - AlchemicalWizardry.specialAltarBlock[1].getMeta(), - false, - false)); + thirdTierAltar.add(new AltarComponent(-1, -1, -1, AlchemicalWizardry.secondTierRunes, true, true)); + thirdTierAltar.add(new AltarComponent(0, -1, -1, AlchemicalWizardry.secondTierRunes, true, true)); + thirdTierAltar.add(new AltarComponent(1, -1, -1, AlchemicalWizardry.secondTierRunes, true, true)); + thirdTierAltar.add(new AltarComponent(-1, -1, 0, AlchemicalWizardry.secondTierRunes, true, true)); + thirdTierAltar.add(new AltarComponent(1, -1, 0, AlchemicalWizardry.secondTierRunes, true, true)); + thirdTierAltar.add(new AltarComponent(-1, -1, 1, AlchemicalWizardry.secondTierRunes, true, true)); + thirdTierAltar.add(new AltarComponent(0, -1, 1, AlchemicalWizardry.secondTierRunes, true, true)); + thirdTierAltar.add(new AltarComponent(1, -1, 1, AlchemicalWizardry.secondTierRunes, true, true)); + thirdTierAltar.add(new AltarComponent(-3, -1, -3, AlchemicalWizardry.thirdTierPillars, false, false)); + thirdTierAltar.add(new AltarComponent(-3, 0, -3, AlchemicalWizardry.thirdTierPillars, false, false)); + thirdTierAltar.add(new AltarComponent(3, -1, -3, AlchemicalWizardry.thirdTierPillars, false, false)); + thirdTierAltar.add(new AltarComponent(3, 0, -3, AlchemicalWizardry.thirdTierPillars, false, false)); + thirdTierAltar.add(new AltarComponent(-3, -1, 3, AlchemicalWizardry.thirdTierPillars, false, false)); + thirdTierAltar.add(new AltarComponent(-3, 0, 3, AlchemicalWizardry.thirdTierPillars, false, false)); + thirdTierAltar.add(new AltarComponent(3, -1, 3, AlchemicalWizardry.thirdTierPillars, false, false)); + thirdTierAltar.add(new AltarComponent(3, 0, 3, AlchemicalWizardry.thirdTierPillars, false, false)); + thirdTierAltar.add(new AltarComponent(-3, 1, -3, AlchemicalWizardry.thirdTierCaps, false, false)); + thirdTierAltar.add(new AltarComponent(3, 1, -3, AlchemicalWizardry.thirdTierCaps, false, false)); + thirdTierAltar.add(new AltarComponent(-3, 1, 3, AlchemicalWizardry.thirdTierCaps, false, false)); + thirdTierAltar.add(new AltarComponent(3, 1, 3, AlchemicalWizardry.thirdTierCaps, false, false)); for (int i = -2; i <= 2; i++) { - thirdTierAltar.add( - new AltarComponent( - 3, - -2, - i, - AlchemicalWizardry.thirdTierRunes[0].getBlock(), - AlchemicalWizardry.thirdTierRunes[0].getMeta(), - true, - true)); - thirdTierAltar.add( - new AltarComponent( - -3, - -2, - i, - AlchemicalWizardry.thirdTierRunes[0].getBlock(), - AlchemicalWizardry.thirdTierRunes[0].getMeta(), - true, - true)); - thirdTierAltar.add( - new AltarComponent( - i, - -2, - 3, - AlchemicalWizardry.thirdTierRunes[0].getBlock(), - AlchemicalWizardry.thirdTierRunes[0].getMeta(), - true, - true)); - thirdTierAltar.add( - new AltarComponent( - i, - -2, - -3, - AlchemicalWizardry.thirdTierRunes[0].getBlock(), - AlchemicalWizardry.thirdTierRunes[0].getMeta(), - true, - true)); + thirdTierAltar.add(new AltarComponent(3, -2, i, AlchemicalWizardry.thirdTierRunes, true, true)); + thirdTierAltar.add(new AltarComponent(-3, -2, i, AlchemicalWizardry.thirdTierRunes, true, true)); + thirdTierAltar.add(new AltarComponent(i, -2, 3, AlchemicalWizardry.thirdTierRunes, true, true)); + thirdTierAltar.add(new AltarComponent(i, -2, -3, AlchemicalWizardry.thirdTierRunes, true, true)); } fourthTierAltar.addAll(thirdTierAltar); for (int i = -3; i <= 3; i++) { - fourthTierAltar.add( - new AltarComponent( - 5, - -3, - i, - AlchemicalWizardry.fourthTierRunes[0].getBlock(), - AlchemicalWizardry.fourthTierRunes[0].getMeta(), - true, - true)); - fourthTierAltar.add( - new AltarComponent( - -5, - -3, - i, - AlchemicalWizardry.fourthTierRunes[0].getBlock(), - AlchemicalWizardry.fourthTierRunes[0].getMeta(), - true, - true)); - fourthTierAltar.add( - new AltarComponent( - i, - -3, - 5, - AlchemicalWizardry.fourthTierRunes[0].getBlock(), - AlchemicalWizardry.fourthTierRunes[0].getMeta(), - true, - true)); - fourthTierAltar.add( - new AltarComponent( - i, - -3, - -5, - AlchemicalWizardry.fourthTierRunes[0].getBlock(), - AlchemicalWizardry.fourthTierRunes[0].getMeta(), - true, - true)); + fourthTierAltar.add(new AltarComponent(5, -3, i, AlchemicalWizardry.fourthTierRunes, true, true)); + fourthTierAltar.add(new AltarComponent(-5, -3, i, AlchemicalWizardry.fourthTierRunes, true, true)); + fourthTierAltar.add(new AltarComponent(i, -3, 5, AlchemicalWizardry.fourthTierRunes, true, true)); + fourthTierAltar.add(new AltarComponent(i, -3, -5, AlchemicalWizardry.fourthTierRunes, true, true)); } for (int i = -2; i <= 1; i++) { - fourthTierAltar.add( - new AltarComponent( - 5, - i, - 5, - AlchemicalWizardry.specialAltarBlock[2].getBlock(), - AlchemicalWizardry.specialAltarBlock[2].getMeta(), - false, - false)); - fourthTierAltar.add( - new AltarComponent( - 5, - i, - -5, - AlchemicalWizardry.specialAltarBlock[2].getBlock(), - AlchemicalWizardry.specialAltarBlock[2].getMeta(), - false, - false)); - fourthTierAltar.add( - new AltarComponent( - -5, - i, - -5, - AlchemicalWizardry.specialAltarBlock[2].getBlock(), - AlchemicalWizardry.specialAltarBlock[2].getMeta(), - false, - false)); - fourthTierAltar.add( - new AltarComponent( - -5, - i, - 5, - AlchemicalWizardry.specialAltarBlock[2].getBlock(), - AlchemicalWizardry.specialAltarBlock[2].getMeta(), - false, - false)); + fourthTierAltar.add(new AltarComponent(5, i, 5, AlchemicalWizardry.fourthTierPillars, false, false)); + fourthTierAltar.add(new AltarComponent(5, i, -5, AlchemicalWizardry.fourthTierPillars, false, false)); + fourthTierAltar.add(new AltarComponent(-5, i, -5, AlchemicalWizardry.fourthTierPillars, false, false)); + fourthTierAltar.add(new AltarComponent(-5, i, 5, AlchemicalWizardry.fourthTierPillars, false, false)); } - fourthTierAltar.add( - new AltarComponent( - 5, - 2, - 5, - AlchemicalWizardry.specialAltarBlock[3].getBlock(), - AlchemicalWizardry.specialAltarBlock[3].getMeta(), - false, - false)); - fourthTierAltar.add( - new AltarComponent( - 5, - 2, - -5, - AlchemicalWizardry.specialAltarBlock[3].getBlock(), - AlchemicalWizardry.specialAltarBlock[3].getMeta(), - false, - false)); - fourthTierAltar.add( - new AltarComponent( - -5, - 2, - -5, - AlchemicalWizardry.specialAltarBlock[3].getBlock(), - AlchemicalWizardry.specialAltarBlock[3].getMeta(), - false, - false)); - fourthTierAltar.add( - new AltarComponent( - -5, - 2, - 5, - AlchemicalWizardry.specialAltarBlock[3].getBlock(), - AlchemicalWizardry.specialAltarBlock[3].getMeta(), - false, - false)); + fourthTierAltar.add(new AltarComponent(5, 2, 5, AlchemicalWizardry.fourthTierCaps, false, false)); + fourthTierAltar.add(new AltarComponent(5, 2, -5, AlchemicalWizardry.fourthTierCaps, false, false)); + fourthTierAltar.add(new AltarComponent(-5, 2, -5, AlchemicalWizardry.fourthTierCaps, false, false)); + fourthTierAltar.add(new AltarComponent(-5, 2, 5, AlchemicalWizardry.fourthTierCaps, false, false)); fifthTierAltar.addAll(fourthTierAltar); - fifthTierAltar.add( - new AltarComponent( - -8, - -3, - 8, - AlchemicalWizardry.specialAltarBlock[4].getBlock(), - AlchemicalWizardry.specialAltarBlock[4].getMeta(), - false, - false)); - fifthTierAltar.add( - new AltarComponent( - -8, - -3, - -8, - AlchemicalWizardry.specialAltarBlock[4].getBlock(), - AlchemicalWizardry.specialAltarBlock[4].getMeta(), - false, - false)); - fifthTierAltar.add( - new AltarComponent( - 8, - -3, - -8, - AlchemicalWizardry.specialAltarBlock[4].getBlock(), - AlchemicalWizardry.specialAltarBlock[4].getMeta(), - false, - false)); - fifthTierAltar.add( - new AltarComponent( - 8, - -3, - 8, - AlchemicalWizardry.specialAltarBlock[4].getBlock(), - AlchemicalWizardry.specialAltarBlock[4].getMeta(), - false, - false)); + fifthTierAltar.add(new AltarComponent(-8, -3, 8, AlchemicalWizardry.fifthTierBeacons, false, false)); + fifthTierAltar.add(new AltarComponent(-8, -3, -8, AlchemicalWizardry.fifthTierBeacons, false, false)); + fifthTierAltar.add(new AltarComponent(8, -3, -8, AlchemicalWizardry.fifthTierBeacons, false, false)); + fifthTierAltar.add(new AltarComponent(8, -3, 8, AlchemicalWizardry.fifthTierBeacons, false, false)); for (int i = -6; i <= 6; i++) { - fifthTierAltar.add( - new AltarComponent( - 8, - -4, - i, - AlchemicalWizardry.fifthTierRunes[0].getBlock(), - AlchemicalWizardry.fifthTierRunes[0].getMeta(), - true, - true)); - fifthTierAltar.add( - new AltarComponent( - -8, - -4, - i, - AlchemicalWizardry.fifthTierRunes[0].getBlock(), - AlchemicalWizardry.fifthTierRunes[0].getMeta(), - true, - true)); - fifthTierAltar.add( - new AltarComponent( - i, - -4, - 8, - AlchemicalWizardry.fifthTierRunes[0].getBlock(), - AlchemicalWizardry.fifthTierRunes[0].getMeta(), - true, - true)); - fifthTierAltar.add( - new AltarComponent( - i, - -4, - -8, - AlchemicalWizardry.fifthTierRunes[0].getBlock(), - AlchemicalWizardry.fifthTierRunes[0].getMeta(), - true, - true)); + fifthTierAltar.add(new AltarComponent(8, -4, i, AlchemicalWizardry.fifthTierRunes, true, true)); + fifthTierAltar.add(new AltarComponent(-8, -4, i, AlchemicalWizardry.fifthTierRunes, true, true)); + fifthTierAltar.add(new AltarComponent(i, -4, 8, AlchemicalWizardry.fifthTierRunes, true, true)); + fifthTierAltar.add(new AltarComponent(i, -4, -8, AlchemicalWizardry.fifthTierRunes, true, true)); } sixthTierAltar.addAll(fifthTierAltar); for (int i = -4; i <= 2; i++) { - sixthTierAltar.add( - new AltarComponent( - 11, - i, - 11, - AlchemicalWizardry.specialAltarBlock[5].getBlock(), - AlchemicalWizardry.specialAltarBlock[5].getMeta(), - false, - false)); - sixthTierAltar.add( - new AltarComponent( - -11, - i, - -11, - AlchemicalWizardry.specialAltarBlock[5].getBlock(), - AlchemicalWizardry.specialAltarBlock[5].getMeta(), - false, - false)); - sixthTierAltar.add( - new AltarComponent( - 11, - i, - -11, - AlchemicalWizardry.specialAltarBlock[5].getBlock(), - AlchemicalWizardry.specialAltarBlock[5].getMeta(), - false, - false)); - sixthTierAltar.add( - new AltarComponent( - -11, - i, - 11, - AlchemicalWizardry.specialAltarBlock[5].getBlock(), - AlchemicalWizardry.specialAltarBlock[5].getMeta(), - false, - false)); + sixthTierAltar.add(new AltarComponent(11, i, 11, AlchemicalWizardry.sixthTierPillars, false, false)); + sixthTierAltar.add(new AltarComponent(-11, i, -11, AlchemicalWizardry.sixthTierPillars, false, false)); + sixthTierAltar.add(new AltarComponent(11, i, -11, AlchemicalWizardry.sixthTierPillars, false, false)); + sixthTierAltar.add(new AltarComponent(-11, i, 11, AlchemicalWizardry.sixthTierPillars, false, false)); } - sixthTierAltar.add( - new AltarComponent( - 11, - 3, - 11, - AlchemicalWizardry.specialAltarBlock[6].getBlock(), - AlchemicalWizardry.specialAltarBlock[6].getMeta(), - false, - false)); - sixthTierAltar.add( - new AltarComponent( - -11, - 3, - -11, - AlchemicalWizardry.specialAltarBlock[6].getBlock(), - AlchemicalWizardry.specialAltarBlock[6].getMeta(), - false, - false)); - sixthTierAltar.add( - new AltarComponent( - 11, - 3, - -11, - AlchemicalWizardry.specialAltarBlock[6].getBlock(), - AlchemicalWizardry.specialAltarBlock[6].getMeta(), - false, - false)); - sixthTierAltar.add( - new AltarComponent( - -11, - 3, - 11, - AlchemicalWizardry.specialAltarBlock[6].getBlock(), - AlchemicalWizardry.specialAltarBlock[6].getMeta(), - false, - false)); + sixthTierAltar.add(new AltarComponent(11, 3, 11, AlchemicalWizardry.sixthTierCaps, false, false)); + sixthTierAltar.add(new AltarComponent(-11, 3, -11, AlchemicalWizardry.sixthTierCaps, false, false)); + sixthTierAltar.add(new AltarComponent(11, 3, -11, AlchemicalWizardry.sixthTierCaps, false, false)); + sixthTierAltar.add(new AltarComponent(-11, 3, 11, AlchemicalWizardry.sixthTierCaps, false, false)); for (int i = -9; i <= 9; i++) { - sixthTierAltar.add( - new AltarComponent( - 11, - -5, - i, - AlchemicalWizardry.sixthTierRunes[0].getBlock(), - AlchemicalWizardry.sixthTierRunes[0].getMeta(), - true, - true)); - sixthTierAltar.add( - new AltarComponent( - -11, - -5, - i, - AlchemicalWizardry.sixthTierRunes[0].getBlock(), - AlchemicalWizardry.sixthTierRunes[0].getMeta(), - true, - true)); - sixthTierAltar.add( - new AltarComponent( - i, - -5, - 11, - AlchemicalWizardry.sixthTierRunes[0].getBlock(), - AlchemicalWizardry.sixthTierRunes[0].getMeta(), - true, - true)); - sixthTierAltar.add( - new AltarComponent( - i, - -5, - -11, - AlchemicalWizardry.sixthTierRunes[0].getBlock(), - AlchemicalWizardry.sixthTierRunes[0].getMeta(), - true, - true)); + sixthTierAltar.add(new AltarComponent(11, -5, i, AlchemicalWizardry.sixthTierRunes, true, true)); + sixthTierAltar.add(new AltarComponent(-11, -5, i, AlchemicalWizardry.sixthTierRunes, true, true)); + sixthTierAltar.add(new AltarComponent(i, -5, 11, AlchemicalWizardry.sixthTierRunes, true, true)); + sixthTierAltar.add(new AltarComponent(i, -5, -11, AlchemicalWizardry.sixthTierRunes, true, true)); } } public static List getAltarUpgradeListForTier(int tier) { - switch (tier) { - case 2: - return secondTierAltar; - - case 3: - return thirdTierAltar; - - case 4: - return fourthTierAltar; - - case 5: - return fifthTierAltar; - - case 6: - return sixthTierAltar; - } - - return null; + return switch (tier) { + case 2 -> secondTierAltar; + case 3 -> thirdTierAltar; + case 4 -> fourthTierAltar; + case 5 -> fifthTierAltar; + case 6 -> sixthTierAltar; + default -> null; + }; } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/compat/structurelib/AltarStructure.java b/src/main/java/WayofTime/alchemicalWizardry/compat/structurelib/AltarStructure.java index bfc2bcf5..d579228a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/compat/structurelib/AltarStructure.java +++ b/src/main/java/WayofTime/alchemicalWizardry/compat/structurelib/AltarStructure.java @@ -12,15 +12,18 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import java.util.ArrayList; +import java.util.List; -import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; +import net.minecraftforge.oredict.OreDictionary; +import com.github.bsideup.jabel.Desugar; import com.google.common.base.Joiner; import com.gtnewhorizon.structurelib.alignment.constructable.IMultiblockInfoContainer; import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.IStructureElement; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; @@ -82,27 +85,42 @@ public class AltarStructure { .addElement('r',ofChain(ofBlockAnyMeta(ModBlocks.bloodRune),ofBlockAnyMeta(ModBlocks.speedRune),ofBlockAnyMeta(ModBlocks.runeOfSelfSacrifice),ofBlockAnyMeta(ModBlocks.runeOfSacrifice),ofBlockAnyMeta(ModBlocks.efficiencyRune))); char[] keys = {'t', 'g', 'v', 'b', 'e', 'i', 'c'}; + List[] values = new List[] { + AlchemicalWizardry.thirdTierPillars, + AlchemicalWizardry.thirdTierCaps, + AlchemicalWizardry.fourthTierPillars, + AlchemicalWizardry.fourthTierCaps, + AlchemicalWizardry.fifthTierBeacons, + AlchemicalWizardry.sixthTierPillars, + AlchemicalWizardry.sixthTierCaps + }; + for (int i = 0; i < keys.length; i++) { - BlockStack stack = AlchemicalWizardry.specialAltarBlock[i]; - if (stack != null && stack.getBlock() != Blocks.air) { - altarBuilder.addElement(keys[i], ofBlock(stack.getBlock(), stack.getMeta())); - } else { + if (values[i].isEmpty()) { altarBuilder.addElement(keys[i], ANY_BLOCK); + continue; } + + altarBuilder.addElement(keys[i], + ofChain( + values[i].stream() + .map(s -> s.getMeta() == OreDictionary.WILDCARD_VALUE + ? ofBlockAnyMeta(s.getBlock()) + : ofBlock(s.getBlock(), s.getMeta())) + .toArray(IStructureElement[]::new) + ) + ); } + IMultiblockInfoContainer.registerTileClass(TEAltar.class, new AltarStructure.AltarMultiblockInfoContainer(altarBuilder.build())); // spotless:on } - private static class AltarMultiblockInfoContainer implements IMultiblockInfoContainer { - - private final IStructureDefinition structureAltar; - - public AltarMultiblockInfoContainer(IStructureDefinition structureAltar) { - this.structureAltar = structureAltar; - } + @Desugar + private record AltarMultiblockInfoContainer(IStructureDefinition structureAltar) + implements IMultiblockInfoContainer { @Override public void construct(ItemStack triggerStack, boolean hintsOnly, TEAltar ctx, ExtendedFacing aSide) { @@ -157,18 +175,20 @@ public class AltarStructure { return built; } + @SuppressWarnings("unchecked") @Override public String[] getDescription(ItemStack stackSize) { ArrayList out = new ArrayList<>(); out.add(StatCollector.translateToLocal("structurelib.bloodmagic.altar.1")); out.add(StatCollector.translateToLocal("structurelib.bloodmagic.altar.2")); - int[] pillarIndices = { 0, 2, 5 }; int[] pillarTiers = { 3, 4, 6 }; + List[] pillarLists = new List[] { AlchemicalWizardry.thirdTierPillars, + AlchemicalWizardry.fourthTierPillars, AlchemicalWizardry.sixthTierPillars }; ArrayList pillars = new ArrayList<>(); - for (int i = 0; i < pillarIndices.length; i++) { - if (AlchemicalWizardry.specialAltarBlock[pillarIndices[i]].getBlock() == Blocks.air) { + for (int i = 0; i < pillarTiers.length; i++) { + if (pillarLists[i].isEmpty()) { pillars.add(pillarTiers[i]); } } @@ -180,12 +200,13 @@ public class AltarStructure { Joiner.on(", ").join(pillars))); } - int[] capIndices = { 1, 3, 6 }; int[] capTiers = { 3, 4, 6 }; + List[] capLists = new List[] { AlchemicalWizardry.thirdTierCaps, + AlchemicalWizardry.fourthTierCaps, AlchemicalWizardry.sixthTierCaps }; ArrayList caps = new ArrayList<>(); - for (int i = 0; i < capIndices.length; i++) { - if (AlchemicalWizardry.specialAltarBlock[capIndices[i]].getBlock() == Blocks.air) { + for (int i = 0; i < capTiers.length; i++) { + if (capLists[i].isEmpty()) { caps.add(capTiers[i]); } } @@ -197,7 +218,7 @@ public class AltarStructure { Joiner.on(", ").join(caps))); } - if (AlchemicalWizardry.specialAltarBlock[4].getBlock() == Blocks.air) { // T5 Beacon + if (AlchemicalWizardry.fifthTierBeacons.isEmpty()) { // T5 Beacon out.add(StatCollector.translateToLocal("structurelib.bloodmagic.altar.5")); }