Allow altar components to be any block like the pillars in pre-GTNH blood magic. Also change default configs to use this and add a comment on that config to explain how it works.

This commit is contained in:
koolkrafter5 committed 2025-03-29 06:06:09 -04:00
1 parent c0b4b797c8
commit d630bfb2e0
2 files changed
+27 -7

No files matched your search

@@ -665,10 +665,19 @@ public class BloodMagicConfiguration {
new BlockStack(ModBlocks.bloodRune, 6) });
AlchemicalWizardry.specialAltarBlock = getAltarRunesForTier(
"specialBlocks",
new BlockStack[] { new BlockStack(Blocks.stonebrick, 0), new BlockStack(Blocks.glowstone, 0),
new BlockStack(Blocks.stonebrick, 0), new BlockStack(ModBlocks.largeBloodStoneBrick, 0),
new BlockStack(Blocks.beacon, 0), new BlockStack(Blocks.stonebrick, 0),
new BlockStack(ModBlocks.blockCrystal, 0) });
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).");
config.save();
}
@@ -808,12 +817,16 @@ public class BloodMagicConfiguration {
}
private static BlockStack[] getAltarRunesForTier(String tierName, BlockStack[] defaultValues) {
return getAltarRunesForTier(tierName, 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);
Property property = config.get("rune overrides", tierName, defaultNames, comment);
String[] names = property.getStringList();
if (names.length != defaultNames.length) {
property.set(defaultNames);
@@ -5,6 +5,7 @@ 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;
@@ -65,9 +66,15 @@ public class UpgradedAltars {
private static boolean checkAltarComponent(AltarComponent altarComponent, IBlockAccess world, int x, int y, int z,
int altarTier) {
Block block = world.getBlock(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ());
int compX = x + altarComponent.getX();
int compY = y + altarComponent.getY();
int compZ = z + altarComponent.getZ();
if (altarComponent.getBlock() == Blocks.air) {
return !world.isAirBlock(compX, compY, compZ);
}
Block block = world.getBlock(compX, compY, compZ);
int metadata = world
.getBlockMetadata(x + altarComponent.getX(), y + altarComponent.getY(), z + altarComponent.getZ());
.getBlockMetadata(compX, compY, compZ);
if (altarComponent.isBloodRune()) {
boolean result = false;
BlockStack[] runes = getRuneOverrides(altarTier);