Compare commits

...
3 Commits
Author SHA1 Message Date
Dream Master 4a72a623bf update 2025-07-16 14:42:31 +07:00
koolkrafter5 0ed0cfccd8 Split configs for blocks used by each part of the Blood Altar's structure to allow for multiple blocks to be configured for each.
Add some sensible default values for modded blocks. Missing blocks in config entries are simply ignored.
2025-07-15 16:17:55 -04:00
koolkrafter5 fd38fb1d55 Expand this to allow for multiple blocks for the same component. 2025-07-15 09:32:53 -04:00
9 changed files with 312 additions and 818 deletions

No files matched your search

+6 -6
View File
@@ -23,13 +23,13 @@
*/ */
dependencies { dependencies {
api("com.github.GTNewHorizons:waila:1.8.10:dev") api("com.github.GTNewHorizons:waila:1.8.12:dev")
api("com.github.GTNewHorizons:NotEnoughItems:2.7.60-GTNH:dev") api("com.github.GTNewHorizons:NotEnoughItems:2.7.64-GTNH:dev")
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.368:dev") {transitive = false } compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.51.393:dev") {transitive = false }
compileOnly("com.github.GTNewHorizons:Botania:1.12.12-GTNH:api") {transitive = false } compileOnly("com.github.GTNewHorizons:Botania:1.12.16-GTNH:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.13:api") {transitive = false } compileOnly("com.github.GTNewHorizons:ForestryMC:4.10.14:api") {transitive = false }
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.6.7:dev") {transitive = false } compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.6.7:dev") {transitive = false }
compileOnly("com.github.GTNewHorizons:Chisel:2.16.5-GTNH:api") {transitive = false } compileOnly("com.github.GTNewHorizons:Chisel:2.16.5-GTNH:api") {transitive = false }
@@ -40,5 +40,5 @@ dependencies {
compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false } compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false }
compileOnly("curse.maven:guide-api-228832:2287185") {transitive = false } compileOnly("curse.maven:guide-api-228832:2287185") {transitive = false }
compileOnly("com.github.GTNewHorizons:StructureLib:1.4.12:dev") compileOnly("com.github.GTNewHorizons:StructureLib:1.4.15:dev")
} }
+1 -1
View File
@@ -151,7 +151,7 @@ modrinthProjectId =
# type can be one of [project, version], # type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod. # and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech # Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true # Note: UniMixins is automatically set as a required dependency if usesMixins = true.
modrinthRelations = modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens. # Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
} }
plugins { plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38' id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.41'
} }
@@ -496,12 +496,18 @@ public class AlchemicalWizardry {
public static boolean disableBoundToolsRightClick; public static boolean disableBoundToolsRightClick;
public static boolean allowPotionRepair; public static boolean allowPotionRepair;
public static BlockStack[] secondTierRunes = new BlockStack[10]; public static List<BlockStack> secondTierRunes;
public static BlockStack[] thirdTierRunes = new BlockStack[10]; public static List<BlockStack> thirdTierRunes;
public static BlockStack[] fourthTierRunes = new BlockStack[10]; public static List<BlockStack> fourthTierRunes;
public static BlockStack[] fifthTierRunes = new BlockStack[10]; public static List<BlockStack> fifthTierRunes;
public static BlockStack[] sixthTierRunes = new BlockStack[10]; public static List<BlockStack> sixthTierRunes;
public static BlockStack[] specialAltarBlock = new BlockStack[7]; public static List<BlockStack> fifthTierBeacons;
public static List<BlockStack> thirdTierCaps;
public static List<BlockStack> thirdTierPillars;
public static List<BlockStack> fourthTierCaps;
public static List<BlockStack> fourthTierPillars;
public static List<BlockStack> sixthTierCaps;
public static List<BlockStack> sixthTierPillars;
public static int lpPerSelfSacrifice = 200; public static int lpPerSelfSacrifice = 200;
public static int lpPerSelfSacrificeSoulFray = 20; public static int lpPerSelfSacrificeSoulFray = 20;
@@ -16,7 +16,6 @@ import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntitySlime; import net.minecraft.entity.monster.EntitySlime;
import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Blocks;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property; import net.minecraftforge.common.config.Property;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
@@ -624,66 +623,63 @@ public class BloodMagicConfiguration {
} }
public static void finishLoading() { public static void finishLoading() {
AlchemicalWizardry.secondTierRunes = BloodMagicConfiguration.getAltarRunesForTier( String[] defaultRunes = { "AWWayofTime:AlchemicalWizardrybloodRune", "AWWayofTime:speedRune",
"secondTier", "AWWayofTime:efficiencyRune", "AWWayofTime:runeOfSacrifice", "AWWayofTime:runeOfSelfSacrifice",
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), "AWWayofTime:AlchemicalWizardrybloodRune:1", "AWWayofTime:AlchemicalWizardrybloodRune:2",
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), "AWWayofTime:AlchemicalWizardrybloodRune:3", "AWWayofTime:AlchemicalWizardrybloodRune:4",
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), "AWWayofTime:AlchemicalWizardrybloodRune:5", "AWWayofTime:AlchemicalWizardrybloodRune:6" };
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3),
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5), AlchemicalWizardry.secondTierRunes = readRuneOverrides("secondTier", defaultRunes);
new BlockStack(ModBlocks.bloodRune, 6) }); AlchemicalWizardry.thirdTierRunes = readRuneOverrides("thirdTier", defaultRunes);
AlchemicalWizardry.thirdTierRunes = BloodMagicConfiguration.getAltarRunesForTier( AlchemicalWizardry.fourthTierRunes = readRuneOverrides("fourthTier", defaultRunes);
"thirdTier", AlchemicalWizardry.fifthTierRunes = readRuneOverrides("fifthTier", defaultRunes);
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), AlchemicalWizardry.sixthTierRunes = readRuneOverrides("sixthTier", defaultRunes);
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0),
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), AlchemicalWizardry.fifthTierBeacons = readBlockConfig(
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), "altar blocks",
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5), "fifthTierBeacons",
new BlockStack(ModBlocks.bloodRune, 6) }); new String[] { "minecraft:beacon", "etfuturum:beacon", "chisel:beacon:*" },
AlchemicalWizardry.fourthTierRunes = BloodMagicConfiguration.getAltarRunesForTier( "Valid blocks for the Blood Altar's tier 5 beacons:\n"
"fourthTier", + "Use the following format for all of these entries: mod:block(:meta). Meta * or 32767 allows for any meta.\n"
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), + "An empty entry allows for any non-air block to be used for that part of the structure.\n"
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), + "Invalid or missing blocks are skipped. If all entries are invalid, any block can be used as a fallback.");
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), AlchemicalWizardry.thirdTierCaps = readBlockConfig(
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), "altar blocks",
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5), "thirdTierCaps",
new BlockStack(ModBlocks.bloodRune, 6) }); new String[] { "minecraft:glowstone", "BloodArsenal:blood_infused_glowstone", "Botania:seaLamp",
AlchemicalWizardry.fifthTierRunes = BloodMagicConfiguration.getAltarRunesForTier( "chisel:glowstone:*", "etfuturum:sea_lantern", "etfuturum:shroomlight",
"fifthTier", "ExtraUtilities:color_lightgem:*" },
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), "Valid blocks for the Blood Altar's tier 3 caps:");
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), AlchemicalWizardry.thirdTierPillars = readBlockConfig(
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), "altar blocks",
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), "thirdTierPillars",
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5), new String[] {},
new BlockStack(ModBlocks.bloodRune, 6) }); "Valid blocks for the Blood Altar's tier 3 pillars:");
AlchemicalWizardry.sixthTierRunes = BloodMagicConfiguration.getAltarRunesForTier( AlchemicalWizardry.fourthTierCaps = readBlockConfig(
"sixthTier", "altar blocks",
new BlockStack[] { new BlockStack(ModBlocks.bloodRune, 0), new BlockStack(ModBlocks.speedRune, 0), "fourthTierCaps",
new BlockStack(ModBlocks.efficiencyRune, 0), new BlockStack(ModBlocks.runeOfSacrifice, 0), new String[] { "AWWayofTime:largeBloodStoneBrick" },
new BlockStack(ModBlocks.runeOfSelfSacrifice, 0), new BlockStack(ModBlocks.bloodRune, 1), "Valid blocks for the Blood Altar's tier 4 caps:");
new BlockStack(ModBlocks.bloodRune, 2), new BlockStack(ModBlocks.bloodRune, 3), AlchemicalWizardry.fourthTierPillars = readBlockConfig(
new BlockStack(ModBlocks.bloodRune, 4), new BlockStack(ModBlocks.bloodRune, 5), "altar blocks",
new BlockStack(ModBlocks.bloodRune, 6) }); "fourthTierPillars",
AlchemicalWizardry.specialAltarBlock = getAltarRunesForTier( new String[] {},
"specialBlocks", "Valid blocks for the Blood Altar's tier 4 pillars.");
new BlockStack[] { new BlockStack(Blocks.air, 0), new BlockStack(Blocks.glowstone, 0), AlchemicalWizardry.sixthTierCaps = readBlockConfig(
new BlockStack(Blocks.air, 0), new BlockStack(ModBlocks.largeBloodStoneBrick, 0), "altar blocks",
new BlockStack(Blocks.beacon, 0), new BlockStack(Blocks.air, 0), "sixthTierCaps",
new BlockStack(ModBlocks.blockCrystal, 0) }, new String[] { "AWWayofTime:blockCrystal" },
"Set the special blocks for the altar with the format mod:block(:meta) in the following order:\n" "Valid blocks for the Blood Altar's tier 6 caps:");
+ "Tier 3 pillar\n" AlchemicalWizardry.sixthTierPillars = readBlockConfig(
+ "Tier 3 cap\n" "altar blocks",
+ "Tier 4 pillar\n" "sixthTierPillars",
+ "Tier 4 cap\n" new String[] {},
+ "Tier 5 beacon\n" "Valid blocks for the Blood Altar's tier 6 pillars:");
+ "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).");
config.save(); config.save();
} }
public static void loadCustomLPValues() { public static void loadCustomLPValues() {
AlchemicalWizardry.lpPerSactificeCustom = new HashMap<Class<?>, Integer>(); AlchemicalWizardry.lpPerSactificeCustom = new HashMap<>();
for (Object object : EntityList.stringToClassMapping.entrySet()) { for (Object object : EntityList.stringToClassMapping.entrySet()) {
Entry entry = (Entry) object; Entry entry = (Entry) object;
String entityName = (String) entry.getKey(); 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. // 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]); if (isInteger(blockData[2])) meta = Integer.parseInt(blockData[2]);
else if (blockData[2].equals("*")) meta = OreDictionary.WILDCARD_VALUE; else if (blockData[2].equals("*")) meta = OreDictionary.WILDCARD_VALUE;
else meta = 0;
} }
AlchemicalWizardryEventHooks.teleposerBlacklist.add(new BlockStack(block, meta)); AlchemicalWizardryEventHooks.teleposerBlacklist.add(new BlockStack(block, meta));
@@ -808,53 +803,43 @@ public class BloodMagicConfiguration {
private static boolean isInteger(String s) { private static boolean isInteger(String s) {
try { try {
Integer.parseInt(s); Integer.parseInt(s);
} catch (NumberFormatException e) { } catch (NumberFormatException | NullPointerException e) {
return false;
} catch (NullPointerException e) {
return false; return false;
} }
// only got here if we didn't return false
return true; return true;
} }
private static BlockStack[] getAltarRunesForTier(String tierName, BlockStack[] defaultValues) { private static List<BlockStack> readRuneOverrides(String key, String[] defaultValues) {
return getAltarRunesForTier(tierName, defaultValues, ""); return readBlockConfig("rune overrides", key, defaultValues, "");
} }
private static BlockStack[] getAltarRunesForTier(String tierName, BlockStack[] defaultValues, String comment) { private static List<BlockStack> readBlockConfig(String category, String key, String[] defaultValues,
String[] defaultNames = new String[defaultValues.length]; String comment) {
for (int i = 0; i < defaultValues.length; i++) { Property property = config.get(category, key, defaultValues, comment);
defaultNames[i] = Block.blockRegistry.getNameForObject(defaultValues[i].getBlock()) + ":" List<BlockStack> validStacks = new ArrayList<>();
+ defaultValues[i].getMeta();
} for (String name : property.getStringList()) {
Property property = config.get("rune overrides", tierName, defaultNames, comment); String[] blockData = name.split(":");
String[] names = property.getStringList(); if (blockData.length < 2 || blockData.length > 3) {
if (names.length != defaultNames.length) { continue;
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;
}
} }
Block block = GameRegistry.findBlock(blockData[0], blockData[1]);
if (block == null) { if (block == null) {
property.set(defaultNames); AlchemicalWizardry.logger.info("Block not found for {} {}: {}", category, key, name);
return defaultValues; 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;
} }
} }
@@ -9,8 +9,8 @@ import cpw.mods.fml.common.registry.GameData;
*/ */
public class BlockStack { public class BlockStack {
private Block block; private final Block block;
private int meta; private final int meta;
public BlockStack(Block block, int meta) { public BlockStack(Block block, int meta) {
this.block = block; this.block = block;
@@ -1,23 +1,37 @@
package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade; package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.alchemicalWizardry.api.BlockStack;
public class AltarComponent { public class AltarComponent {
private int x; private final int x, y, z;
private int y; private final List<BlockStack> validBlocks;
private int z;
private Block block; private final boolean isBloodRune, isUpgradeSlot;
private int metadata;
private boolean isBloodRune;
private boolean isUpgradeSlot;
public AltarComponent(int x, int y, int z, Block block, int metadata, boolean isBloodRune, boolean isUpgradeSlot) { public AltarComponent(int x, int y, int z, Block block, int metadata, boolean isBloodRune, boolean isUpgradeSlot) {
this.x = x; this.x = x;
this.y = y; this.y = y;
this.z = z; this.z = z;
this.block = block; this.validBlocks = new ArrayList<>();
this.metadata = metadata; this.validBlocks.add(new BlockStack(block, metadata));
this.isBloodRune = isBloodRune;
this.isUpgradeSlot = isUpgradeSlot;
}
public AltarComponent(int x, int y, int z, List<BlockStack> validBlocks, boolean isBloodRune,
boolean isUpgradeSlot) {
this.x = x;
this.y = y;
this.z = z;
this.validBlocks = validBlocks;
this.isBloodRune = isBloodRune; this.isBloodRune = isBloodRune;
this.isUpgradeSlot = isUpgradeSlot; this.isUpgradeSlot = isUpgradeSlot;
} }
@@ -35,11 +49,17 @@ public class AltarComponent {
} }
public Block getBlock() { public Block getBlock() {
return block; if (anyBlockMatches()) {
return Blocks.air;
}
return validBlocks.get(0).getBlock();
} }
public int getMetadata() { public int getMetadata() {
return metadata; if (anyBlockMatches()) {
return OreDictionary.WILDCARD_VALUE;
}
return validBlocks.get(0).getMeta();
} }
public boolean isBloodRune() { public boolean isBloodRune() {
@@ -49,4 +69,24 @@ public class AltarComponent {
public boolean isUpgradeSlot() { public boolean isUpgradeSlot() {
return isUpgradeSlot; return isUpgradeSlot;
} }
public List<BlockStack> 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();
}
} }
@@ -1,11 +1,9 @@
package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade; package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@@ -47,21 +45,15 @@ public class UpgradedAltars {
return true; return true;
} }
private static BlockStack[] getRuneOverrides(int altarTier) { private static List<BlockStack> getRuneOverrides(int altarTier) {
switch (altarTier) { return switch (altarTier) {
case 2: case 2 -> AlchemicalWizardry.secondTierRunes;
return AlchemicalWizardry.secondTierRunes; case 3 -> AlchemicalWizardry.thirdTierRunes;
case 3: case 4 -> AlchemicalWizardry.fourthTierRunes;
return AlchemicalWizardry.thirdTierRunes; case 5 -> AlchemicalWizardry.fifthTierRunes;
case 4: case 6 -> AlchemicalWizardry.sixthTierRunes;
return AlchemicalWizardry.fourthTierRunes; default -> null;
case 5: };
return AlchemicalWizardry.fifthTierRunes;
case 6:
return AlchemicalWizardry.sixthTierRunes;
default:
return null;
}
} }
private static boolean checkAltarComponent(AltarComponent altarComponent, IBlockAccess world, int x, int y, int z, 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 compX = x + altarComponent.getX();
int compY = y + altarComponent.getY(); int compY = y + altarComponent.getY();
int compZ = z + altarComponent.getZ(); int compZ = z + altarComponent.getZ();
if (altarComponent.getBlock() == Blocks.air) { if (altarComponent.anyBlockMatches()) {
return !world.isAirBlock(compX, compY, compZ); return !world.isAirBlock(compX, compY, compZ);
} }
Block block = world.getBlock(compX, compY, compZ); Block block = world.getBlock(compX, compY, compZ);
int metadata = world.getBlockMetadata(compX, compY, compZ); int meta = world.getBlockMetadata(compX, compY, compZ);
if (altarComponent.isBloodRune()) { if (!altarComponent.isBloodRune()) {
boolean result = false; return altarComponent.matches(block, meta);
BlockStack[] runes = getRuneOverrides(altarTier); }
if (runes == null) {
return false; List<BlockStack> runes = getRuneOverrides(altarTier);
} if (runes == null) {
for (BlockStack rune : runes) { return false;
result |= altarComponent.isUpgradeSlot() ? block == rune.getBlock() && metadata == rune.getMeta() }
: block == altarComponent.getBlock() && metadata == altarComponent.getMetadata();
} for (BlockStack rune : runes) {
return result; if (altarComponent.isUpgradeSlot() ? block == rune.getBlock() && meta == rune.getMeta()
} else { : altarComponent.matches(block, meta)) {
if (altarComponent.getBlock() != block || altarComponent.getMetadata() != metadata) { return true;
return false;
} }
} }
return true;
return false;
} }
public static AltarUpgradeComponent getUpgrades(World world, int x, int y, int z, int altarTier) { 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(); AltarUpgradeComponent upgrades = new AltarUpgradeComponent();
List<AltarComponent> list = UpgradedAltars.getAltarUpgradeListForTier(altarTier); List<AltarComponent> list = UpgradedAltars.getAltarUpgradeListForTier(altarTier);
BlockStack[] runes = getRuneOverrides(altarTier); List<BlockStack> runes = getRuneOverrides(altarTier);
if (list == null || runes == null) { if (list == null || runes == null) {
return upgrades; return upgrades;
} }
for (AltarComponent altarComponent : list) { for (AltarComponent altarComponent : list) {
if (altarComponent.isUpgradeSlot()) { if (!altarComponent.isUpgradeSlot()) {
Block block = world continue;
.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;
case 2: Block block = world
upgrades.addEfficiencyUpgrade(); .getBlock(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ());
break; int metadata = world
.getBlockMetadata(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ());
case 3: BlockStack blockStack = new BlockStack(block, metadata);
upgrades.addSacrificeUpgrade(); switch (runes.indexOf(blockStack)) {
break; case 1 -> upgrades.addSpeedUpgrade();
case 2 -> upgrades.addEfficiencyUpgrade();
case 4: case 3 -> upgrades.addSacrificeUpgrade();
upgrades.addSelfSacrificeUpgrade(); case 4 -> upgrades.addSelfSacrificeUpgrade();
break; case 5 -> upgrades.addaltarCapacitiveUpgrade();
case 6 -> upgrades.addDisplacementUpgrade();
case 5: case 7 -> upgrades.addorbCapacitiveUpgrade();
upgrades.addaltarCapacitiveUpgrade(); case 8 -> upgrades.addBetterCapacitiveUpgrade();
break; case 9 -> upgrades.addAccelerationUpgrade();
case 10 -> upgrades.addQuicknessUpgrade();
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;
}
} }
} }
return upgrades; return upgrades;
} }
public static void loadAltars() { public static void loadAltars() {
secondTierAltar.add( secondTierAltar.add(new AltarComponent(-1, -1, -1, AlchemicalWizardry.secondTierRunes, true, false));
new AltarComponent( secondTierAltar.add(new AltarComponent(0, -1, -1, AlchemicalWizardry.secondTierRunes, true, true));
-1, secondTierAltar.add(new AltarComponent(1, -1, -1, AlchemicalWizardry.secondTierRunes, true, false));
-1, secondTierAltar.add(new AltarComponent(-1, -1, 0, AlchemicalWizardry.secondTierRunes, true, true));
-1, secondTierAltar.add(new AltarComponent(1, -1, 0, AlchemicalWizardry.secondTierRunes, true, true));
AlchemicalWizardry.secondTierRunes[0].getBlock(), secondTierAltar.add(new AltarComponent(-1, -1, 1, AlchemicalWizardry.secondTierRunes, true, false));
AlchemicalWizardry.secondTierRunes[0].getMeta(), secondTierAltar.add(new AltarComponent(0, -1, 1, AlchemicalWizardry.secondTierRunes, true, true));
true, secondTierAltar.add(new AltarComponent(1, -1, 1, AlchemicalWizardry.secondTierRunes, true, false));
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));
thirdTierAltar.add( thirdTierAltar.add(new AltarComponent(-1, -1, -1, AlchemicalWizardry.secondTierRunes, true, true));
new AltarComponent( thirdTierAltar.add(new AltarComponent(0, -1, -1, AlchemicalWizardry.secondTierRunes, true, true));
-1, thirdTierAltar.add(new AltarComponent(1, -1, -1, AlchemicalWizardry.secondTierRunes, true, true));
-1, thirdTierAltar.add(new AltarComponent(-1, -1, 0, AlchemicalWizardry.secondTierRunes, true, true));
-1, thirdTierAltar.add(new AltarComponent(1, -1, 0, AlchemicalWizardry.secondTierRunes, true, true));
AlchemicalWizardry.secondTierRunes[0].getBlock(), thirdTierAltar.add(new AltarComponent(-1, -1, 1, AlchemicalWizardry.secondTierRunes, true, true));
AlchemicalWizardry.secondTierRunes[0].getMeta(), thirdTierAltar.add(new AltarComponent(0, -1, 1, AlchemicalWizardry.secondTierRunes, true, true));
true, thirdTierAltar.add(new AltarComponent(1, -1, 1, AlchemicalWizardry.secondTierRunes, true, true));
true)); thirdTierAltar.add(new AltarComponent(-3, -1, -3, AlchemicalWizardry.thirdTierPillars, false, false));
thirdTierAltar.add( thirdTierAltar.add(new AltarComponent(-3, 0, -3, AlchemicalWizardry.thirdTierPillars, false, false));
new AltarComponent( thirdTierAltar.add(new AltarComponent(3, -1, -3, AlchemicalWizardry.thirdTierPillars, false, false));
0, thirdTierAltar.add(new AltarComponent(3, 0, -3, AlchemicalWizardry.thirdTierPillars, false, false));
-1, thirdTierAltar.add(new AltarComponent(-3, -1, 3, AlchemicalWizardry.thirdTierPillars, false, false));
-1, thirdTierAltar.add(new AltarComponent(-3, 0, 3, AlchemicalWizardry.thirdTierPillars, false, false));
AlchemicalWizardry.secondTierRunes[0].getBlock(), thirdTierAltar.add(new AltarComponent(3, -1, 3, AlchemicalWizardry.thirdTierPillars, false, false));
AlchemicalWizardry.secondTierRunes[0].getMeta(), thirdTierAltar.add(new AltarComponent(3, 0, 3, AlchemicalWizardry.thirdTierPillars, false, false));
true, thirdTierAltar.add(new AltarComponent(-3, 1, -3, AlchemicalWizardry.thirdTierCaps, false, false));
true)); thirdTierAltar.add(new AltarComponent(3, 1, -3, AlchemicalWizardry.thirdTierCaps, false, false));
thirdTierAltar.add( thirdTierAltar.add(new AltarComponent(-3, 1, 3, AlchemicalWizardry.thirdTierCaps, false, false));
new AltarComponent( thirdTierAltar.add(new AltarComponent(3, 1, 3, AlchemicalWizardry.thirdTierCaps, false, false));
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));
for (int i = -2; i <= 2; i++) { for (int i = -2; i <= 2; i++) {
thirdTierAltar.add( thirdTierAltar.add(new AltarComponent(3, -2, i, AlchemicalWizardry.thirdTierRunes, true, true));
new AltarComponent( thirdTierAltar.add(new AltarComponent(-3, -2, i, AlchemicalWizardry.thirdTierRunes, true, true));
3, thirdTierAltar.add(new AltarComponent(i, -2, 3, AlchemicalWizardry.thirdTierRunes, true, true));
-2, thirdTierAltar.add(new AltarComponent(i, -2, -3, AlchemicalWizardry.thirdTierRunes, true, true));
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));
} }
fourthTierAltar.addAll(thirdTierAltar); fourthTierAltar.addAll(thirdTierAltar);
for (int i = -3; i <= 3; i++) { for (int i = -3; i <= 3; i++) {
fourthTierAltar.add( fourthTierAltar.add(new AltarComponent(5, -3, i, AlchemicalWizardry.fourthTierRunes, true, true));
new AltarComponent( fourthTierAltar.add(new AltarComponent(-5, -3, i, AlchemicalWizardry.fourthTierRunes, true, true));
5, fourthTierAltar.add(new AltarComponent(i, -3, 5, AlchemicalWizardry.fourthTierRunes, true, true));
-3, fourthTierAltar.add(new AltarComponent(i, -3, -5, AlchemicalWizardry.fourthTierRunes, true, true));
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));
} }
for (int i = -2; i <= 1; i++) { for (int i = -2; i <= 1; i++) {
fourthTierAltar.add( fourthTierAltar.add(new AltarComponent(5, i, 5, AlchemicalWizardry.fourthTierPillars, false, false));
new AltarComponent( fourthTierAltar.add(new AltarComponent(5, i, -5, AlchemicalWizardry.fourthTierPillars, false, false));
5, fourthTierAltar.add(new AltarComponent(-5, i, -5, AlchemicalWizardry.fourthTierPillars, false, false));
i, fourthTierAltar.add(new AltarComponent(-5, i, 5, AlchemicalWizardry.fourthTierPillars, false, false));
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( fourthTierAltar.add(new AltarComponent(5, 2, 5, AlchemicalWizardry.fourthTierCaps, false, false));
new AltarComponent( fourthTierAltar.add(new AltarComponent(5, 2, -5, AlchemicalWizardry.fourthTierCaps, false, false));
5, fourthTierAltar.add(new AltarComponent(-5, 2, -5, AlchemicalWizardry.fourthTierCaps, false, false));
2, fourthTierAltar.add(new AltarComponent(-5, 2, 5, AlchemicalWizardry.fourthTierCaps, false, false));
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));
fifthTierAltar.addAll(fourthTierAltar); fifthTierAltar.addAll(fourthTierAltar);
fifthTierAltar.add( fifthTierAltar.add(new AltarComponent(-8, -3, 8, AlchemicalWizardry.fifthTierBeacons, false, false));
new AltarComponent( fifthTierAltar.add(new AltarComponent(-8, -3, -8, AlchemicalWizardry.fifthTierBeacons, false, false));
-8, fifthTierAltar.add(new AltarComponent(8, -3, -8, AlchemicalWizardry.fifthTierBeacons, false, false));
-3, fifthTierAltar.add(new AltarComponent(8, -3, 8, AlchemicalWizardry.fifthTierBeacons, false, false));
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));
for (int i = -6; i <= 6; i++) { for (int i = -6; i <= 6; i++) {
fifthTierAltar.add( fifthTierAltar.add(new AltarComponent(8, -4, i, AlchemicalWizardry.fifthTierRunes, true, true));
new AltarComponent( fifthTierAltar.add(new AltarComponent(-8, -4, i, AlchemicalWizardry.fifthTierRunes, true, true));
8, fifthTierAltar.add(new AltarComponent(i, -4, 8, AlchemicalWizardry.fifthTierRunes, true, true));
-4, fifthTierAltar.add(new AltarComponent(i, -4, -8, AlchemicalWizardry.fifthTierRunes, true, true));
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));
} }
sixthTierAltar.addAll(fifthTierAltar); sixthTierAltar.addAll(fifthTierAltar);
for (int i = -4; i <= 2; i++) { for (int i = -4; i <= 2; i++) {
sixthTierAltar.add( sixthTierAltar.add(new AltarComponent(11, i, 11, AlchemicalWizardry.sixthTierPillars, false, false));
new AltarComponent( sixthTierAltar.add(new AltarComponent(-11, i, -11, AlchemicalWizardry.sixthTierPillars, false, false));
11, sixthTierAltar.add(new AltarComponent(11, i, -11, AlchemicalWizardry.sixthTierPillars, false, false));
i, sixthTierAltar.add(new AltarComponent(-11, i, 11, AlchemicalWizardry.sixthTierPillars, false, false));
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( sixthTierAltar.add(new AltarComponent(11, 3, 11, AlchemicalWizardry.sixthTierCaps, false, false));
new AltarComponent( sixthTierAltar.add(new AltarComponent(-11, 3, -11, AlchemicalWizardry.sixthTierCaps, false, false));
11, sixthTierAltar.add(new AltarComponent(11, 3, -11, AlchemicalWizardry.sixthTierCaps, false, false));
3, sixthTierAltar.add(new AltarComponent(-11, 3, 11, AlchemicalWizardry.sixthTierCaps, false, false));
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));
for (int i = -9; i <= 9; i++) { for (int i = -9; i <= 9; i++) {
sixthTierAltar.add( sixthTierAltar.add(new AltarComponent(11, -5, i, AlchemicalWizardry.sixthTierRunes, true, true));
new AltarComponent( sixthTierAltar.add(new AltarComponent(-11, -5, i, AlchemicalWizardry.sixthTierRunes, true, true));
11, sixthTierAltar.add(new AltarComponent(i, -5, 11, AlchemicalWizardry.sixthTierRunes, true, true));
-5, sixthTierAltar.add(new AltarComponent(i, -5, -11, AlchemicalWizardry.sixthTierRunes, true, true));
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));
} }
} }
public static List<AltarComponent> getAltarUpgradeListForTier(int tier) { public static List<AltarComponent> getAltarUpgradeListForTier(int tier) {
switch (tier) { return switch (tier) {
case 2: case 2 -> secondTierAltar;
return secondTierAltar; case 3 -> thirdTierAltar;
case 4 -> fourthTierAltar;
case 3: case 5 -> fifthTierAltar;
return thirdTierAltar; case 6 -> sixthTierAltar;
default -> null;
case 4: };
return fourthTierAltar;
case 5:
return fifthTierAltar;
case 6:
return sixthTierAltar;
}
return null;
} }
} }
@@ -12,15 +12,18 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraftforge.oredict.OreDictionary;
import com.github.bsideup.jabel.Desugar;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.gtnewhorizon.structurelib.alignment.constructable.IMultiblockInfoContainer; import com.gtnewhorizon.structurelib.alignment.constructable.IMultiblockInfoContainer;
import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.IStructureElement;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.StructureDefinition; 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))); .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'}; char[] keys = {'t', 'g', 'v', 'b', 'e', 'i', 'c'};
List<BlockStack>[] 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++) { for (int i = 0; i < keys.length; i++) {
BlockStack stack = AlchemicalWizardry.specialAltarBlock[i]; if (values[i].isEmpty()) {
if (stack != null && stack.getBlock() != Blocks.air) {
altarBuilder.addElement(keys[i], ofBlock(stack.getBlock(), stack.getMeta()));
} else {
altarBuilder.addElement(keys[i], ANY_BLOCK); 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, IMultiblockInfoContainer.registerTileClass(TEAltar.class,
new AltarStructure.AltarMultiblockInfoContainer(altarBuilder.build())); new AltarStructure.AltarMultiblockInfoContainer(altarBuilder.build()));
// spotless:on // spotless:on
} }
private static class AltarMultiblockInfoContainer implements IMultiblockInfoContainer<TEAltar> { @Desugar
private record AltarMultiblockInfoContainer(IStructureDefinition<TEAltar> structureAltar)
private final IStructureDefinition<TEAltar> structureAltar; implements IMultiblockInfoContainer<TEAltar> {
public AltarMultiblockInfoContainer(IStructureDefinition<TEAltar> structureAltar) {
this.structureAltar = structureAltar;
}
@Override @Override
public void construct(ItemStack triggerStack, boolean hintsOnly, TEAltar ctx, ExtendedFacing aSide) { public void construct(ItemStack triggerStack, boolean hintsOnly, TEAltar ctx, ExtendedFacing aSide) {
@@ -157,18 +175,20 @@ public class AltarStructure {
return built; return built;
} }
@SuppressWarnings("unchecked")
@Override @Override
public String[] getDescription(ItemStack stackSize) { public String[] getDescription(ItemStack stackSize) {
ArrayList<String> out = new ArrayList<>(); ArrayList<String> out = new ArrayList<>();
out.add(StatCollector.translateToLocal("structurelib.bloodmagic.altar.1")); out.add(StatCollector.translateToLocal("structurelib.bloodmagic.altar.1"));
out.add(StatCollector.translateToLocal("structurelib.bloodmagic.altar.2")); out.add(StatCollector.translateToLocal("structurelib.bloodmagic.altar.2"));
int[] pillarIndices = { 0, 2, 5 };
int[] pillarTiers = { 3, 4, 6 }; int[] pillarTiers = { 3, 4, 6 };
List<BlockStack>[] pillarLists = new List[] { AlchemicalWizardry.thirdTierPillars,
AlchemicalWizardry.fourthTierPillars, AlchemicalWizardry.sixthTierPillars };
ArrayList<Integer> pillars = new ArrayList<>(); ArrayList<Integer> pillars = new ArrayList<>();
for (int i = 0; i < pillarIndices.length; i++) { for (int i = 0; i < pillarTiers.length; i++) {
if (AlchemicalWizardry.specialAltarBlock[pillarIndices[i]].getBlock() == Blocks.air) { if (pillarLists[i].isEmpty()) {
pillars.add(pillarTiers[i]); pillars.add(pillarTiers[i]);
} }
} }
@@ -180,12 +200,13 @@ public class AltarStructure {
Joiner.on(", ").join(pillars))); Joiner.on(", ").join(pillars)));
} }
int[] capIndices = { 1, 3, 6 };
int[] capTiers = { 3, 4, 6 }; int[] capTiers = { 3, 4, 6 };
List<BlockStack>[] capLists = new List[] { AlchemicalWizardry.thirdTierCaps,
AlchemicalWizardry.fourthTierCaps, AlchemicalWizardry.sixthTierCaps };
ArrayList<Integer> caps = new ArrayList<>(); ArrayList<Integer> caps = new ArrayList<>();
for (int i = 0; i < capIndices.length; i++) { for (int i = 0; i < capTiers.length; i++) {
if (AlchemicalWizardry.specialAltarBlock[capIndices[i]].getBlock() == Blocks.air) { if (capLists[i].isEmpty()) {
caps.add(capTiers[i]); caps.add(capTiers[i]);
} }
} }
@@ -197,7 +218,7 @@ public class AltarStructure {
Joiner.on(", ").join(caps))); 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")); out.add(StatCollector.translateToLocal("structurelib.bloodmagic.altar.5"));
} }