From eada60f43661e5b2151e280be89ad2c69831c60f Mon Sep 17 00:00:00 2001 From: Nicholas Ignoffo Date: Fri, 9 Mar 2018 18:00:04 -0800 Subject: [PATCH] Some altar cleanup and renaming --- .../bloodmagic/altar/AltarComponent.java | 11 +- .../{EnumAltarTier.java => AltarTier.java} | 98 +++++++------- .../WayofTime/bloodmagic/altar/AltarUtil.java | 85 +++++++++++++ .../bloodmagic/altar/BloodAltar.java | 120 +++--------------- ...AltarComponent.java => ComponentType.java} | 6 +- .../bloodmagic/altar/IAltarComponent.java | 2 +- .../bloodmagic/altar/IBloodAltar.java | 2 +- .../bloodmagic/api/impl/BloodMagicAPI.java | 10 +- .../api/impl/BloodMagicCorePlugin.java | 18 +-- .../api/impl/recipe/RecipeBloodAltar.java | 10 +- .../bloodmagic/block/BlockAltar.java | 7 +- .../bloodmagic/block/BlockMimic.java | 6 +- .../client/render/block/RenderAltar.java | 8 +- .../core/RegistrarBloodMagicRecipes.java | 48 +++---- .../core/registry/AltarRecipeRegistry.java | 22 ++-- .../bloodmagic/core/registry/OrbRegistry.java | 4 +- .../bloodmagic/item/ItemAltarMaker.java | 16 +-- .../bloodmagic/item/ItemSanguineBook.java | 8 +- .../ritual/types/RitualAltarBuilder.java | 12 +- .../WayofTime/bloodmagic/tile/TileAltar.java | 8 +- .../java/WayofTime/bloodmagic/util/Utils.java | 6 +- 21 files changed, 253 insertions(+), 254 deletions(-) rename src/main/java/WayofTime/bloodmagic/altar/{EnumAltarTier.java => AltarTier.java} (68%) create mode 100644 src/main/java/WayofTime/bloodmagic/altar/AltarUtil.java rename src/main/java/WayofTime/bloodmagic/altar/{EnumAltarComponent.java => ComponentType.java} (78%) diff --git a/src/main/java/WayofTime/bloodmagic/altar/AltarComponent.java b/src/main/java/WayofTime/bloodmagic/altar/AltarComponent.java index e70e496b..abc937c7 100644 --- a/src/main/java/WayofTime/bloodmagic/altar/AltarComponent.java +++ b/src/main/java/WayofTime/bloodmagic/altar/AltarComponent.java @@ -6,18 +6,17 @@ import net.minecraft.util.math.BlockPos; * Used for building the altar structure. */ public class AltarComponent { - private BlockPos offset; + private final BlockPos offset; + private final ComponentType component; private boolean upgradeSlot; - private EnumAltarComponent component; - /** * Sets a component location for the altar. * * @param offset - Where the block should be in relation to the Altar * @param component - The type of Component the location should contain */ - public AltarComponent(BlockPos offset, EnumAltarComponent component) { + public AltarComponent(BlockPos offset, ComponentType component) { this.offset = offset; this.component = component; } @@ -29,7 +28,7 @@ public class AltarComponent { * @param offset - Where the block should be in relation to the Altar */ public AltarComponent(BlockPos offset) { - this(offset, EnumAltarComponent.NOTAIR); + this(offset, ComponentType.NOTAIR); } /** @@ -50,7 +49,7 @@ public class AltarComponent { return upgradeSlot; } - public EnumAltarComponent getComponent() { + public ComponentType getComponent() { return component; } } diff --git a/src/main/java/WayofTime/bloodmagic/altar/EnumAltarTier.java b/src/main/java/WayofTime/bloodmagic/altar/AltarTier.java similarity index 68% rename from src/main/java/WayofTime/bloodmagic/altar/EnumAltarTier.java rename to src/main/java/WayofTime/bloodmagic/altar/AltarTier.java index 0478db4b..df88e59c 100644 --- a/src/main/java/WayofTime/bloodmagic/altar/EnumAltarTier.java +++ b/src/main/java/WayofTime/bloodmagic/altar/AltarTier.java @@ -5,31 +5,31 @@ import net.minecraft.util.math.BlockPos; import java.util.ArrayList; //@formatter:off -public enum EnumAltarTier { +public enum AltarTier { ONE(), TWO() { @Override public void buildComponents() { - altarComponents.add(new AltarComponent(new BlockPos(-1, -1, -1), EnumAltarComponent.BLOODRUNE)); - altarComponents.add(new AltarComponent(new BlockPos(0, -1, -1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(1, -1, -1), EnumAltarComponent.BLOODRUNE)); - altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 0), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(1, -1, 0), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 1), EnumAltarComponent.BLOODRUNE)); - altarComponents.add(new AltarComponent(new BlockPos(0, -1, 1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(1, -1, 1), EnumAltarComponent.BLOODRUNE)); + altarComponents.add(new AltarComponent(new BlockPos(-1, -1, -1), ComponentType.BLOODRUNE)); + altarComponents.add(new AltarComponent(new BlockPos(0, -1, -1), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(1, -1, -1), ComponentType.BLOODRUNE)); + altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 1), ComponentType.BLOODRUNE)); + altarComponents.add(new AltarComponent(new BlockPos(0, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(1, -1, 1), ComponentType.BLOODRUNE)); } }, THREE() { @Override public void buildComponents() { - altarComponents.add(new AltarComponent(new BlockPos(-1, -1, -1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(0, -1, -1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(1, -1, -1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 0), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(1, -1, 0), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(0, -1, 1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(1, -1, 1), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(-1, -1, -1), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(0, -1, -1), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(1, -1, -1), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(0, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(1, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(-3, -1, -3))); altarComponents.add(new AltarComponent(new BlockPos(-3, 0, -3))); altarComponents.add(new AltarComponent(new BlockPos(3, -1, -3))); @@ -38,16 +38,16 @@ public enum EnumAltarTier { altarComponents.add(new AltarComponent(new BlockPos(-3, 0, 3))); altarComponents.add(new AltarComponent(new BlockPos(3, -1, 3))); altarComponents.add(new AltarComponent(new BlockPos(3, 0, 3))); - altarComponents.add(new AltarComponent(new BlockPos(-3, 1, -3), EnumAltarComponent.GLOWSTONE)); - altarComponents.add(new AltarComponent(new BlockPos(3, 1, -3), EnumAltarComponent.GLOWSTONE)); - altarComponents.add(new AltarComponent(new BlockPos(-3, 1, 3), EnumAltarComponent.GLOWSTONE)); - altarComponents.add(new AltarComponent(new BlockPos(3, 1, 3), EnumAltarComponent.GLOWSTONE)); + altarComponents.add(new AltarComponent(new BlockPos(-3, 1, -3), ComponentType.GLOWSTONE)); + altarComponents.add(new AltarComponent(new BlockPos(3, 1, -3), ComponentType.GLOWSTONE)); + altarComponents.add(new AltarComponent(new BlockPos(-3, 1, 3), ComponentType.GLOWSTONE)); + altarComponents.add(new AltarComponent(new BlockPos(3, 1, 3), ComponentType.GLOWSTONE)); for (int i = -2; i <= 2; i++) { - altarComponents.add(new AltarComponent(new BlockPos(3, -2, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(-3, -2, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(i, -2, 3), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(i, -2, -3), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(3, -2, i), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(-3, -2, i), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(i, -2, 3), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(i, -2, -3), ComponentType.BLOODRUNE).setUpgradeSlot()); } } }, @@ -57,10 +57,10 @@ public enum EnumAltarTier { altarComponents.addAll(THREE.getAltarComponents()); for (int i = -3; i <= 3; i++) { - altarComponents.add(new AltarComponent(new BlockPos(5, -3, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(-5, -3, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(i, -3, 5), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(i, -3, -5), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(5, -3, i), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(-5, -3, i), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(i, -3, 5), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(i, -3, -5), ComponentType.BLOODRUNE).setUpgradeSlot()); } for (int i = -2; i <= 1; i++) { @@ -70,26 +70,26 @@ public enum EnumAltarTier { altarComponents.add(new AltarComponent(new BlockPos(-5, i, 5))); } - altarComponents.add(new AltarComponent(new BlockPos(5, 2, 5), EnumAltarComponent.BLOODSTONE)); - altarComponents.add(new AltarComponent(new BlockPos(5, 2, -5), EnumAltarComponent.BLOODSTONE)); - altarComponents.add(new AltarComponent(new BlockPos(-5, 2, -5), EnumAltarComponent.BLOODSTONE)); - altarComponents.add(new AltarComponent(new BlockPos(-5, 2, 5), EnumAltarComponent.BLOODSTONE)); + altarComponents.add(new AltarComponent(new BlockPos(5, 2, 5), ComponentType.BLOODSTONE)); + altarComponents.add(new AltarComponent(new BlockPos(5, 2, -5), ComponentType.BLOODSTONE)); + altarComponents.add(new AltarComponent(new BlockPos(-5, 2, -5), ComponentType.BLOODSTONE)); + altarComponents.add(new AltarComponent(new BlockPos(-5, 2, 5), ComponentType.BLOODSTONE)); } }, FIVE() { @Override public void buildComponents() { altarComponents.addAll(FOUR.getAltarComponents()); - altarComponents.add(new AltarComponent(new BlockPos(-8, -3, 8), EnumAltarComponent.BEACON)); - altarComponents.add(new AltarComponent(new BlockPos(-8, -3, -8), EnumAltarComponent.BEACON)); - altarComponents.add(new AltarComponent(new BlockPos(8, -3, -8), EnumAltarComponent.BEACON)); - altarComponents.add(new AltarComponent(new BlockPos(8, -3, 8), EnumAltarComponent.BEACON)); + altarComponents.add(new AltarComponent(new BlockPos(-8, -3, 8), ComponentType.BEACON)); + altarComponents.add(new AltarComponent(new BlockPos(-8, -3, -8), ComponentType.BEACON)); + altarComponents.add(new AltarComponent(new BlockPos(8, -3, -8), ComponentType.BEACON)); + altarComponents.add(new AltarComponent(new BlockPos(8, -3, 8), ComponentType.BEACON)); for (int i = -6; i <= 6; i++) { - altarComponents.add(new AltarComponent(new BlockPos(8, -4, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(-8, -4, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(i, -4, 8), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(i, -4, -8), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(8, -4, i), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(-8, -4, i), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(i, -4, 8), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(i, -4, -8), ComponentType.BLOODRUNE).setUpgradeSlot()); } } }, @@ -105,16 +105,16 @@ public enum EnumAltarTier { altarComponents.add(new AltarComponent(new BlockPos(-11, i, 11))); } - altarComponents.add(new AltarComponent(new BlockPos(11, 3, 11), EnumAltarComponent.CRYSTAL)); - altarComponents.add(new AltarComponent(new BlockPos(-11, 3, -11), EnumAltarComponent.CRYSTAL)); - altarComponents.add(new AltarComponent(new BlockPos(11, 3, -11), EnumAltarComponent.CRYSTAL)); - altarComponents.add(new AltarComponent(new BlockPos(-11, 3, 11), EnumAltarComponent.CRYSTAL)); + altarComponents.add(new AltarComponent(new BlockPos(11, 3, 11), ComponentType.CRYSTAL)); + altarComponents.add(new AltarComponent(new BlockPos(-11, 3, -11), ComponentType.CRYSTAL)); + altarComponents.add(new AltarComponent(new BlockPos(11, 3, -11), ComponentType.CRYSTAL)); + altarComponents.add(new AltarComponent(new BlockPos(-11, 3, 11), ComponentType.CRYSTAL)); for (int i = -9; i <= 9; i++) { - altarComponents.add(new AltarComponent(new BlockPos(11, -5, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(-11, -5, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(i, -5, 11), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); - altarComponents.add(new AltarComponent(new BlockPos(i, -5, -11), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(11, -5, i), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(-11, -5, i), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(i, -5, 11), ComponentType.BLOODRUNE).setUpgradeSlot()); + altarComponents.add(new AltarComponent(new BlockPos(i, -5, -11), ComponentType.BLOODRUNE).setUpgradeSlot()); } } //@formatter:on diff --git a/src/main/java/WayofTime/bloodmagic/altar/AltarUtil.java b/src/main/java/WayofTime/bloodmagic/altar/AltarUtil.java new file mode 100644 index 00000000..845f9051 --- /dev/null +++ b/src/main/java/WayofTime/bloodmagic/altar/AltarUtil.java @@ -0,0 +1,85 @@ +package WayofTime.bloodmagic.altar; + +import WayofTime.bloodmagic.api.impl.BloodMagicAPI; +import WayofTime.bloodmagic.block.BlockBloodRune; +import WayofTime.bloodmagic.tile.TileAltar; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import org.apache.commons.lang3.tuple.Pair; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.List; + +public class AltarUtil { + + @Nonnull + public static AltarTier getTier(World world, BlockPos pos) { + TileEntity tile = world.getTileEntity(pos); + if (!(tile instanceof TileAltar)) + return AltarTier.ONE; + + AltarTier lastCheck = AltarTier.ONE; + for (AltarTier tier : AltarTier.values()) { + for (AltarComponent component : tier.getAltarComponents()) { + IBlockState worldState = world.getBlockState(pos.add(component.getOffset())); + if (component.getComponent() == ComponentType.NOTAIR && worldState.getMaterial() != Material.AIR && !worldState.getMaterial().isLiquid()) + continue; + + List validStates = BloodMagicAPI.INSTANCE.getComponentStates(component.getComponent()); + if (!validStates.contains(worldState)) + return lastCheck; + } + + lastCheck = tier; + } + + return lastCheck; + } + + @Nonnull + public static AltarUpgrade getUpgrades(World world, BlockPos pos, AltarTier currentTier) { + AltarUpgrade upgrades = new AltarUpgrade(); + + for (AltarTier tier : AltarTier.values()) { + if (tier.ordinal() > currentTier.ordinal()) + return upgrades; + + for (AltarComponent component : tier.getAltarComponents()) { + if (!component.isUpgradeSlot() || component.getComponent() != ComponentType.BLOODRUNE) + continue; + + BlockPos componentPos = pos.add(component.getOffset()); + IBlockState state = world.getBlockState(componentPos); + if (state.getBlock() instanceof BlockBloodRune) + upgrades.upgrade(((BlockBloodRune) state.getBlock()).getBloodRune(world, componentPos, state)); + } + } + + return upgrades; + } + + @Nullable + public static Pair getFirstMissingComponent(World world, BlockPos pos, int altarTier) { + if (altarTier >= AltarTier.MAXTIERS) + return null; + + for (AltarTier tier : AltarTier.values()) { + for (AltarComponent component : tier.getAltarComponents()) { + BlockPos componentPos = pos.add(component.getOffset()); + IBlockState worldState = world.getBlockState(componentPos); + if (component.getComponent() == ComponentType.NOTAIR && worldState.getMaterial() != Material.AIR && !worldState.getMaterial().isLiquid()) + continue; + + List validStates = BloodMagicAPI.INSTANCE.getComponentStates(component.getComponent()); + if (!validStates.contains(worldState)) + return Pair.of(componentPos, component.getComponent()); + } + } + + return null; + } +} diff --git a/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java b/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java index f55108ca..39ccbf9c 100644 --- a/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java +++ b/src/main/java/WayofTime/bloodmagic/altar/BloodAltar.java @@ -6,7 +6,6 @@ import WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar; import WayofTime.bloodmagic.block.enums.BloodRuneType; import WayofTime.bloodmagic.core.data.Binding; import WayofTime.bloodmagic.iface.IBindable; -import WayofTime.bloodmagic.iface.IBloodRune; import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.orb.BloodOrb; import WayofTime.bloodmagic.orb.IBloodOrb; @@ -30,18 +29,15 @@ import net.minecraftforge.fluids.capability.FluidTankPropertiesWrapper; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.items.ItemHandlerHelper; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.List; public class BloodAltar implements IFluidHandler { static { - EnumAltarTier.ONE.buildComponents(); - EnumAltarTier.TWO.buildComponents(); - EnumAltarTier.THREE.buildComponents(); - EnumAltarTier.FOUR.buildComponents(); - EnumAltarTier.FIVE.buildComponents(); - EnumAltarTier.SIX.buildComponents(); + AltarTier.ONE.buildComponents(); + AltarTier.TWO.buildComponents(); + AltarTier.THREE.buildComponents(); + AltarTier.FOUR.buildComponents(); + AltarTier.FIVE.buildComponents(); + AltarTier.SIX.buildComponents(); } public boolean isActive; @@ -49,7 +45,7 @@ public class BloodAltar implements IFluidHandler { protected FluidStack fluidInput = new FluidStack(BlockLifeEssence.getLifeEssence(), 0); private TileAltar tileAltar; private int internalCounter = 0; - private EnumAltarTier altarTier = EnumAltarTier.ONE; + private AltarTier altarTier = AltarTier.ONE; private AltarUpgrade upgrade; private int capacity = Fluid.BUCKET_VOLUME * 10; private FluidStack fluid = new FluidStack(BlockLifeEssence.getLifeEssence(), 0); @@ -77,7 +73,7 @@ public class BloodAltar implements IFluidHandler { private int maxCharge = 0; private int cooldownAfterCrafting = 60; private RecipeBloodAltar recipe; - private EnumAltarTier currentTierDisplayed = EnumAltarTier.ONE; + private AltarTier currentTierDisplayed = AltarTier.ONE; public BloodAltar(TileAltar tileAltar) { this.tileAltar = tileAltar; @@ -98,7 +94,7 @@ public class BloodAltar implements IFluidHandler { } internalCounter = tagCompound.getInteger("internalCounter"); - altarTier = Enums.getIfPresent(EnumAltarTier.class, tagCompound.getString(Constants.NBT.ALTAR_TIER)).or(EnumAltarTier.ONE); + altarTier = Enums.getIfPresent(AltarTier.class, tagCompound.getString(Constants.NBT.ALTAR_TIER)).or(AltarTier.ONE); isActive = tagCompound.getBoolean(Constants.NBT.ALTAR_ACTIVE); liquidRequired = tagCompound.getInteger(Constants.NBT.ALTAR_LIQUID_REQ); canBeFilled = tagCompound.getBoolean(Constants.NBT.ALTAR_FILLABLE); @@ -124,7 +120,7 @@ public class BloodAltar implements IFluidHandler { chargingFrequency = tagCompound.getInteger(Constants.NBT.ALTAR_CHARGE_FREQUENCY); totalCharge = tagCompound.getInteger(Constants.NBT.ALTAR_TOTAL_CHARGE); maxCharge = tagCompound.getInteger(Constants.NBT.ALTAR_MAX_CHARGE); - currentTierDisplayed = Enums.getIfPresent(EnumAltarTier.class, tagCompound.getString(Constants.NBT.ALTAR_CURRENT_TIER_DISPLAYED)).or(EnumAltarTier.ONE); + currentTierDisplayed = Enums.getIfPresent(AltarTier.class, tagCompound.getString(Constants.NBT.ALTAR_CURRENT_TIER_DISPLAYED)).or(AltarTier.ONE); } public void writeToNBT(NBTTagCompound tagCompound) { @@ -358,15 +354,15 @@ public class BloodAltar implements IFluidHandler { } public void checkTier() { - EnumAltarTier tier = BloodAltar.getAltarTier(tileAltar.getWorld(), tileAltar.getPos()); + AltarTier tier = AltarUtil.getTier(tileAltar.getWorld(), tileAltar.getPos()); this.altarTier = tier; - upgrade = BloodAltar.getUpgrades(tileAltar.getWorld(), tileAltar.getPos(), tier); + upgrade = AltarUtil.getUpgrades(tileAltar.getWorld(), tileAltar.getPos(), tier); if (tier.equals(currentTierDisplayed)) - currentTierDisplayed = EnumAltarTier.ONE; + currentTierDisplayed = AltarTier.ONE; - if (tier.equals(EnumAltarTier.ONE)) { + if (tier.equals(AltarTier.ONE)) { upgrade = null; isUpgraded = false; this.consumptionMultiplier = 0; @@ -382,7 +378,7 @@ public class BloodAltar implements IFluidHandler { this.maxCharge = 0; this.totalCharge = 0; return; - } else if (!tier.equals(EnumAltarTier.ONE) && upgrade != null) { + } else if (!tier.equals(AltarTier.ONE)) { this.isUpgraded = true; this.accelerationUpgrades = upgrade.getLevel(BloodRuneType.ACCELERATION); this.consumptionMultiplier = (float) (0.20 * upgrade.getLevel(BloodRuneType.SPEED)); @@ -464,11 +460,11 @@ public class BloodAltar implements IFluidHandler { return getFluidAmount(); } - public EnumAltarTier getTier() { + public AltarTier getTier() { return altarTier; } - public void setTier(EnumAltarTier tier) { + public void setTier(AltarTier tier) { this.altarTier = tier; } @@ -508,7 +504,7 @@ public class BloodAltar implements IFluidHandler { return bufferCapacity; } - public boolean setCurrentTierDisplayed(EnumAltarTier altarTier) { + public boolean setCurrentTierDisplayed(AltarTier altarTier) { if (currentTierDisplayed == altarTier) return false; else @@ -626,85 +622,7 @@ public class BloodAltar implements IFluidHandler { return new IFluidTankProperties[]{new FluidTankPropertiesWrapper(new FluidTank(fluid, capacity))}; } - public EnumAltarTier getCurrentTierDisplayed() { + public AltarTier getCurrentTierDisplayed() { return currentTierDisplayed; } - - public static EnumAltarTier getAltarTier(World world, BlockPos pos) { - for (int i = EnumAltarTier.MAXTIERS - 1; i >= 1; i--) { - if (checkAltarIsValid(world, pos, i)) { - return EnumAltarTier.values()[i]; - } - } - - return EnumAltarTier.ONE; - } - - public static boolean checkAltarIsValid(World world, BlockPos worldPos, int altarTier) { - for (AltarComponent altarComponent : EnumAltarTier.values()[altarTier].getAltarComponents()) { - BlockPos componentPos = worldPos.add(altarComponent.getOffset()); - IBlockState state = world.getBlockState(componentPos); - - if (altarComponent.getComponent() != EnumAltarComponent.NOTAIR) { - if (state.getBlock() instanceof IAltarComponent) { - EnumAltarComponent component = ((IAltarComponent) state.getBlock()).getType(world, state, componentPos); - if (component == null || component != altarComponent.getComponent()) - return false; - } - - if (!BloodMagicAPI.INSTANCE.getComponentStates(altarComponent.getComponent()).contains(state)) - return false; - } else if (world.isAirBlock(componentPos)) - return false; - } - - return true; - } - - public static Pair getAltarMissingBlock(World world, BlockPos worldPos, int altarTier) { - if (altarTier >= EnumAltarTier.MAXTIERS) - return null; - - for (AltarComponent altarComponent : EnumAltarTier.values()[altarTier].getAltarComponents()) { - BlockPos componentPos = worldPos.add(altarComponent.getOffset()); - IBlockState state = world.getBlockState(componentPos); - - if (altarComponent.getComponent() != EnumAltarComponent.NOTAIR) { - if (state.getBlock() instanceof IAltarComponent) { - EnumAltarComponent component = ((IAltarComponent) state.getBlock()).getType(world, state, componentPos); - if (component == null || component != altarComponent.getComponent()) - return Pair.of(componentPos, altarComponent.getComponent()); - } - - if (!BloodMagicAPI.INSTANCE.getComponentStates(altarComponent.getComponent()).contains(state)) - return Pair.of(componentPos, altarComponent.getComponent()); - } else if (world.isAirBlock(componentPos)) - return Pair.of(componentPos, altarComponent.getComponent()); - } - - return null; - } - - public static AltarUpgrade getUpgrades(World world, BlockPos pos, EnumAltarTier altarTier) { - if (world.isRemote) { - return null; - } - - AltarUpgrade upgrades = new AltarUpgrade(); - List list = altarTier.getAltarComponents(); - - for (AltarComponent altarComponent : list) { - BlockPos componentPos = pos.add(altarComponent.getOffset()); - - if (altarComponent.isUpgradeSlot()) { - IBlockState state = world.getBlockState(componentPos); - if (state.getBlock() instanceof IBloodRune) { - BloodRuneType rune = ((IBloodRune) state.getBlock()).getBloodRune(world, componentPos, state); - upgrades.upgrade(rune); - } - } - } - - return upgrades; - } } diff --git a/src/main/java/WayofTime/bloodmagic/altar/EnumAltarComponent.java b/src/main/java/WayofTime/bloodmagic/altar/ComponentType.java similarity index 78% rename from src/main/java/WayofTime/bloodmagic/altar/EnumAltarComponent.java rename to src/main/java/WayofTime/bloodmagic/altar/ComponentType.java index aa0327c8..1eec1f0d 100644 --- a/src/main/java/WayofTime/bloodmagic/altar/EnumAltarComponent.java +++ b/src/main/java/WayofTime/bloodmagic/altar/ComponentType.java @@ -5,7 +5,7 @@ import java.util.Locale; /** * List of different components used to construct different tiers of altars. */ -public enum EnumAltarComponent { +public enum ComponentType { GLOWSTONE, BLOODSTONE, BEACON, @@ -13,11 +13,11 @@ public enum EnumAltarComponent { CRYSTAL, NOTAIR; - public static final EnumAltarComponent[] VALUES = values(); + public static final ComponentType[] VALUES = values(); private static final String BASE = "chat.bloodmagic.altar.comp."; private String key; - EnumAltarComponent() { + ComponentType() { this.key = BASE + name().toLowerCase(Locale.ENGLISH); } diff --git a/src/main/java/WayofTime/bloodmagic/altar/IAltarComponent.java b/src/main/java/WayofTime/bloodmagic/altar/IAltarComponent.java index 0db6e35e..6a96dc66 100644 --- a/src/main/java/WayofTime/bloodmagic/altar/IAltarComponent.java +++ b/src/main/java/WayofTime/bloodmagic/altar/IAltarComponent.java @@ -8,5 +8,5 @@ import javax.annotation.Nullable; public interface IAltarComponent { @Nullable - EnumAltarComponent getType(World world, IBlockState state, BlockPos pos); + ComponentType getType(World world, IBlockState state, BlockPos pos); } diff --git a/src/main/java/WayofTime/bloodmagic/altar/IBloodAltar.java b/src/main/java/WayofTime/bloodmagic/altar/IBloodAltar.java index a72c1afd..0270ac3e 100644 --- a/src/main/java/WayofTime/bloodmagic/altar/IBloodAltar.java +++ b/src/main/java/WayofTime/bloodmagic/altar/IBloodAltar.java @@ -5,7 +5,7 @@ public interface IBloodAltar { int getCurrentBlood(); - EnumAltarTier getTier(); + AltarTier getTier(); int getProgress(); diff --git a/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicAPI.java b/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicAPI.java index 05d0716b..a779da4b 100644 --- a/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicAPI.java +++ b/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicAPI.java @@ -1,7 +1,7 @@ package WayofTime.bloodmagic.api.impl; import WayofTime.bloodmagic.api.IBloodMagicAPI; -import WayofTime.bloodmagic.altar.EnumAltarComponent; +import WayofTime.bloodmagic.altar.ComponentType; import WayofTime.bloodmagic.util.BMLog; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; @@ -17,7 +17,7 @@ public class BloodMagicAPI implements IBloodMagicAPI { private final BloodMagicBlacklist blacklist; private final BloodMagicRecipeRegistrar recipeRegistrar; private final BloodMagicValueManager valueManager; - private final Multimap altarComponents; + private final Multimap altarComponents; public BloodMagicAPI() { this.blacklist = new BloodMagicBlacklist(); @@ -46,8 +46,8 @@ public class BloodMagicAPI implements IBloodMagicAPI { @Override public void registerAltarComponent(@Nonnull IBlockState state, @Nonnull String componentType) { - EnumAltarComponent component = null; - for (EnumAltarComponent type : EnumAltarComponent.VALUES) { + ComponentType component = null; + for (ComponentType type : ComponentType.VALUES) { if (type.name().equalsIgnoreCase(componentType)) { component = type; break; @@ -61,7 +61,7 @@ public class BloodMagicAPI implements IBloodMagicAPI { } @Nonnull - public List getComponentStates(EnumAltarComponent component) { + public List getComponentStates(ComponentType component) { return (List) altarComponents.get(component); } } diff --git a/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicCorePlugin.java b/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicCorePlugin.java index 453d5174..8448277e 100644 --- a/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicCorePlugin.java +++ b/src/main/java/WayofTime/bloodmagic/api/impl/BloodMagicCorePlugin.java @@ -5,7 +5,7 @@ import WayofTime.bloodmagic.ConfigHandler; import WayofTime.bloodmagic.api.BloodMagicPlugin; import WayofTime.bloodmagic.api.IBloodMagicAPI; import WayofTime.bloodmagic.api.IBloodMagicPlugin; -import WayofTime.bloodmagic.altar.EnumAltarComponent; +import WayofTime.bloodmagic.altar.ComponentType; import WayofTime.bloodmagic.api.IBloodMagicRecipeRegistrar; import WayofTime.bloodmagic.block.BlockBloodRune; import WayofTime.bloodmagic.block.BlockDecorative; @@ -66,19 +66,19 @@ public class BloodMagicCorePlugin implements IBloodMagicPlugin { handleConfigValues(api); // Add standard blocks for altar components - api.registerAltarComponent(Blocks.GLOWSTONE.getDefaultState(), EnumAltarComponent.GLOWSTONE.name()); - api.registerAltarComponent(Blocks.SEA_LANTERN.getDefaultState(), EnumAltarComponent.GLOWSTONE.name()); - api.registerAltarComponent(Blocks.BEACON.getDefaultState(), EnumAltarComponent.BEACON.name()); + api.registerAltarComponent(Blocks.GLOWSTONE.getDefaultState(), ComponentType.GLOWSTONE.name()); + api.registerAltarComponent(Blocks.SEA_LANTERN.getDefaultState(), ComponentType.GLOWSTONE.name()); + api.registerAltarComponent(Blocks.BEACON.getDefaultState(), ComponentType.BEACON.name()); BlockDecorative decorative = (BlockDecorative) RegistrarBloodMagicBlocks.DECORATIVE_BRICK; - api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.BLOODSTONE_BRICK), EnumAltarComponent.BLOODSTONE.name()); - api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.BLOODSTONE_TILE), EnumAltarComponent.BLOODSTONE.name()); - api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_BRICK), EnumAltarComponent.CRYSTAL.name()); - api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_TILE), EnumAltarComponent.CRYSTAL.name()); + api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.BLOODSTONE_BRICK), ComponentType.BLOODSTONE.name()); + api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.BLOODSTONE_TILE), ComponentType.BLOODSTONE.name()); + api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_BRICK), ComponentType.CRYSTAL.name()); + api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_TILE), ComponentType.CRYSTAL.name()); BlockBloodRune bloodRune = (BlockBloodRune) RegistrarBloodMagicBlocks.BLOOD_RUNE; for (BloodRuneType runeType : BloodRuneType.values()) - api.registerAltarComponent(bloodRune.getDefaultState().withProperty(bloodRune.getProperty(), runeType), EnumAltarComponent.BLOODRUNE.name()); + api.registerAltarComponent(bloodRune.getDefaultState().withProperty(bloodRune.getProperty(), runeType), ComponentType.BLOODRUNE.name()); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/api/impl/recipe/RecipeBloodAltar.java b/src/main/java/WayofTime/bloodmagic/api/impl/recipe/RecipeBloodAltar.java index 2490f9ce..5682645e 100644 --- a/src/main/java/WayofTime/bloodmagic/api/impl/recipe/RecipeBloodAltar.java +++ b/src/main/java/WayofTime/bloodmagic/api/impl/recipe/RecipeBloodAltar.java @@ -1,6 +1,6 @@ package WayofTime.bloodmagic.api.impl.recipe; -import WayofTime.bloodmagic.altar.EnumAltarTier; +import WayofTime.bloodmagic.altar.AltarTier; import com.google.common.base.Preconditions; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; @@ -15,7 +15,7 @@ public class RecipeBloodAltar { @Nonnull private final ItemStack output; @Nonnull - private final EnumAltarTier minimumTier; + private final AltarTier minimumTier; @Nonnegative private final int syphon; @Nonnegative @@ -27,14 +27,14 @@ public class RecipeBloodAltar { Preconditions.checkNotNull(input, "input cannot be null."); Preconditions.checkNotNull(output, "output cannot be null."); Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative."); - Preconditions.checkArgument(minimumTier <= EnumAltarTier.MAXTIERS, "minimumTier cannot be higher than max tier"); + Preconditions.checkArgument(minimumTier <= AltarTier.MAXTIERS, "minimumTier cannot be higher than max tier"); Preconditions.checkArgument(syphon >= 0, "syphon cannot be negative."); Preconditions.checkArgument(consumeRate >= 0, "consumeRate cannot be negative."); Preconditions.checkArgument(drainRate >= 0, "drain cannot be negative."); this.input = input; this.output = output; - this.minimumTier = EnumAltarTier.values()[minimumTier]; + this.minimumTier = AltarTier.values()[minimumTier]; this.syphon = syphon; this.consumeRate = consumeRate; this.drainRate = drainRate; @@ -51,7 +51,7 @@ public class RecipeBloodAltar { } @Nonnull - public EnumAltarTier getMinimumTier() { + public AltarTier getMinimumTier() { return minimumTier; } diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockAltar.java b/src/main/java/WayofTime/bloodmagic/block/BlockAltar.java index a99dadea..2312acab 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockAltar.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockAltar.java @@ -1,10 +1,7 @@ package WayofTime.bloodmagic.block; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.altar.BloodAltar; -import WayofTime.bloodmagic.altar.EnumAltarComponent; -import WayofTime.bloodmagic.altar.IAltarManipulator; -import WayofTime.bloodmagic.altar.IBloodAltar; +import WayofTime.bloodmagic.altar.*; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.core.data.Binding; import WayofTime.bloodmagic.core.data.SoulNetwork; @@ -165,7 +162,7 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl public List getDocumentation(EntityPlayer player, World world, BlockPos pos, IBlockState state) { List docs = new ArrayList<>(); IBloodAltar altar = ((IBloodAltar) world.getTileEntity(pos)); - Pair missingBlock = BloodAltar.getAltarMissingBlock(world, pos, altar.getTier().toInt()); + Pair missingBlock = AltarUtil.getFirstMissingComponent(world, pos, altar.getTier().toInt()); if (missingBlock != null) docs.add(new TextComponentTranslation("chat.bloodmagic.altar.nextTier", new TextComponentTranslation(missingBlock.getRight().getKey()), Utils.prettifyBlockPosString(missingBlock.getLeft()))); diff --git a/src/main/java/WayofTime/bloodmagic/block/BlockMimic.java b/src/main/java/WayofTime/bloodmagic/block/BlockMimic.java index 003a64de..33e6cb94 100644 --- a/src/main/java/WayofTime/bloodmagic/block/BlockMimic.java +++ b/src/main/java/WayofTime/bloodmagic/block/BlockMimic.java @@ -1,7 +1,7 @@ package WayofTime.bloodmagic.block; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.altar.EnumAltarComponent; +import WayofTime.bloodmagic.altar.ComponentType; import WayofTime.bloodmagic.altar.IAltarComponent; import WayofTime.bloodmagic.block.base.BlockEnum; import WayofTime.bloodmagic.block.enums.EnumMimic; @@ -200,7 +200,7 @@ public class BlockMimic extends BlockEnum implements IAltarComponent @Nullable @Override - public EnumAltarComponent getType(World world, IBlockState state, BlockPos pos) { + public ComponentType getType(World world, IBlockState state, BlockPos pos) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileMimic) { TileMimic mimic = (TileMimic) tile; @@ -210,7 +210,7 @@ public class BlockMimic extends BlockEnum implements IAltarComponent if (block instanceof IAltarComponent) { return ((IAltarComponent) block).getType(world, block.getStateFromMeta(mimic.metaOfReplacedBlock), pos); } else { - for (EnumAltarComponent altarComponent : EnumAltarComponent.values()) + for (ComponentType altarComponent : ComponentType.values()) if (block == Utils.getBlockForComponent(altarComponent)) return altarComponent; } diff --git a/src/main/java/WayofTime/bloodmagic/client/render/block/RenderAltar.java b/src/main/java/WayofTime/bloodmagic/client/render/block/RenderAltar.java index d8988f06..0246341a 100644 --- a/src/main/java/WayofTime/bloodmagic/client/render/block/RenderAltar.java +++ b/src/main/java/WayofTime/bloodmagic/client/render/block/RenderAltar.java @@ -1,7 +1,7 @@ package WayofTime.bloodmagic.client.render.block; import WayofTime.bloodmagic.altar.AltarComponent; -import WayofTime.bloodmagic.altar.EnumAltarTier; +import WayofTime.bloodmagic.altar.AltarTier; import WayofTime.bloodmagic.block.BlockLifeEssence; import WayofTime.bloodmagic.tile.TileAltar; import WayofTime.bloodmagic.util.handler.event.ClientHandler; @@ -40,7 +40,7 @@ public class RenderAltar extends TileEntitySpecialRenderer { this.renderItem(inputStack); GlStateManager.popMatrix(); - if (tileAltar.getCurrentTierDisplayed() != EnumAltarTier.ONE) + if (tileAltar.getCurrentTierDisplayed() != AltarTier.ONE) renderHologram(tileAltar, tileAltar.getCurrentTierDisplayed(), partialTicks); } @@ -102,11 +102,11 @@ public class RenderAltar extends TileEntitySpecialRenderer { } } - private void renderHologram(TileAltar altar, EnumAltarTier tier, float partialTicks) { + private void renderHologram(TileAltar altar, AltarTier tier, float partialTicks) { EntityPlayerSP player = mc.player; World world = player.world; - if (tier == EnumAltarTier.ONE) + if (tier == AltarTier.ONE) return; GlStateManager.pushMatrix(); diff --git a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java index dbd69d57..dc591305 100644 --- a/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java +++ b/src/main/java/WayofTime/bloodmagic/core/RegistrarBloodMagicRecipes.java @@ -2,7 +2,7 @@ package WayofTime.bloodmagic.core; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.api.impl.BloodMagicRecipeRegistrar; -import WayofTime.bloodmagic.altar.EnumAltarTier; +import WayofTime.bloodmagic.altar.AltarTier; import WayofTime.bloodmagic.core.registry.OrbRegistry; import WayofTime.bloodmagic.item.ItemSlate; import WayofTime.bloodmagic.ritual.EnumRuneType; @@ -58,39 +58,39 @@ public class RegistrarBloodMagicRecipes { public static void registerAltarRecipes(BloodMagicRecipeRegistrar registrar) { // ONE - registrar.addBloodAltar(new OreIngredient("gemDiamond"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_WEAK), EnumAltarTier.ONE.ordinal(), 2000, 2, 1); - registrar.addBloodAltar(new OreIngredient("stone"), ItemSlate.SlateType.BLANK.getStack(), EnumAltarTier.ONE.ordinal(), 1000, 5, 5); - registrar.addBloodAltar(Ingredient.fromItem(Items.BUCKET), FluidUtil.getFilledBucket(new FluidStack(BlockLifeEssence.getLifeEssence(), Fluid.BUCKET_VOLUME)), EnumAltarTier.ONE.ordinal(), 1000, 5, 0); - registrar.addBloodAltar(Ingredient.fromItem(Items.BOOK), new ItemStack(RegistrarBloodMagicItems.SANGUINE_BOOK), EnumAltarTier.ONE.ordinal(), 1000, 20, 0); + registrar.addBloodAltar(new OreIngredient("gemDiamond"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_WEAK), AltarTier.ONE.ordinal(), 2000, 2, 1); + registrar.addBloodAltar(new OreIngredient("stone"), ItemSlate.SlateType.BLANK.getStack(), AltarTier.ONE.ordinal(), 1000, 5, 5); + registrar.addBloodAltar(Ingredient.fromItem(Items.BUCKET), FluidUtil.getFilledBucket(new FluidStack(BlockLifeEssence.getLifeEssence(), Fluid.BUCKET_VOLUME)), AltarTier.ONE.ordinal(), 1000, 5, 0); + registrar.addBloodAltar(Ingredient.fromItem(Items.BOOK), new ItemStack(RegistrarBloodMagicItems.SANGUINE_BOOK), AltarTier.ONE.ordinal(), 1000, 20, 0); // TWO - registrar.addBloodAltar(new OreIngredient("blockRedstone"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_APPRENTICE), EnumAltarTier.TWO.ordinal(), 5000, 5, 5); - registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.BLANK.getStack()), ItemSlate.SlateType.REINFORCED.getStack(), EnumAltarTier.TWO.ordinal(), 2000, 5, 5); - registrar.addBloodAltar(Ingredient.fromItem(Items.IRON_SWORD), new ItemStack(RegistrarBloodMagicItems.DAGGER_OF_SACRIFICE), EnumAltarTier.TWO.ordinal(), 3000, 5, 5); + registrar.addBloodAltar(new OreIngredient("blockRedstone"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_APPRENTICE), AltarTier.TWO.ordinal(), 5000, 5, 5); + registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.BLANK.getStack()), ItemSlate.SlateType.REINFORCED.getStack(), AltarTier.TWO.ordinal(), 2000, 5, 5); + registrar.addBloodAltar(Ingredient.fromItem(Items.IRON_SWORD), new ItemStack(RegistrarBloodMagicItems.DAGGER_OF_SACRIFICE), AltarTier.TWO.ordinal(), 3000, 5, 5); // THREE - registrar.addBloodAltar(new OreIngredient("blockGold"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_MAGICIAN), EnumAltarTier.THREE.ordinal(), 25000, 20, 20); - registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.REINFORCED.getStack()), ItemSlate.SlateType.IMBUED.getStack(), EnumAltarTier.THREE.ordinal(), 5000, 15, 10); - registrar.addBloodAltar(new OreIngredient("obsidian"), EnumRuneType.EARTH.getStack(), EnumAltarTier.THREE.ordinal(), 1000, 5, 5); - registrar.addBloodAltar(new OreIngredient("blockLapis"), EnumRuneType.WATER.getStack(), EnumAltarTier.THREE.ordinal(), 1000, 5, 5); - registrar.addBloodAltar(Ingredient.fromItem(Items.MAGMA_CREAM), EnumRuneType.FIRE.getStack(), EnumAltarTier.THREE.ordinal(), 1000, 5, 5); - registrar.addBloodAltar(Ingredient.fromItem(Items.GHAST_TEAR), EnumRuneType.AIR.getStack(), EnumAltarTier.THREE.ordinal(), 1000, 5, 5); - registrar.addBloodAltar(Ingredient.fromItem(RegistrarBloodMagicItems.LAVA_CRYSTAL), new ItemStack(RegistrarBloodMagicItems.ACTIVATION_CRYSTAL), EnumAltarTier.THREE.ordinal(), 10000, 20, 10); + registrar.addBloodAltar(new OreIngredient("blockGold"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_MAGICIAN), AltarTier.THREE.ordinal(), 25000, 20, 20); + registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.REINFORCED.getStack()), ItemSlate.SlateType.IMBUED.getStack(), AltarTier.THREE.ordinal(), 5000, 15, 10); + registrar.addBloodAltar(new OreIngredient("obsidian"), EnumRuneType.EARTH.getStack(), AltarTier.THREE.ordinal(), 1000, 5, 5); + registrar.addBloodAltar(new OreIngredient("blockLapis"), EnumRuneType.WATER.getStack(), AltarTier.THREE.ordinal(), 1000, 5, 5); + registrar.addBloodAltar(Ingredient.fromItem(Items.MAGMA_CREAM), EnumRuneType.FIRE.getStack(), AltarTier.THREE.ordinal(), 1000, 5, 5); + registrar.addBloodAltar(Ingredient.fromItem(Items.GHAST_TEAR), EnumRuneType.AIR.getStack(), AltarTier.THREE.ordinal(), 1000, 5, 5); + registrar.addBloodAltar(Ingredient.fromItem(RegistrarBloodMagicItems.LAVA_CRYSTAL), new ItemStack(RegistrarBloodMagicItems.ACTIVATION_CRYSTAL), AltarTier.THREE.ordinal(), 10000, 20, 10); // FOUR - registrar.addBloodAltar(Ingredient.fromStacks(new ItemStack(RegistrarBloodMagicItems.BLOOD_SHARD)), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_MASTER), EnumAltarTier.FOUR.ordinal(), 25000, 30, 50); - registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.IMBUED.getStack()), ItemSlate.SlateType.DEMONIC.getStack(), EnumAltarTier.FOUR.ordinal(), 15000, 20, 20); - registrar.addBloodAltar(new OreIngredient("blockCoal"), EnumRuneType.DUSK.getStack(), EnumAltarTier.FOUR.ordinal(), 2000, 20, 10); - registrar.addBloodAltar(new OreIngredient("enderpearl"), new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS), EnumAltarTier.FOUR.ordinal(), 2000, 10, 10); - registrar.addBloodAltar(Ingredient.fromStacks(new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS)), new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS, 1, 1), EnumAltarTier.FOUR.ordinal(), 10000, 20, 10); + registrar.addBloodAltar(Ingredient.fromStacks(new ItemStack(RegistrarBloodMagicItems.BLOOD_SHARD)), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_MASTER), AltarTier.FOUR.ordinal(), 25000, 30, 50); + registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.IMBUED.getStack()), ItemSlate.SlateType.DEMONIC.getStack(), AltarTier.FOUR.ordinal(), 15000, 20, 20); + registrar.addBloodAltar(new OreIngredient("blockCoal"), EnumRuneType.DUSK.getStack(), AltarTier.FOUR.ordinal(), 2000, 20, 10); + registrar.addBloodAltar(new OreIngredient("enderpearl"), new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS), AltarTier.FOUR.ordinal(), 2000, 10, 10); + registrar.addBloodAltar(Ingredient.fromStacks(new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS)), new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS, 1, 1), AltarTier.FOUR.ordinal(), 10000, 20, 10); // FIVE - registrar.addBloodAltar(new OreIngredient("netherStar"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_ARCHMAGE), EnumAltarTier.FIVE.ordinal(), 80000, 50, 100); - registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.DEMONIC.getStack()), ItemSlate.SlateType.ETHEREAL.getStack(), EnumAltarTier.FIVE.ordinal(), 30000, 40, 100); + registrar.addBloodAltar(new OreIngredient("netherStar"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_ARCHMAGE), AltarTier.FIVE.ordinal(), 80000, 50, 100); + registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.DEMONIC.getStack()), ItemSlate.SlateType.ETHEREAL.getStack(), AltarTier.FIVE.ordinal(), 30000, 40, 100); // SIX - registrar.addBloodAltar(Ingredient.fromStacks(new ItemStack(RegistrarBloodMagicBlocks.DECORATIVE_BRICK, 1, 2)), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_TRANSCENDENT), EnumAltarTier.SIX.ordinal(), 200000, 100, 200); - registrar.addBloodAltar(new OreIngredient("glowstone"), EnumRuneType.DAWN.getStack(), EnumAltarTier.SIX.ordinal(), 200000, 100, 200); + registrar.addBloodAltar(Ingredient.fromStacks(new ItemStack(RegistrarBloodMagicBlocks.DECORATIVE_BRICK, 1, 2)), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_TRANSCENDENT), AltarTier.SIX.ordinal(), 200000, 100, 200); + registrar.addBloodAltar(new OreIngredient("glowstone"), EnumRuneType.DAWN.getStack(), AltarTier.SIX.ordinal(), 200000, 100, 200); } public static void registerAlchemyTableRecipes(BloodMagicRecipeRegistrar registrar) { diff --git a/src/main/java/WayofTime/bloodmagic/core/registry/AltarRecipeRegistry.java b/src/main/java/WayofTime/bloodmagic/core/registry/AltarRecipeRegistry.java index e52151a5..c0c74d3a 100644 --- a/src/main/java/WayofTime/bloodmagic/core/registry/AltarRecipeRegistry.java +++ b/src/main/java/WayofTime/bloodmagic/core/registry/AltarRecipeRegistry.java @@ -2,7 +2,7 @@ package WayofTime.bloodmagic.core.registry; import WayofTime.bloodmagic.util.BMLog; import WayofTime.bloodmagic.util.ItemStackWrapper; -import WayofTime.bloodmagic.altar.EnumAltarTier; +import WayofTime.bloodmagic.altar.AltarTier; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import net.minecraft.item.ItemStack; @@ -32,7 +32,7 @@ public class AltarRecipeRegistry { BMLog.DEFAULT.error("Error adding altar recipe for input [{}].", altarRecipe.toString()); } - public static void registerFillRecipe(ItemStack orbStack, EnumAltarTier tier, int maxForOrb, int consumeRate, int drainRate) { + public static void registerFillRecipe(ItemStack orbStack, AltarTier tier, int maxForOrb, int consumeRate, int drainRate) { registerRecipe(new AltarRecipe(orbStack, orbStack, tier, maxForOrb, consumeRate, drainRate, true)); } @@ -76,7 +76,7 @@ public class AltarRecipeRegistry { public static class AltarRecipe { private final List input; private final ItemStack output; - private final EnumAltarTier minTier; + private final AltarTier minTier; private final int syphon, consumeRate, drainRate; private final boolean fillable; @@ -95,7 +95,7 @@ public class AltarRecipeRegistry { * @param drainRate - The rate at which LP is drained during crafting * @param fillable - Whether the input item can be filled with LP. IE: Orbs */ - public AltarRecipe(List input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable) { + public AltarRecipe(List input, ItemStack output, AltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable) { this.input = ItemStackWrapper.toWrapperList(input); this.output = output; this.minTier = minTier; @@ -105,27 +105,27 @@ public class AltarRecipeRegistry { this.fillable = fillable; } - public AltarRecipe(List input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate) { + public AltarRecipe(List input, ItemStack output, AltarTier minTier, int syphon, int consumeRate, int drainRate) { this(input, output, minTier, syphon, consumeRate, drainRate, false); } - public AltarRecipe(ItemStack input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable) { + public AltarRecipe(ItemStack input, ItemStack output, AltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable) { this(Collections.singletonList(input), output, minTier, syphon, consumeRate, drainRate, fillable); } - public AltarRecipe(ItemStack input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate) { + public AltarRecipe(ItemStack input, ItemStack output, AltarTier minTier, int syphon, int consumeRate, int drainRate) { this(Collections.singletonList(input), output, minTier, syphon, consumeRate, drainRate, false); } - public AltarRecipe(String inputEntry, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable) { + public AltarRecipe(String inputEntry, ItemStack output, AltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable) { this(OreDictionary.doesOreNameExist(inputEntry) && OreDictionary.getOres(inputEntry).size() > 0 ? OreDictionary.getOres(inputEntry) : Collections.emptyList(), output, minTier, syphon, consumeRate, drainRate, fillable); } - public AltarRecipe(String inputEntry, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate) { + public AltarRecipe(String inputEntry, ItemStack output, AltarTier minTier, int syphon, int consumeRate, int drainRate) { this(OreDictionary.doesOreNameExist(inputEntry) && OreDictionary.getOres(inputEntry).size() > 0 ? OreDictionary.getOres(inputEntry) : Collections.emptyList(), output, minTier, syphon, consumeRate, drainRate, false); } - public boolean doesRequiredItemMatch(ItemStack comparedStack, EnumAltarTier tierCheck) { + public boolean doesRequiredItemMatch(ItemStack comparedStack, AltarTier tierCheck) { if (comparedStack == null || this.input == null) return false; @@ -151,7 +151,7 @@ public class AltarRecipeRegistry { return output; } - public EnumAltarTier getMinTier() { + public AltarTier getMinTier() { return minTier; } diff --git a/src/main/java/WayofTime/bloodmagic/core/registry/OrbRegistry.java b/src/main/java/WayofTime/bloodmagic/core/registry/OrbRegistry.java index d911c303..81267670 100644 --- a/src/main/java/WayofTime/bloodmagic/core/registry/OrbRegistry.java +++ b/src/main/java/WayofTime/bloodmagic/core/registry/OrbRegistry.java @@ -1,6 +1,6 @@ package WayofTime.bloodmagic.core.registry; -import WayofTime.bloodmagic.altar.EnumAltarTier; +import WayofTime.bloodmagic.altar.AltarTier; import WayofTime.bloodmagic.orb.BloodOrb; import com.google.common.collect.ArrayListMultimap; import net.minecraft.item.Item; @@ -42,7 +42,7 @@ public class OrbRegistry { public static List getOrbsDownToTier(int tier) { List ret = new ArrayList<>(); - for (int i = EnumAltarTier.MAXTIERS; i >= tier; i--) + for (int i = AltarTier.MAXTIERS; i >= tier; i--) ret.addAll(getOrbsForTier(i)); return ret; diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java b/src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java index 83ca8822..b299b030 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemAltarMaker.java @@ -29,7 +29,7 @@ import javax.annotation.Nonnull; import java.util.List; public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantProvider { - private EnumAltarTier tierToBuild = EnumAltarTier.ONE; + private AltarTier tierToBuild = AltarTier.ONE; public ItemAltarMaker() { super(); @@ -61,12 +61,12 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP stack = NBTHelper.checkNBT(stack); if (player.isSneaking()) { - if (stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) >= EnumAltarTier.MAXTIERS - 1) + if (stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) >= AltarTier.MAXTIERS - 1) stack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, 0); else stack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1); - setTierToBuild(EnumAltarTier.values()[stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]); + setTierToBuild(AltarTier.values()[stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]); ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.bloodmagic.altarMaker.setTier", NumeralHelper.toRoman(stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1))); return super.onItemRightClick(world, player, hand); } @@ -91,7 +91,7 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP variants.put(0, "type=altarmaker"); // FIXME } - public void setTierToBuild(EnumAltarTier tierToBuild) { + public void setTierToBuild(AltarTier tierToBuild) { this.tierToBuild = tierToBuild; } @@ -99,12 +99,12 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP if (world.isRemote) return; - if (tierToBuild == EnumAltarTier.ONE) + if (tierToBuild == AltarTier.ONE) return; for (AltarComponent altarComponent : tierToBuild.getAltarComponents()) { BlockPos componentPos = pos.add(altarComponent.getOffset()); - if (altarComponent.getComponent() == EnumAltarComponent.NOTAIR) { + if (altarComponent.getComponent() == ComponentType.NOTAIR) { world.setBlockState(componentPos, Blocks.STONEBRICK.getDefaultState()); continue; } @@ -123,9 +123,9 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP RayTraceResult rayTrace = rayTrace(world, player, false); BlockPos pos = rayTrace.getBlockPos(); IBlockState state = world.getBlockState(pos); - EnumAltarTier altarTier = BloodAltar.getAltarTier(world, pos); + AltarTier altarTier = AltarUtil.getTier(world, pos); - if (altarTier.equals(EnumAltarTier.ONE)) + if (altarTier.equals(AltarTier.ONE)) return "" + altarTier.toInt(); else { for (AltarComponent altarComponent : altarTier.getAltarComponents()) { diff --git a/src/main/java/WayofTime/bloodmagic/item/ItemSanguineBook.java b/src/main/java/WayofTime/bloodmagic/item/ItemSanguineBook.java index 377c401e..ec2457d6 100644 --- a/src/main/java/WayofTime/bloodmagic/item/ItemSanguineBook.java +++ b/src/main/java/WayofTime/bloodmagic/item/ItemSanguineBook.java @@ -1,7 +1,7 @@ package WayofTime.bloodmagic.item; import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.altar.EnumAltarTier; +import WayofTime.bloodmagic.altar.AltarTier; import WayofTime.bloodmagic.altar.IAltarManipulator; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.iface.IDocumentedBlock; @@ -34,7 +34,7 @@ import javax.annotation.Nonnull; import java.util.List; public class ItemSanguineBook extends Item implements IVariantProvider, IAltarManipulator { - private EnumAltarTier currentDisplayedTier = EnumAltarTier.ONE; + private AltarTier currentDisplayedTier = AltarTier.ONE; public ItemSanguineBook() { setUnlocalizedName(BloodMagic.MODID + ".sanguineBook"); @@ -73,12 +73,12 @@ public class ItemSanguineBook extends Item implements IVariantProvider, IAltarMa RayTraceResult rayTrace = rayTrace(world, player, false); if (rayTrace == null || rayTrace.typeOfHit == RayTraceResult.Type.MISS || rayTrace.typeOfHit == RayTraceResult.Type.ENTITY) { - if (stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) >= EnumAltarTier.MAXTIERS - 1) + if (stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) >= AltarTier.MAXTIERS - 1) stack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, 0); else stack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1); - currentDisplayedTier = EnumAltarTier.values()[stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]; + currentDisplayedTier = AltarTier.values()[stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER)]; ChatUtil.sendNoSpam(player, TextHelper.localizeEffect("chat.bloodmagic.altarMaker.setTier", NumeralHelper.toRoman(stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1))); return super.onItemRightClick(world, player, hand); diff --git a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAltarBuilder.java b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAltarBuilder.java index 37125032..c1572201 100644 --- a/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAltarBuilder.java +++ b/src/main/java/WayofTime/bloodmagic/ritual/types/RitualAltarBuilder.java @@ -3,8 +3,8 @@ package WayofTime.bloodmagic.ritual.types; import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.util.BlockStack; import WayofTime.bloodmagic.altar.AltarComponent; -import WayofTime.bloodmagic.altar.EnumAltarComponent; -import WayofTime.bloodmagic.altar.EnumAltarTier; +import WayofTime.bloodmagic.altar.ComponentType; +import WayofTime.bloodmagic.altar.AltarTier; import WayofTime.bloodmagic.ritual.EnumRuneType; import WayofTime.bloodmagic.ritual.IMasterRitualStone; import WayofTime.bloodmagic.ritual.Ritual; @@ -30,7 +30,7 @@ import java.util.Iterator; import java.util.function.Consumer; public class RitualAltarBuilder extends Ritual { - private Iterator altarComponentsIterator = new ArrayList<>(EnumAltarTier.SIX.getAltarComponents()).iterator(); + private Iterator altarComponentsIterator = new ArrayList<>(AltarTier.SIX.getAltarComponents()).iterator(); private boolean cycleDone = false; private AltarComponent currentComponent; @@ -54,7 +54,7 @@ public class RitualAltarBuilder extends Ritual { } if (cycleDone) { - altarComponentsIterator = new ArrayList<>(EnumAltarTier.SIX.getAltarComponents()).iterator(); + altarComponentsIterator = new ArrayList<>(AltarTier.SIX.getAltarComponents()).iterator(); } if (world.getBlockState(altarPos).getBlock().isReplaceable(world, altarPos) && hasItem(tileEntity, Item.getItemFromBlock(RegistrarBloodMagicBlocks.ALTAR), 0, true)) { @@ -206,7 +206,7 @@ public class RitualAltarBuilder extends Ritual { for (int i = 0; i < itemHandler.getSlots(); i++) { if (!itemHandler.getStackInSlot(i).isEmpty() && itemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(itemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune && itemHandler.extractItem(i, 1, true) != null) { - BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), itemHandler.getStackInSlot(i).getItemDamage()); + BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(ComponentType.BLOODRUNE), itemHandler.getStackInSlot(i).getItemDamage()); itemHandler.extractItem(i, 1, false); return blockStack; } @@ -215,7 +215,7 @@ public class RitualAltarBuilder extends Ritual { IInventory inv = (IInventory) tileEntity; for (int i = 0; i < inv.getSizeInventory(); i++) { if (!inv.getStackInSlot(i).isEmpty() && inv.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune) { - BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), inv.getStackInSlot(i).getItemDamage()); + BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(ComponentType.BLOODRUNE), inv.getStackInSlot(i).getItemDamage()); inv.decrStackSize(i, 1); return blockStack; } diff --git a/src/main/java/WayofTime/bloodmagic/tile/TileAltar.java b/src/main/java/WayofTime/bloodmagic/tile/TileAltar.java index b7b5e5aa..b0ecd0c9 100644 --- a/src/main/java/WayofTime/bloodmagic/tile/TileAltar.java +++ b/src/main/java/WayofTime/bloodmagic/tile/TileAltar.java @@ -1,7 +1,7 @@ package WayofTime.bloodmagic.tile; import WayofTime.bloodmagic.altar.BloodAltar; -import WayofTime.bloodmagic.altar.EnumAltarTier; +import WayofTime.bloodmagic.altar.AltarTier; import WayofTime.bloodmagic.altar.IBloodAltar; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -67,7 +67,7 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickable { } @Override - public EnumAltarTier getTier() { + public AltarTier getTier() { return bloodAltar.getTier(); } @@ -161,11 +161,11 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickable { return bloodAltar.getChargingFrequency(); } - public EnumAltarTier getCurrentTierDisplayed() { + public AltarTier getCurrentTierDisplayed() { return bloodAltar.getCurrentTierDisplayed(); } - public boolean setCurrentTierDisplayed(EnumAltarTier altarTier) { + public boolean setCurrentTierDisplayed(AltarTier altarTier) { return bloodAltar.setCurrentTierDisplayed(altarTier); } diff --git a/src/main/java/WayofTime/bloodmagic/util/Utils.java b/src/main/java/WayofTime/bloodmagic/util/Utils.java index 83ea0573..052977db 100644 --- a/src/main/java/WayofTime/bloodmagic/util/Utils.java +++ b/src/main/java/WayofTime/bloodmagic/util/Utils.java @@ -1,6 +1,6 @@ package WayofTime.bloodmagic.util; -import WayofTime.bloodmagic.altar.EnumAltarComponent; +import WayofTime.bloodmagic.altar.ComponentType; import WayofTime.bloodmagic.iface.IDemonWillViewer; import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks; @@ -321,12 +321,12 @@ public class Utils { } /** - * Gets a default block for each type of {@link EnumAltarComponent} + * Gets a default block for each type of {@link ComponentType} * * @param component - The Component to provide a block for. * @return The default Block for the EnumAltarComponent */ - public static Block getBlockForComponent(EnumAltarComponent component) { + public static Block getBlockForComponent(ComponentType component) { switch (component) { case GLOWSTONE: return Blocks.GLOWSTONE;