Some altar cleanup and renaming

This commit is contained in:
Nicholas Ignoffo 2018-03-09 18:00:04 -08:00
parent fefeaf26af
commit eada60f436
21 changed files with 253 additions and 254 deletions

View file

@ -6,18 +6,17 @@ import net.minecraft.util.math.BlockPos;
* Used for building the altar structure. * Used for building the altar structure.
*/ */
public class AltarComponent { public class AltarComponent {
private BlockPos offset; private final BlockPos offset;
private final ComponentType component;
private boolean upgradeSlot; private boolean upgradeSlot;
private EnumAltarComponent component;
/** /**
* Sets a component location for the altar. * Sets a component location for the altar.
* *
* @param offset - Where the block should be in relation to the Altar * @param offset - Where the block should be in relation to the Altar
* @param component - The type of Component the location should contain * @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.offset = offset;
this.component = component; this.component = component;
} }
@ -29,7 +28,7 @@ public class AltarComponent {
* @param offset - Where the block should be in relation to the Altar * @param offset - Where the block should be in relation to the Altar
*/ */
public AltarComponent(BlockPos offset) { public AltarComponent(BlockPos offset) {
this(offset, EnumAltarComponent.NOTAIR); this(offset, ComponentType.NOTAIR);
} }
/** /**
@ -50,7 +49,7 @@ public class AltarComponent {
return upgradeSlot; return upgradeSlot;
} }
public EnumAltarComponent getComponent() { public ComponentType getComponent() {
return component; return component;
} }
} }

View file

@ -5,31 +5,31 @@ import net.minecraft.util.math.BlockPos;
import java.util.ArrayList; import java.util.ArrayList;
//@formatter:off //@formatter:off
public enum EnumAltarTier { public enum AltarTier {
ONE(), TWO() { ONE(), TWO() {
@Override @Override
public void buildComponents() { public void buildComponents() {
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), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(0, -1, -1), ComponentType.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(-1, -1, 0), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(1, -1, 0), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(1, -1, 0), ComponentType.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), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(0, -1, 1), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(1, -1, 1), EnumAltarComponent.BLOODRUNE)); altarComponents.add(new AltarComponent(new BlockPos(1, -1, 1), ComponentType.BLOODRUNE));
} }
}, },
THREE() { THREE() {
@Override @Override
public void buildComponents() { public void buildComponents() {
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), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(0, -1, -1), ComponentType.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(-1, -1, 0), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(-1, -1, 0), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(1, -1, 0), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(1, -1, 0), ComponentType.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), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(0, -1, 1), ComponentType.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(-3, -1, -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, 0, -3)));
altarComponents.add(new AltarComponent(new BlockPos(3, -1, -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, 0, 3)));
altarComponents.add(new AltarComponent(new BlockPos(3, -1, 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, 0, 3)));
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), EnumAltarComponent.GLOWSTONE)); altarComponents.add(new AltarComponent(new BlockPos(3, 1, -3), ComponentType.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), EnumAltarComponent.GLOWSTONE)); altarComponents.add(new AltarComponent(new BlockPos(3, 1, 3), ComponentType.GLOWSTONE));
for (int i = -2; i <= 2; i++) { 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), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(-3, -2, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(-3, -2, i), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(i, -2, 3), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(i, -2, 3), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(i, -2, -3), EnumAltarComponent.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()); altarComponents.addAll(THREE.getAltarComponents());
for (int i = -3; i <= 3; i++) { 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), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(-5, -3, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(-5, -3, i), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(i, -3, 5), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(i, -3, 5), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(i, -3, -5), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(i, -3, -5), ComponentType.BLOODRUNE).setUpgradeSlot());
} }
for (int i = -2; i <= 1; i++) { 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, i, 5)));
} }
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), EnumAltarComponent.BLOODSTONE)); altarComponents.add(new AltarComponent(new BlockPos(5, 2, -5), ComponentType.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), EnumAltarComponent.BLOODSTONE)); altarComponents.add(new AltarComponent(new BlockPos(-5, 2, 5), ComponentType.BLOODSTONE));
} }
}, },
FIVE() { FIVE() {
@Override @Override
public void buildComponents() { public void buildComponents() {
altarComponents.addAll(FOUR.getAltarComponents()); altarComponents.addAll(FOUR.getAltarComponents());
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), EnumAltarComponent.BEACON)); altarComponents.add(new AltarComponent(new BlockPos(-8, -3, -8), ComponentType.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), EnumAltarComponent.BEACON)); altarComponents.add(new AltarComponent(new BlockPos(8, -3, 8), ComponentType.BEACON));
for (int i = -6; i <= 6; i++) { 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), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(-8, -4, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(-8, -4, i), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(i, -4, 8), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(i, -4, 8), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(i, -4, -8), EnumAltarComponent.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, i, 11)));
} }
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), EnumAltarComponent.CRYSTAL)); altarComponents.add(new AltarComponent(new BlockPos(-11, 3, -11), ComponentType.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), EnumAltarComponent.CRYSTAL)); altarComponents.add(new AltarComponent(new BlockPos(-11, 3, 11), ComponentType.CRYSTAL));
for (int i = -9; i <= 9; i++) { 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), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(-11, -5, i), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(-11, -5, i), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(i, -5, 11), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(i, -5, 11), ComponentType.BLOODRUNE).setUpgradeSlot());
altarComponents.add(new AltarComponent(new BlockPos(i, -5, -11), EnumAltarComponent.BLOODRUNE).setUpgradeSlot()); altarComponents.add(new AltarComponent(new BlockPos(i, -5, -11), ComponentType.BLOODRUNE).setUpgradeSlot());
} }
} }
//@formatter:on //@formatter:on

View file

@ -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<IBlockState> 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<BlockPos, ComponentType> 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<IBlockState> validStates = BloodMagicAPI.INSTANCE.getComponentStates(component.getComponent());
if (!validStates.contains(worldState))
return Pair.of(componentPos, component.getComponent());
}
}
return null;
}
}

View file

@ -6,7 +6,6 @@ import WayofTime.bloodmagic.api.impl.recipe.RecipeBloodAltar;
import WayofTime.bloodmagic.block.enums.BloodRuneType; import WayofTime.bloodmagic.block.enums.BloodRuneType;
import WayofTime.bloodmagic.core.data.Binding; import WayofTime.bloodmagic.core.data.Binding;
import WayofTime.bloodmagic.iface.IBindable; import WayofTime.bloodmagic.iface.IBindable;
import WayofTime.bloodmagic.iface.IBloodRune;
import WayofTime.bloodmagic.util.Constants; import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.orb.BloodOrb; import WayofTime.bloodmagic.orb.BloodOrb;
import WayofTime.bloodmagic.orb.IBloodOrb; 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.IFluidHandler;
import net.minecraftforge.fluids.capability.IFluidTankProperties; import net.minecraftforge.fluids.capability.IFluidTankProperties;
import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemHandlerHelper;
import org.apache.commons.lang3.tuple.Pair;
import java.util.List;
public class BloodAltar implements IFluidHandler { public class BloodAltar implements IFluidHandler {
static { static {
EnumAltarTier.ONE.buildComponents(); AltarTier.ONE.buildComponents();
EnumAltarTier.TWO.buildComponents(); AltarTier.TWO.buildComponents();
EnumAltarTier.THREE.buildComponents(); AltarTier.THREE.buildComponents();
EnumAltarTier.FOUR.buildComponents(); AltarTier.FOUR.buildComponents();
EnumAltarTier.FIVE.buildComponents(); AltarTier.FIVE.buildComponents();
EnumAltarTier.SIX.buildComponents(); AltarTier.SIX.buildComponents();
} }
public boolean isActive; public boolean isActive;
@ -49,7 +45,7 @@ public class BloodAltar implements IFluidHandler {
protected FluidStack fluidInput = new FluidStack(BlockLifeEssence.getLifeEssence(), 0); protected FluidStack fluidInput = new FluidStack(BlockLifeEssence.getLifeEssence(), 0);
private TileAltar tileAltar; private TileAltar tileAltar;
private int internalCounter = 0; private int internalCounter = 0;
private EnumAltarTier altarTier = EnumAltarTier.ONE; private AltarTier altarTier = AltarTier.ONE;
private AltarUpgrade upgrade; private AltarUpgrade upgrade;
private int capacity = Fluid.BUCKET_VOLUME * 10; private int capacity = Fluid.BUCKET_VOLUME * 10;
private FluidStack fluid = new FluidStack(BlockLifeEssence.getLifeEssence(), 0); private FluidStack fluid = new FluidStack(BlockLifeEssence.getLifeEssence(), 0);
@ -77,7 +73,7 @@ public class BloodAltar implements IFluidHandler {
private int maxCharge = 0; private int maxCharge = 0;
private int cooldownAfterCrafting = 60; private int cooldownAfterCrafting = 60;
private RecipeBloodAltar recipe; private RecipeBloodAltar recipe;
private EnumAltarTier currentTierDisplayed = EnumAltarTier.ONE; private AltarTier currentTierDisplayed = AltarTier.ONE;
public BloodAltar(TileAltar tileAltar) { public BloodAltar(TileAltar tileAltar) {
this.tileAltar = tileAltar; this.tileAltar = tileAltar;
@ -98,7 +94,7 @@ public class BloodAltar implements IFluidHandler {
} }
internalCounter = tagCompound.getInteger("internalCounter"); 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); isActive = tagCompound.getBoolean(Constants.NBT.ALTAR_ACTIVE);
liquidRequired = tagCompound.getInteger(Constants.NBT.ALTAR_LIQUID_REQ); liquidRequired = tagCompound.getInteger(Constants.NBT.ALTAR_LIQUID_REQ);
canBeFilled = tagCompound.getBoolean(Constants.NBT.ALTAR_FILLABLE); canBeFilled = tagCompound.getBoolean(Constants.NBT.ALTAR_FILLABLE);
@ -124,7 +120,7 @@ public class BloodAltar implements IFluidHandler {
chargingFrequency = tagCompound.getInteger(Constants.NBT.ALTAR_CHARGE_FREQUENCY); chargingFrequency = tagCompound.getInteger(Constants.NBT.ALTAR_CHARGE_FREQUENCY);
totalCharge = tagCompound.getInteger(Constants.NBT.ALTAR_TOTAL_CHARGE); totalCharge = tagCompound.getInteger(Constants.NBT.ALTAR_TOTAL_CHARGE);
maxCharge = tagCompound.getInteger(Constants.NBT.ALTAR_MAX_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) { public void writeToNBT(NBTTagCompound tagCompound) {
@ -358,15 +354,15 @@ public class BloodAltar implements IFluidHandler {
} }
public void checkTier() { public void checkTier() {
EnumAltarTier tier = BloodAltar.getAltarTier(tileAltar.getWorld(), tileAltar.getPos()); AltarTier tier = AltarUtil.getTier(tileAltar.getWorld(), tileAltar.getPos());
this.altarTier = tier; this.altarTier = tier;
upgrade = BloodAltar.getUpgrades(tileAltar.getWorld(), tileAltar.getPos(), tier); upgrade = AltarUtil.getUpgrades(tileAltar.getWorld(), tileAltar.getPos(), tier);
if (tier.equals(currentTierDisplayed)) if (tier.equals(currentTierDisplayed))
currentTierDisplayed = EnumAltarTier.ONE; currentTierDisplayed = AltarTier.ONE;
if (tier.equals(EnumAltarTier.ONE)) { if (tier.equals(AltarTier.ONE)) {
upgrade = null; upgrade = null;
isUpgraded = false; isUpgraded = false;
this.consumptionMultiplier = 0; this.consumptionMultiplier = 0;
@ -382,7 +378,7 @@ public class BloodAltar implements IFluidHandler {
this.maxCharge = 0; this.maxCharge = 0;
this.totalCharge = 0; this.totalCharge = 0;
return; return;
} else if (!tier.equals(EnumAltarTier.ONE) && upgrade != null) { } else if (!tier.equals(AltarTier.ONE)) {
this.isUpgraded = true; this.isUpgraded = true;
this.accelerationUpgrades = upgrade.getLevel(BloodRuneType.ACCELERATION); this.accelerationUpgrades = upgrade.getLevel(BloodRuneType.ACCELERATION);
this.consumptionMultiplier = (float) (0.20 * upgrade.getLevel(BloodRuneType.SPEED)); this.consumptionMultiplier = (float) (0.20 * upgrade.getLevel(BloodRuneType.SPEED));
@ -464,11 +460,11 @@ public class BloodAltar implements IFluidHandler {
return getFluidAmount(); return getFluidAmount();
} }
public EnumAltarTier getTier() { public AltarTier getTier() {
return altarTier; return altarTier;
} }
public void setTier(EnumAltarTier tier) { public void setTier(AltarTier tier) {
this.altarTier = tier; this.altarTier = tier;
} }
@ -508,7 +504,7 @@ public class BloodAltar implements IFluidHandler {
return bufferCapacity; return bufferCapacity;
} }
public boolean setCurrentTierDisplayed(EnumAltarTier altarTier) { public boolean setCurrentTierDisplayed(AltarTier altarTier) {
if (currentTierDisplayed == altarTier) if (currentTierDisplayed == altarTier)
return false; return false;
else else
@ -626,85 +622,7 @@ public class BloodAltar implements IFluidHandler {
return new IFluidTankProperties[]{new FluidTankPropertiesWrapper(new FluidTank(fluid, capacity))}; return new IFluidTankProperties[]{new FluidTankPropertiesWrapper(new FluidTank(fluid, capacity))};
} }
public EnumAltarTier getCurrentTierDisplayed() { public AltarTier getCurrentTierDisplayed() {
return currentTierDisplayed; 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<BlockPos, EnumAltarComponent> 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<AltarComponent> 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;
}
} }

View file

@ -5,7 +5,7 @@ import java.util.Locale;
/** /**
* List of different components used to construct different tiers of altars. * List of different components used to construct different tiers of altars.
*/ */
public enum EnumAltarComponent { public enum ComponentType {
GLOWSTONE, GLOWSTONE,
BLOODSTONE, BLOODSTONE,
BEACON, BEACON,
@ -13,11 +13,11 @@ public enum EnumAltarComponent {
CRYSTAL, CRYSTAL,
NOTAIR; NOTAIR;
public static final EnumAltarComponent[] VALUES = values(); public static final ComponentType[] VALUES = values();
private static final String BASE = "chat.bloodmagic.altar.comp."; private static final String BASE = "chat.bloodmagic.altar.comp.";
private String key; private String key;
EnumAltarComponent() { ComponentType() {
this.key = BASE + name().toLowerCase(Locale.ENGLISH); this.key = BASE + name().toLowerCase(Locale.ENGLISH);
} }

View file

@ -8,5 +8,5 @@ import javax.annotation.Nullable;
public interface IAltarComponent { public interface IAltarComponent {
@Nullable @Nullable
EnumAltarComponent getType(World world, IBlockState state, BlockPos pos); ComponentType getType(World world, IBlockState state, BlockPos pos);
} }

View file

@ -5,7 +5,7 @@ public interface IBloodAltar {
int getCurrentBlood(); int getCurrentBlood();
EnumAltarTier getTier(); AltarTier getTier();
int getProgress(); int getProgress();

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.api.impl; package WayofTime.bloodmagic.api.impl;
import WayofTime.bloodmagic.api.IBloodMagicAPI; import WayofTime.bloodmagic.api.IBloodMagicAPI;
import WayofTime.bloodmagic.altar.EnumAltarComponent; import WayofTime.bloodmagic.altar.ComponentType;
import WayofTime.bloodmagic.util.BMLog; import WayofTime.bloodmagic.util.BMLog;
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
@ -17,7 +17,7 @@ public class BloodMagicAPI implements IBloodMagicAPI {
private final BloodMagicBlacklist blacklist; private final BloodMagicBlacklist blacklist;
private final BloodMagicRecipeRegistrar recipeRegistrar; private final BloodMagicRecipeRegistrar recipeRegistrar;
private final BloodMagicValueManager valueManager; private final BloodMagicValueManager valueManager;
private final Multimap<EnumAltarComponent, IBlockState> altarComponents; private final Multimap<ComponentType, IBlockState> altarComponents;
public BloodMagicAPI() { public BloodMagicAPI() {
this.blacklist = new BloodMagicBlacklist(); this.blacklist = new BloodMagicBlacklist();
@ -46,8 +46,8 @@ public class BloodMagicAPI implements IBloodMagicAPI {
@Override @Override
public void registerAltarComponent(@Nonnull IBlockState state, @Nonnull String componentType) { public void registerAltarComponent(@Nonnull IBlockState state, @Nonnull String componentType) {
EnumAltarComponent component = null; ComponentType component = null;
for (EnumAltarComponent type : EnumAltarComponent.VALUES) { for (ComponentType type : ComponentType.VALUES) {
if (type.name().equalsIgnoreCase(componentType)) { if (type.name().equalsIgnoreCase(componentType)) {
component = type; component = type;
break; break;
@ -61,7 +61,7 @@ public class BloodMagicAPI implements IBloodMagicAPI {
} }
@Nonnull @Nonnull
public List<IBlockState> getComponentStates(EnumAltarComponent component) { public List<IBlockState> getComponentStates(ComponentType component) {
return (List<IBlockState>) altarComponents.get(component); return (List<IBlockState>) altarComponents.get(component);
} }
} }

View file

@ -5,7 +5,7 @@ import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.api.BloodMagicPlugin; import WayofTime.bloodmagic.api.BloodMagicPlugin;
import WayofTime.bloodmagic.api.IBloodMagicAPI; import WayofTime.bloodmagic.api.IBloodMagicAPI;
import WayofTime.bloodmagic.api.IBloodMagicPlugin; import WayofTime.bloodmagic.api.IBloodMagicPlugin;
import WayofTime.bloodmagic.altar.EnumAltarComponent; import WayofTime.bloodmagic.altar.ComponentType;
import WayofTime.bloodmagic.api.IBloodMagicRecipeRegistrar; import WayofTime.bloodmagic.api.IBloodMagicRecipeRegistrar;
import WayofTime.bloodmagic.block.BlockBloodRune; import WayofTime.bloodmagic.block.BlockBloodRune;
import WayofTime.bloodmagic.block.BlockDecorative; import WayofTime.bloodmagic.block.BlockDecorative;
@ -66,19 +66,19 @@ public class BloodMagicCorePlugin implements IBloodMagicPlugin {
handleConfigValues(api); handleConfigValues(api);
// Add standard blocks for altar components // Add standard blocks for altar components
api.registerAltarComponent(Blocks.GLOWSTONE.getDefaultState(), EnumAltarComponent.GLOWSTONE.name()); api.registerAltarComponent(Blocks.GLOWSTONE.getDefaultState(), ComponentType.GLOWSTONE.name());
api.registerAltarComponent(Blocks.SEA_LANTERN.getDefaultState(), EnumAltarComponent.GLOWSTONE.name()); api.registerAltarComponent(Blocks.SEA_LANTERN.getDefaultState(), ComponentType.GLOWSTONE.name());
api.registerAltarComponent(Blocks.BEACON.getDefaultState(), EnumAltarComponent.BEACON.name()); api.registerAltarComponent(Blocks.BEACON.getDefaultState(), ComponentType.BEACON.name());
BlockDecorative decorative = (BlockDecorative) RegistrarBloodMagicBlocks.DECORATIVE_BRICK; 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_BRICK), ComponentType.BLOODSTONE.name());
api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.BLOODSTONE_TILE), EnumAltarComponent.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), EnumAltarComponent.CRYSTAL.name()); api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_BRICK), ComponentType.CRYSTAL.name());
api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_TILE), EnumAltarComponent.CRYSTAL.name()); api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_TILE), ComponentType.CRYSTAL.name());
BlockBloodRune bloodRune = (BlockBloodRune) RegistrarBloodMagicBlocks.BLOOD_RUNE; BlockBloodRune bloodRune = (BlockBloodRune) RegistrarBloodMagicBlocks.BLOOD_RUNE;
for (BloodRuneType runeType : BloodRuneType.values()) 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 @Override

View file

@ -1,6 +1,6 @@
package WayofTime.bloodmagic.api.impl.recipe; package WayofTime.bloodmagic.api.impl.recipe;
import WayofTime.bloodmagic.altar.EnumAltarTier; import WayofTime.bloodmagic.altar.AltarTier;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.Ingredient;
@ -15,7 +15,7 @@ public class RecipeBloodAltar {
@Nonnull @Nonnull
private final ItemStack output; private final ItemStack output;
@Nonnull @Nonnull
private final EnumAltarTier minimumTier; private final AltarTier minimumTier;
@Nonnegative @Nonnegative
private final int syphon; private final int syphon;
@Nonnegative @Nonnegative
@ -27,14 +27,14 @@ public class RecipeBloodAltar {
Preconditions.checkNotNull(input, "input cannot be null."); Preconditions.checkNotNull(input, "input cannot be null.");
Preconditions.checkNotNull(output, "output cannot be null."); Preconditions.checkNotNull(output, "output cannot be null.");
Preconditions.checkArgument(minimumTier >= 0, "minimumTier cannot be negative."); 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(syphon >= 0, "syphon cannot be negative.");
Preconditions.checkArgument(consumeRate >= 0, "consumeRate cannot be negative."); Preconditions.checkArgument(consumeRate >= 0, "consumeRate cannot be negative.");
Preconditions.checkArgument(drainRate >= 0, "drain cannot be negative."); Preconditions.checkArgument(drainRate >= 0, "drain cannot be negative.");
this.input = input; this.input = input;
this.output = output; this.output = output;
this.minimumTier = EnumAltarTier.values()[minimumTier]; this.minimumTier = AltarTier.values()[minimumTier];
this.syphon = syphon; this.syphon = syphon;
this.consumeRate = consumeRate; this.consumeRate = consumeRate;
this.drainRate = drainRate; this.drainRate = drainRate;
@ -51,7 +51,7 @@ public class RecipeBloodAltar {
} }
@Nonnull @Nonnull
public EnumAltarTier getMinimumTier() { public AltarTier getMinimumTier() {
return minimumTier; return minimumTier;
} }

View file

@ -1,10 +1,7 @@
package WayofTime.bloodmagic.block; package WayofTime.bloodmagic.block;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.altar.BloodAltar; import WayofTime.bloodmagic.altar.*;
import WayofTime.bloodmagic.altar.EnumAltarComponent;
import WayofTime.bloodmagic.altar.IAltarManipulator;
import WayofTime.bloodmagic.altar.IBloodAltar;
import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.core.data.Binding; import WayofTime.bloodmagic.core.data.Binding;
import WayofTime.bloodmagic.core.data.SoulNetwork; import WayofTime.bloodmagic.core.data.SoulNetwork;
@ -165,7 +162,7 @@ public class BlockAltar extends Block implements IVariantProvider, IDocumentedBl
public List<ITextComponent> getDocumentation(EntityPlayer player, World world, BlockPos pos, IBlockState state) { public List<ITextComponent> getDocumentation(EntityPlayer player, World world, BlockPos pos, IBlockState state) {
List<ITextComponent> docs = new ArrayList<>(); List<ITextComponent> docs = new ArrayList<>();
IBloodAltar altar = ((IBloodAltar) world.getTileEntity(pos)); IBloodAltar altar = ((IBloodAltar) world.getTileEntity(pos));
Pair<BlockPos, EnumAltarComponent> missingBlock = BloodAltar.getAltarMissingBlock(world, pos, altar.getTier().toInt()); Pair<BlockPos, ComponentType> missingBlock = AltarUtil.getFirstMissingComponent(world, pos, altar.getTier().toInt());
if (missingBlock != null) if (missingBlock != null)
docs.add(new TextComponentTranslation("chat.bloodmagic.altar.nextTier", new TextComponentTranslation(missingBlock.getRight().getKey()), Utils.prettifyBlockPosString(missingBlock.getLeft()))); docs.add(new TextComponentTranslation("chat.bloodmagic.altar.nextTier", new TextComponentTranslation(missingBlock.getRight().getKey()), Utils.prettifyBlockPosString(missingBlock.getLeft())));

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.block; package WayofTime.bloodmagic.block;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.altar.EnumAltarComponent; import WayofTime.bloodmagic.altar.ComponentType;
import WayofTime.bloodmagic.altar.IAltarComponent; import WayofTime.bloodmagic.altar.IAltarComponent;
import WayofTime.bloodmagic.block.base.BlockEnum; import WayofTime.bloodmagic.block.base.BlockEnum;
import WayofTime.bloodmagic.block.enums.EnumMimic; import WayofTime.bloodmagic.block.enums.EnumMimic;
@ -200,7 +200,7 @@ public class BlockMimic extends BlockEnum<EnumMimic> implements IAltarComponent
@Nullable @Nullable
@Override @Override
public EnumAltarComponent getType(World world, IBlockState state, BlockPos pos) { public ComponentType getType(World world, IBlockState state, BlockPos pos) {
TileEntity tile = world.getTileEntity(pos); TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileMimic) { if (tile instanceof TileMimic) {
TileMimic mimic = (TileMimic) tile; TileMimic mimic = (TileMimic) tile;
@ -210,7 +210,7 @@ public class BlockMimic extends BlockEnum<EnumMimic> implements IAltarComponent
if (block instanceof IAltarComponent) { if (block instanceof IAltarComponent) {
return ((IAltarComponent) block).getType(world, block.getStateFromMeta(mimic.metaOfReplacedBlock), pos); return ((IAltarComponent) block).getType(world, block.getStateFromMeta(mimic.metaOfReplacedBlock), pos);
} else { } else {
for (EnumAltarComponent altarComponent : EnumAltarComponent.values()) for (ComponentType altarComponent : ComponentType.values())
if (block == Utils.getBlockForComponent(altarComponent)) if (block == Utils.getBlockForComponent(altarComponent))
return altarComponent; return altarComponent;
} }

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.client.render.block; package WayofTime.bloodmagic.client.render.block;
import WayofTime.bloodmagic.altar.AltarComponent; import WayofTime.bloodmagic.altar.AltarComponent;
import WayofTime.bloodmagic.altar.EnumAltarTier; import WayofTime.bloodmagic.altar.AltarTier;
import WayofTime.bloodmagic.block.BlockLifeEssence; import WayofTime.bloodmagic.block.BlockLifeEssence;
import WayofTime.bloodmagic.tile.TileAltar; import WayofTime.bloodmagic.tile.TileAltar;
import WayofTime.bloodmagic.util.handler.event.ClientHandler; import WayofTime.bloodmagic.util.handler.event.ClientHandler;
@ -40,7 +40,7 @@ public class RenderAltar extends TileEntitySpecialRenderer<TileAltar> {
this.renderItem(inputStack); this.renderItem(inputStack);
GlStateManager.popMatrix(); GlStateManager.popMatrix();
if (tileAltar.getCurrentTierDisplayed() != EnumAltarTier.ONE) if (tileAltar.getCurrentTierDisplayed() != AltarTier.ONE)
renderHologram(tileAltar, tileAltar.getCurrentTierDisplayed(), partialTicks); renderHologram(tileAltar, tileAltar.getCurrentTierDisplayed(), partialTicks);
} }
@ -102,11 +102,11 @@ public class RenderAltar extends TileEntitySpecialRenderer<TileAltar> {
} }
} }
private void renderHologram(TileAltar altar, EnumAltarTier tier, float partialTicks) { private void renderHologram(TileAltar altar, AltarTier tier, float partialTicks) {
EntityPlayerSP player = mc.player; EntityPlayerSP player = mc.player;
World world = player.world; World world = player.world;
if (tier == EnumAltarTier.ONE) if (tier == AltarTier.ONE)
return; return;
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();

View file

@ -2,7 +2,7 @@ package WayofTime.bloodmagic.core;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.impl.BloodMagicRecipeRegistrar; 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.core.registry.OrbRegistry;
import WayofTime.bloodmagic.item.ItemSlate; import WayofTime.bloodmagic.item.ItemSlate;
import WayofTime.bloodmagic.ritual.EnumRuneType; import WayofTime.bloodmagic.ritual.EnumRuneType;
@ -58,39 +58,39 @@ public class RegistrarBloodMagicRecipes {
public static void registerAltarRecipes(BloodMagicRecipeRegistrar registrar) { public static void registerAltarRecipes(BloodMagicRecipeRegistrar registrar) {
// ONE // ONE
registrar.addBloodAltar(new OreIngredient("gemDiamond"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_WEAK), EnumAltarTier.ONE.ordinal(), 2000, 2, 1); 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(), EnumAltarTier.ONE.ordinal(), 1000, 5, 5); 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)), EnumAltarTier.ONE.ordinal(), 1000, 5, 0); 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), EnumAltarTier.ONE.ordinal(), 1000, 20, 0); registrar.addBloodAltar(Ingredient.fromItem(Items.BOOK), new ItemStack(RegistrarBloodMagicItems.SANGUINE_BOOK), AltarTier.ONE.ordinal(), 1000, 20, 0);
// TWO // TWO
registrar.addBloodAltar(new OreIngredient("blockRedstone"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_APPRENTICE), EnumAltarTier.TWO.ordinal(), 5000, 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(), EnumAltarTier.TWO.ordinal(), 2000, 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), EnumAltarTier.TWO.ordinal(), 3000, 5, 5); registrar.addBloodAltar(Ingredient.fromItem(Items.IRON_SWORD), new ItemStack(RegistrarBloodMagicItems.DAGGER_OF_SACRIFICE), AltarTier.TWO.ordinal(), 3000, 5, 5);
// THREE // THREE
registrar.addBloodAltar(new OreIngredient("blockGold"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_MAGICIAN), EnumAltarTier.THREE.ordinal(), 25000, 20, 20); 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(), EnumAltarTier.THREE.ordinal(), 5000, 15, 10); 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(), EnumAltarTier.THREE.ordinal(), 1000, 5, 5); registrar.addBloodAltar(new OreIngredient("obsidian"), EnumRuneType.EARTH.getStack(), AltarTier.THREE.ordinal(), 1000, 5, 5);
registrar.addBloodAltar(new OreIngredient("blockLapis"), EnumRuneType.WATER.getStack(), EnumAltarTier.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(), EnumAltarTier.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(), EnumAltarTier.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), EnumAltarTier.THREE.ordinal(), 10000, 20, 10); registrar.addBloodAltar(Ingredient.fromItem(RegistrarBloodMagicItems.LAVA_CRYSTAL), new ItemStack(RegistrarBloodMagicItems.ACTIVATION_CRYSTAL), AltarTier.THREE.ordinal(), 10000, 20, 10);
// FOUR // 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(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(), EnumAltarTier.FOUR.ordinal(), 15000, 20, 20); 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(), EnumAltarTier.FOUR.ordinal(), 2000, 20, 10); registrar.addBloodAltar(new OreIngredient("blockCoal"), EnumRuneType.DUSK.getStack(), AltarTier.FOUR.ordinal(), 2000, 20, 10);
registrar.addBloodAltar(new OreIngredient("enderpearl"), new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS), EnumAltarTier.FOUR.ordinal(), 2000, 10, 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), EnumAltarTier.FOUR.ordinal(), 10000, 20, 10); registrar.addBloodAltar(Ingredient.fromStacks(new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS)), new ItemStack(RegistrarBloodMagicItems.TELEPOSITION_FOCUS, 1, 1), AltarTier.FOUR.ordinal(), 10000, 20, 10);
// FIVE // FIVE
registrar.addBloodAltar(new OreIngredient("netherStar"), OrbRegistry.getOrbStack(RegistrarBloodMagic.ORB_ARCHMAGE), EnumAltarTier.FIVE.ordinal(), 80000, 50, 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(), EnumAltarTier.FIVE.ordinal(), 30000, 40, 100); registrar.addBloodAltar(Ingredient.fromStacks(ItemSlate.SlateType.DEMONIC.getStack()), ItemSlate.SlateType.ETHEREAL.getStack(), AltarTier.FIVE.ordinal(), 30000, 40, 100);
// SIX // 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(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(), EnumAltarTier.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) { public static void registerAlchemyTableRecipes(BloodMagicRecipeRegistrar registrar) {

