Altar now accepts Chisel variants of given blocks

Will require a re-setup of the workspace (`gradlew [eclipse|idea]`) in order to download the Chisel API. This launches just fine without Chisel installed.
This commit is contained in:
Nick committed 2015-10-06 23:04:39 -07:00
1 parent 83b26eb033
commit a91d350037
5 files changed
+88 -13

No files matched your search

@@ -424,6 +424,7 @@ public class AlchemicalWizardry
public static boolean isThaumcraftLoaded;
public static boolean isForestryLoaded;
public static boolean isBotaniaLoaded;
public static boolean isChiselLoaded;
public static boolean isFMPLoaded;
public static boolean isPneumaticCraftLoaded;
@@ -1262,6 +1263,7 @@ public class AlchemicalWizardry
isBotaniaLoaded = Loader.isModLoaded("Botania");
isPneumaticCraftLoaded = Loader.isModLoaded("PneumaticCraft");
isFMPLoaded = Loader.isModLoaded("ForgeMultipart");
isChiselLoaded = Loader.isModLoaded("chisel");
BloodMagicConfiguration.loadBlacklist();
BloodMagicConfiguration.blacklistRituals();
@@ -0,0 +1,26 @@
package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade;
import WayofTime.alchemicalWizardry.api.BlockStack;
import com.cricketcraft.chisel.api.carving.CarvingUtils;
import com.cricketcraft.chisel.api.carving.ICarvingGroup;
import com.google.common.base.Strings;
public class CompatChecks {
public static boolean checkChiselBlock(BlockStack blockStack, String groupName) {
if (blockStack.getBlock() == null)
return false;
ICarvingGroup group = CarvingUtils.getChiselRegistry().getGroup(blockStack.getBlock(), blockStack.getMeta());
if (group != null) {
String check = CarvingUtils.getChiselRegistry().getGroup(blockStack.getBlock(), blockStack.getMeta()).getName();
if (Strings.isNullOrEmpty(check))
return false;
return check.equals(groupName);
}
return false;
}
}
@@ -3,6 +3,8 @@ package WayofTime.alchemicalWizardry.common.bloodAltarUpgrade;
import java.util.ArrayList;
import java.util.List;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.api.BlockStack;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBeacon;
import net.minecraft.init.Blocks;
@@ -46,10 +48,12 @@ public class UpgradedAltars
if (ac.isBloodRune())
{
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
int testMeta = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
if (!(testBlock instanceof BloodRune))
{
return false;
if (!checkRuneSpecials(ac, new BlockStack(testBlock, testMeta)))
return false;
}
} else
{
@@ -58,7 +62,8 @@ public class UpgradedAltars
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
{
return false;
if (!checkSpecials(ac, new BlockStack(block, metadata)))
return false;
}
}
}
@@ -71,10 +76,12 @@ public class UpgradedAltars
if (ac.isBloodRune())
{
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
int testMeta = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
if (!(testBlock instanceof BloodRune))
{
return false;
if (!checkRuneSpecials(ac, new BlockStack(testBlock, testMeta)))
return false;
}
} else
{
@@ -83,7 +90,8 @@ public class UpgradedAltars
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
{
return false;
if (!checkSpecials(ac, new BlockStack(block, metadata)))
return false;
}
}
}
@@ -96,10 +104,12 @@ public class UpgradedAltars
if (ac.isBloodRune())
{
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
int testMeta = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
if (!(testBlock instanceof BloodRune))
{
return false;
if (!checkRuneSpecials(ac, new BlockStack(testBlock, testMeta)))
return false;
}
} else
{
@@ -108,7 +118,8 @@ public class UpgradedAltars
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
{
return false;
if (!checkSpecials(ac, new BlockStack(block, metadata)))
return false;
}
}
}
@@ -121,10 +132,12 @@ public class UpgradedAltars
if (ac.isBloodRune())
{
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
int testMeta = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
if (!(testBlock instanceof BloodRune))
{
return false;
if (!checkRuneSpecials(ac, new BlockStack(testBlock, testMeta)))
return false;
}
} else {
Block block = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
@@ -132,7 +145,7 @@ public class UpgradedAltars
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
{
if (!(ac.getBlock() == Blocks.beacon && block instanceof BlockBeacon))
if (!checkSpecials(ac, new BlockStack(block, metadata)))
return false;
}
}
@@ -146,10 +159,12 @@ public class UpgradedAltars
if (ac.isBloodRune())
{
Block testBlock = world.getBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ());
int testMeta = world.getBlockMetadata(x + ac.getX(), y + ac.getY(), z + ac.getZ());
if (!(testBlock instanceof BloodRune))
{
return false;
if (!checkRuneSpecials(ac, new BlockStack(testBlock, testMeta)))
return false;
}
} else
{
@@ -158,7 +173,8 @@ public class UpgradedAltars
if (((ac.getBlock() != block) || (ac.getMetadata() != metadata)) && !(ac.getBlock() == Blocks.stonebrick && !world.isAirBlock(x + ac.getX(), y + ac.getY(), z + ac.getZ())))
{
return false;
if (!checkSpecials(ac, new BlockStack(block, metadata)))
return false;
}
}
}
@@ -339,6 +355,31 @@ public class UpgradedAltars
}
}
private static boolean checkRuneSpecials(AltarComponent altarComponent, BlockStack blockStack) {
if (AlchemicalWizardry.isChiselLoaded) {
if (altarComponent.getBlock() == ModBlocks.bloodRune && CompatChecks.checkChiselBlock(blockStack, "bloodRune"))
return true;
}
return false;
}
private static boolean checkSpecials(AltarComponent altarComponent, BlockStack blockStack) {
if (AlchemicalWizardry.isChiselLoaded) {
if (altarComponent.getBlock() == Blocks.glowstone && CompatChecks.checkChiselBlock(blockStack, "glowstone"))
return true;
if (altarComponent.getBlock() == ModBlocks.largeBloodStoneBrick && CompatChecks.checkChiselBlock(blockStack, "bloodBrick"))
return true;
}
if (altarComponent.getBlock() == Blocks.beacon && blockStack.getBlock() instanceof BlockBeacon)
return true;
return false;
}
public static List<AltarComponent> getAltarUpgradeListForTier(int tier)
{
switch (tier)