Added an initial (read: rough) method to divine where a blood rune is missing for the next tier of altar
This commit is contained in:
parent
686d79570f
commit
cf72036ff9
|
@ -1,5 +1,10 @@
|
|||
------------------------------------------------------
|
||||
Version 2.0.1-41
|
||||
Version 2.0.1-43
|
||||
------------------------------------------------------
|
||||
- Added an initial method to divine where a blood rune is missing for the next tier of altar.
|
||||
|
||||
------------------------------------------------------
|
||||
Version 2.0.1-42
|
||||
------------------------------------------------------
|
||||
- Fixed Demon Crucible's weird behaviour where right-clicking it with an invalid item would still put the item in the crucible
|
||||
and give the player an item with a stacksize of 0.
|
||||
|
|
|
@ -1,9 +1,32 @@
|
|||
package WayofTime.bloodmagic.altar;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
import WayofTime.bloodmagic.api.BlockStack;
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.altar.*;
|
||||
import WayofTime.bloodmagic.api.altar.AltarComponent;
|
||||
import WayofTime.bloodmagic.api.altar.AltarUpgrade;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
|
||||
import WayofTime.bloodmagic.api.altar.IAltarComponent;
|
||||
import WayofTime.bloodmagic.api.event.AltarCraftedEvent;
|
||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
|
||||
|
@ -13,20 +36,9 @@ import WayofTime.bloodmagic.block.BlockBloodRune;
|
|||
import WayofTime.bloodmagic.block.BlockLifeEssence;
|
||||
import WayofTime.bloodmagic.tile.TileAltar;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
import com.google.common.base.Enums;
|
||||
import com.google.common.base.Strings;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BloodAltar implements IFluidHandler
|
||||
{
|
||||
|
@ -99,10 +111,8 @@ public class BloodAltar implements IFluidHandler
|
|||
|
||||
public static boolean checkAltarIsValid(World world, BlockPos worldPos, int altarTier)
|
||||
{
|
||||
|
||||
for (AltarComponent altarComponent : EnumAltarTier.values()[altarTier].getAltarComponents())
|
||||
{
|
||||
|
||||
BlockPos componentPos = worldPos.add(altarComponent.getOffset());
|
||||
BlockStack worldBlock = new BlockStack(world.getBlockState(componentPos).getBlock(), world.getBlockState(componentPos).getBlock().getMetaFromState(world.getBlockState(componentPos)));
|
||||
|
||||
|
@ -127,6 +137,52 @@ public class BloodAltar implements IFluidHandler
|
|||
return true;
|
||||
}
|
||||
|
||||
public static PosAndComponent 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());
|
||||
BlockStack worldBlock = new BlockStack(world.getBlockState(componentPos).getBlock(), world.getBlockState(componentPos).getBlock().getMetaFromState(world.getBlockState(componentPos)));
|
||||
|
||||
if (altarComponent.getComponent() != EnumAltarComponent.NOTAIR)
|
||||
{
|
||||
if (worldBlock.getBlock() instanceof IAltarComponent)
|
||||
{
|
||||
EnumAltarComponent component = ((IAltarComponent) worldBlock.getBlock()).getType(worldBlock.getMeta());
|
||||
if (component != altarComponent.getComponent())
|
||||
{
|
||||
return new PosAndComponent(componentPos, altarComponent.getComponent());
|
||||
}
|
||||
} else if (worldBlock.getBlock() != Utils.getBlockForComponent(altarComponent.getComponent()))
|
||||
{
|
||||
return new PosAndComponent(componentPos, altarComponent.getComponent());
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (world.isAirBlock(componentPos))
|
||||
{
|
||||
return new PosAndComponent(componentPos, altarComponent.getComponent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
public static class PosAndComponent
|
||||
{
|
||||
public final BlockPos pos;
|
||||
public final EnumAltarComponent component;
|
||||
}
|
||||
|
||||
public static AltarUpgrade getUpgrades(World world, BlockPos pos, EnumAltarTier altarTier)
|
||||
{
|
||||
if (world.isRemote)
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
package WayofTime.bloodmagic.api.altar;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* List of different components used to construct different tiers of altars.
|
||||
*/
|
||||
@Getter
|
||||
public enum EnumAltarComponent
|
||||
{
|
||||
GLOWSTONE,
|
||||
|
@ -10,5 +15,13 @@ public enum EnumAltarComponent
|
|||
BEACON,
|
||||
BLOODRUNE,
|
||||
CRYSTAL,
|
||||
NOTAIR
|
||||
NOTAIR;
|
||||
|
||||
private static final String BASE = "chat.BloodMagic.altar.comp.";
|
||||
private String key;
|
||||
|
||||
EnumAltarComponent()
|
||||
{
|
||||
this.key = BASE + name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,23 +3,25 @@ package WayofTime.bloodmagic.item.sigil;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import WayofTime.bloodmagic.util.helper.NumeralHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.altar.BloodAltar;
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.api.iface.IAltarReader;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.tile.TileIncenseAltar;
|
||||
import WayofTime.bloodmagic.util.ChatUtil;
|
||||
import WayofTime.bloodmagic.util.helper.NumeralHelper;
|
||||
|
||||
public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
||||
{
|
||||
|
@ -55,10 +57,22 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
|||
{
|
||||
IBloodAltar altar = (IBloodAltar) tile;
|
||||
int tier = altar.getTier().ordinal() + 1;
|
||||
int currentEssence = altar.getCurrentBlood();
|
||||
int capacity = altar.getCapacity();
|
||||
altar.checkTier();
|
||||
ChatUtil.sendNoSpam(player, new TextComponentTranslation(tooltipBase + "currentAltarTier", NumeralHelper.toRoman(tier)), new TextComponentTranslation(tooltipBase + "currentEssence", currentEssence), new TextComponentTranslation(tooltipBase + "currentAltarCapacity", capacity));
|
||||
|
||||
if (player.isSneaking())
|
||||
{
|
||||
BloodAltar.PosAndComponent missingBlock = BloodAltar.getAltarMissingBlock(world, position.getBlockPos(), tier);
|
||||
if (missingBlock != null)
|
||||
{
|
||||
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.BloodMagic.altar.nextTier", new TextComponentTranslation(missingBlock.getComponent().getKey()), prettifyBlockPosString(missingBlock.getPos())));
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
int currentEssence = altar.getCurrentBlood();
|
||||
int capacity = altar.getCapacity();
|
||||
altar.checkTier();
|
||||
ChatUtil.sendNoSpam(player, new TextComponentTranslation(tooltipBase + "currentAltarTier", NumeralHelper.toRoman(tier)), new TextComponentTranslation(tooltipBase + "currentEssence", currentEssence), new TextComponentTranslation(tooltipBase + "currentAltarCapacity", capacity));
|
||||
}
|
||||
} else if (tile != null && tile instanceof TileIncenseAltar)
|
||||
{
|
||||
TileIncenseAltar altar = (TileIncenseAltar) tile;
|
||||
|
@ -76,4 +90,9 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
|||
|
||||
return super.onItemRightClick(stack, world, player, hand);
|
||||
}
|
||||
|
||||
public String prettifyBlockPosString(BlockPos pos)
|
||||
{
|
||||
return "[" + pos.getX() + ", " + pos.getY() + ", " + pos.getZ() + "]";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -513,6 +513,15 @@ chat.BloodMagic.routing.set=Setting node location
|
|||
chat.BloodMagic.routing.link.master=Linked node to master!
|
||||
chat.BloodMagic.routing.link=Linked nodes together
|
||||
|
||||
chat.BloodMagic.altar.comp.glowstone=a block of glowstone
|
||||
chat.BloodMagic.altar.comp.bloodstone=a large bloodstone brick
|
||||
chat.BloodMagic.altar.comp.beacon=a beacon
|
||||
chat.BloodMagic.altar.comp.bloodrune=a blood rune
|
||||
chat.BloodMagic.altar.comp.crystal=an unimplemented item
|
||||
chat.BloodMagic.altar.comp.notair=a solid block
|
||||
|
||||
chat.BloodMagic.altar.nextTier=The next tier of blood altar is missing %s at %s.
|
||||
|
||||
# sekrit
|
||||
|
||||
secret.BloodMagic.bread.bloody=&r&cBloody Bread
|
||||
|
|
Loading…
Reference in a new issue