View file

@ -2,7 +2,7 @@ package WayofTime.bloodmagic.core.registry;
import WayofTime.bloodmagic.util.BMLog; import WayofTime.bloodmagic.util.BMLog;
import WayofTime.bloodmagic.util.ItemStackWrapper; 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.BiMap;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -32,7 +32,7 @@ public class AltarRecipeRegistry {
BMLog.DEFAULT.error("Error adding altar recipe for input [{}].", altarRecipe.toString()); 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)); registerRecipe(new AltarRecipe(orbStack, orbStack, tier, maxForOrb, consumeRate, drainRate, true));
} }
@ -76,7 +76,7 @@ public class AltarRecipeRegistry {
public static class AltarRecipe { public static class AltarRecipe {
private final List<ItemStackWrapper> input; private final List<ItemStackWrapper> input;
private final ItemStack output; private final ItemStack output;
private final EnumAltarTier minTier; private final AltarTier minTier;
private final int syphon, consumeRate, drainRate; private final int syphon, consumeRate, drainRate;
private final boolean fillable; private final boolean fillable;
@ -95,7 +95,7 @@ public class AltarRecipeRegistry {
* @param drainRate - The rate at which LP is drained during crafting * @param drainRate - The rate at which LP is drained during crafting
* @param fillable - Whether the input item can be filled with LP. IE: Orbs * @param fillable - Whether the input item can be filled with LP. IE: Orbs
*/ */
public AltarRecipe(List<ItemStack> input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable) { public AltarRecipe(List<ItemStack> input, ItemStack output, AltarTier minTier, int syphon, int consumeRate, int drainRate, boolean fillable) {
this.input = ItemStackWrapper.toWrapperList(input); this.input = ItemStackWrapper.toWrapperList(input);
this.output = output; this.output = output;
this.minTier = minTier; this.minTier = minTier;
@ -105,27 +105,27 @@ public class AltarRecipeRegistry {
this.fillable = fillable; this.fillable = fillable;
} }
public AltarRecipe(List<ItemStack> input, ItemStack output, EnumAltarTier minTier, int syphon, int consumeRate, int drainRate) { public AltarRecipe(List<ItemStack> input, ItemStack output, AltarTier minTier, int syphon, int consumeRate, int drainRate) {
this(input, output, minTier, syphon, consumeRate, drainRate, false); 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); 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); 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); 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); 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) if (comparedStack == null || this.input == null)
return false; return false;
@ -151,7 +151,7 @@ public class AltarRecipeRegistry {
return output; return output;
} }
public EnumAltarTier getMinTier() { public AltarTier getMinTier() {
return minTier; return minTier;
} }

View file

@ -1,6 +1,6 @@
package WayofTime.bloodmagic.core.registry; package WayofTime.bloodmagic.core.registry;
import WayofTime.bloodmagic.altar.EnumAltarTier; import WayofTime.bloodmagic.altar.AltarTier;
import WayofTime.bloodmagic.orb.BloodOrb; import WayofTime.bloodmagic.orb.BloodOrb;
import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.ArrayListMultimap;
import net.minecraft.item.Item; import net.minecraft.item.Item;
@ -42,7 +42,7 @@ public class OrbRegistry {
public static List<ItemStack> getOrbsDownToTier(int tier) { public static List<ItemStack> getOrbsDownToTier(int tier) {
List<ItemStack> ret = new ArrayList<>(); List<ItemStack> ret = new ArrayList<>();
for (int i = EnumAltarTier.MAXTIERS; i >= tier; i--) for (int i = AltarTier.MAXTIERS; i >= tier; i--)
ret.addAll(getOrbsForTier(i)); ret.addAll(getOrbsForTier(i));
return ret; return ret;

View file

@ -29,7 +29,7 @@ import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantProvider { public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantProvider {
private EnumAltarTier tierToBuild = EnumAltarTier.ONE; private AltarTier tierToBuild = AltarTier.ONE;
public ItemAltarMaker() { public ItemAltarMaker() {
super(); super();
@ -61,12 +61,12 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
stack = NBTHelper.checkNBT(stack); stack = NBTHelper.checkNBT(stack);
if (player.isSneaking()) { 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); stack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, 0);
else else
stack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1); 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))); 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); return super.onItemRightClick(world, player, hand);
} }
@ -91,7 +91,7 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
variants.put(0, "type=altarmaker"); // FIXME variants.put(0, "type=altarmaker"); // FIXME
} }
public void setTierToBuild(EnumAltarTier tierToBuild) { public void setTierToBuild(AltarTier tierToBuild) {
this.tierToBuild = tierToBuild; this.tierToBuild = tierToBuild;
} }
@ -99,12 +99,12 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
if (world.isRemote) if (world.isRemote)
return; return;
if (tierToBuild == EnumAltarTier.ONE) if (tierToBuild == AltarTier.ONE)
return; return;
for (AltarComponent altarComponent : tierToBuild.getAltarComponents()) { for (AltarComponent altarComponent : tierToBuild.getAltarComponents()) {
BlockPos componentPos = pos.add(altarComponent.getOffset()); BlockPos componentPos = pos.add(altarComponent.getOffset());
if (altarComponent.getComponent() == EnumAltarComponent.NOTAIR) { if (altarComponent.getComponent() == ComponentType.NOTAIR) {
world.setBlockState(componentPos, Blocks.STONEBRICK.getDefaultState()); world.setBlockState(componentPos, Blocks.STONEBRICK.getDefaultState());
continue; continue;
} }
@ -123,9 +123,9 @@ public class ItemAltarMaker extends Item implements IAltarManipulator, IVariantP
RayTraceResult rayTrace = rayTrace(world, player, false); RayTraceResult rayTrace = rayTrace(world, player, false);
BlockPos pos = rayTrace.getBlockPos(); BlockPos pos = rayTrace.getBlockPos();
IBlockState state = world.getBlockState(pos); 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(); return "" + altarTier.toInt();
else { else {
for (AltarComponent altarComponent : altarTier.getAltarComponents()) { for (AltarComponent altarComponent : altarTier.getAltarComponents()) {

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.item; package WayofTime.bloodmagic.item;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.altar.EnumAltarTier; import WayofTime.bloodmagic.altar.AltarTier;
import WayofTime.bloodmagic.altar.IAltarManipulator; import WayofTime.bloodmagic.altar.IAltarManipulator;
import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.iface.IDocumentedBlock; import WayofTime.bloodmagic.iface.IDocumentedBlock;
@ -34,7 +34,7 @@ import javax.annotation.Nonnull;
import java.util.List; import java.util.List;
public class ItemSanguineBook extends Item implements IVariantProvider, IAltarManipulator { public class ItemSanguineBook extends Item implements IVariantProvider, IAltarManipulator {
private EnumAltarTier currentDisplayedTier = EnumAltarTier.ONE; private AltarTier currentDisplayedTier = AltarTier.ONE;
public ItemSanguineBook() { public ItemSanguineBook() {
setUnlocalizedName(BloodMagic.MODID + ".sanguineBook"); setUnlocalizedName(BloodMagic.MODID + ".sanguineBook");
@ -73,12 +73,12 @@ public class ItemSanguineBook extends Item implements IVariantProvider, IAltarMa
RayTraceResult rayTrace = rayTrace(world, player, false); RayTraceResult rayTrace = rayTrace(world, player, false);
if (rayTrace == null || rayTrace.typeOfHit == RayTraceResult.Type.MISS || rayTrace.typeOfHit == RayTraceResult.Type.ENTITY) { 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); stack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, 0);
else else
stack.getTagCompound().setInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER, stack.getTagCompound().getInteger(Constants.NBT.ALTARMAKER_CURRENT_TIER) + 1); 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))); 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); return super.onItemRightClick(world, player, hand);

View file

@ -3,8 +3,8 @@ package WayofTime.bloodmagic.ritual.types;
import WayofTime.bloodmagic.BloodMagic; import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.util.BlockStack; import WayofTime.bloodmagic.util.BlockStack;
import WayofTime.bloodmagic.altar.AltarComponent; import WayofTime.bloodmagic.altar.AltarComponent;
import WayofTime.bloodmagic.altar.EnumAltarComponent; import WayofTime.bloodmagic.altar.ComponentType;
import WayofTime.bloodmagic.altar.EnumAltarTier; import WayofTime.bloodmagic.altar.AltarTier;
import WayofTime.bloodmagic.ritual.EnumRuneType; import WayofTime.bloodmagic.ritual.EnumRuneType;
import WayofTime.bloodmagic.ritual.IMasterRitualStone; import WayofTime.bloodmagic.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.ritual.Ritual; import WayofTime.bloodmagic.ritual.Ritual;
@ -30,7 +30,7 @@ import java.util.Iterator;
import java.util.function.Consumer; import java.util.function.Consumer;
public class RitualAltarBuilder extends Ritual { public class RitualAltarBuilder extends Ritual {
private Iterator<AltarComponent> altarComponentsIterator = new ArrayList<>(EnumAltarTier.SIX.getAltarComponents()).iterator(); private Iterator<AltarComponent> altarComponentsIterator = new ArrayList<>(AltarTier.SIX.getAltarComponents()).iterator();
private boolean cycleDone = false; private boolean cycleDone = false;
private AltarComponent currentComponent; private AltarComponent currentComponent;
@ -54,7 +54,7 @@ public class RitualAltarBuilder extends Ritual {
} }
if (cycleDone) { 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)) { 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++) { 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) { 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); itemHandler.extractItem(i, 1, false);
return blockStack; return blockStack;
} }
@ -215,7 +215,7 @@ public class RitualAltarBuilder extends Ritual {
IInventory inv = (IInventory) tileEntity; IInventory inv = (IInventory) tileEntity;
for (int i = 0; i < inv.getSizeInventory(); i++) { 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) { 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); inv.decrStackSize(i, 1);
return blockStack; return blockStack;
} }

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.tile; package WayofTime.bloodmagic.tile;
import WayofTime.bloodmagic.altar.BloodAltar; import WayofTime.bloodmagic.altar.BloodAltar;
import WayofTime.bloodmagic.altar.EnumAltarTier; import WayofTime.bloodmagic.altar.AltarTier;
import WayofTime.bloodmagic.altar.IBloodAltar; import WayofTime.bloodmagic.altar.IBloodAltar;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -67,7 +67,7 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickable {
} }
@Override @Override
public EnumAltarTier getTier() { public AltarTier getTier() {
return bloodAltar.getTier(); return bloodAltar.getTier();
} }
@ -161,11 +161,11 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickable {
return bloodAltar.getChargingFrequency(); return bloodAltar.getChargingFrequency();
} }
public EnumAltarTier getCurrentTierDisplayed() { public AltarTier getCurrentTierDisplayed() {
return bloodAltar.getCurrentTierDisplayed(); return bloodAltar.getCurrentTierDisplayed();
} }
public boolean setCurrentTierDisplayed(EnumAltarTier altarTier) { public boolean setCurrentTierDisplayed(AltarTier altarTier) {
return bloodAltar.setCurrentTierDisplayed(altarTier); return bloodAltar.setCurrentTierDisplayed(altarTier);
} }

View file

@ -1,6 +1,6 @@
package WayofTime.bloodmagic.util; package WayofTime.bloodmagic.util;
import WayofTime.bloodmagic.altar.EnumAltarComponent; import WayofTime.bloodmagic.altar.ComponentType;
import WayofTime.bloodmagic.iface.IDemonWillViewer; import WayofTime.bloodmagic.iface.IDemonWillViewer;
import WayofTime.bloodmagic.util.helper.NBTHelper; import WayofTime.bloodmagic.util.helper.NBTHelper;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks; 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. * @param component - The Component to provide a block for.
* @return The default Block for the EnumAltarComponent * @return The default Block for the EnumAltarComponent
*/ */
public static Block getBlockForComponent(EnumAltarComponent component) { public static Block getBlockForComponent(ComponentType component) {
switch (component) { switch (component) {
case GLOWSTONE: case GLOWSTONE:
return Blocks.GLOWSTONE; return Blocks.GLOWSTONE;