Grew a Pair
This commit is contained in:
parent
cf72036ff9
commit
e406a4fa6f
2 changed files with 14 additions and 19 deletions
|
@ -2,9 +2,6 @@ package WayofTime.bloodmagic.altar;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -19,6 +16,10 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
import net.minecraftforge.fluids.FluidTankInfo;
|
import net.minecraftforge.fluids.FluidTankInfo;
|
||||||
import net.minecraftforge.fluids.IFluidHandler;
|
import net.minecraftforge.fluids.IFluidHandler;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.api.BlockStack;
|
import WayofTime.bloodmagic.api.BlockStack;
|
||||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
@ -137,7 +138,7 @@ public class BloodAltar implements IFluidHandler
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PosAndComponent getAltarMissingBlock(World world, BlockPos worldPos, int altarTier)
|
public static Pair<BlockPos, EnumAltarComponent> getAltarMissingBlock(World world, BlockPos worldPos, int altarTier)
|
||||||
{
|
{
|
||||||
if (altarTier >= EnumAltarTier.MAXTIERS)
|
if (altarTier >= EnumAltarTier.MAXTIERS)
|
||||||
{
|
{
|
||||||
|
@ -156,17 +157,17 @@ public class BloodAltar implements IFluidHandler
|
||||||
EnumAltarComponent component = ((IAltarComponent) worldBlock.getBlock()).getType(worldBlock.getMeta());
|
EnumAltarComponent component = ((IAltarComponent) worldBlock.getBlock()).getType(worldBlock.getMeta());
|
||||||
if (component != altarComponent.getComponent())
|
if (component != altarComponent.getComponent())
|
||||||
{
|
{
|
||||||
return new PosAndComponent(componentPos, altarComponent.getComponent());
|
return new ImmutablePair<BlockPos, EnumAltarComponent>(componentPos, altarComponent.getComponent());
|
||||||
}
|
}
|
||||||
} else if (worldBlock.getBlock() != Utils.getBlockForComponent(altarComponent.getComponent()))
|
} else if (worldBlock.getBlock() != Utils.getBlockForComponent(altarComponent.getComponent()))
|
||||||
{
|
{
|
||||||
return new PosAndComponent(componentPos, altarComponent.getComponent());
|
return new ImmutablePair<BlockPos, EnumAltarComponent>(componentPos, altarComponent.getComponent());
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if (world.isAirBlock(componentPos))
|
if (world.isAirBlock(componentPos))
|
||||||
{
|
{
|
||||||
return new PosAndComponent(componentPos, altarComponent.getComponent());
|
return new ImmutablePair<BlockPos, EnumAltarComponent>(componentPos, altarComponent.getComponent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,15 +175,6 @@ public class BloodAltar implements IFluidHandler
|
||||||
return null;
|
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)
|
public static AltarUpgrade getUpgrades(World world, BlockPos pos, EnumAltarTier altarTier)
|
||||||
{
|
{
|
||||||
if (world.isRemote)
|
if (world.isRemote)
|
||||||
|
|
|
@ -11,10 +11,13 @@ import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.TextComponentString;
|
|
||||||
import net.minecraft.util.text.TextComponentTranslation;
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.altar.BloodAltar;
|
import WayofTime.bloodmagic.altar.BloodAltar;
|
||||||
|
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
|
||||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||||
import WayofTime.bloodmagic.api.iface.IAltarReader;
|
import WayofTime.bloodmagic.api.iface.IAltarReader;
|
||||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||||
|
@ -60,10 +63,10 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
||||||
|
|
||||||
if (player.isSneaking())
|
if (player.isSneaking())
|
||||||
{
|
{
|
||||||
BloodAltar.PosAndComponent missingBlock = BloodAltar.getAltarMissingBlock(world, position.getBlockPos(), tier);
|
Pair<BlockPos, EnumAltarComponent> missingBlock = BloodAltar.getAltarMissingBlock(world, position.getBlockPos(), tier);
|
||||||
if (missingBlock != null)
|
if (missingBlock != null)
|
||||||
{
|
{
|
||||||
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.BloodMagic.altar.nextTier", new TextComponentTranslation(missingBlock.getComponent().getKey()), prettifyBlockPosString(missingBlock.getPos())));
|
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.BloodMagic.altar.nextTier", new TextComponentTranslation(missingBlock.getRight().getKey()), prettifyBlockPosString(missingBlock.getLeft())));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue