2015-11-02 12:39:44 -08:00
|
|
|
package WayofTime.bloodmagic.block;
|
2015-10-29 20:22:14 -07:00
|
|
|
|
2016-03-18 13:16:38 -04:00
|
|
|
import java.awt.Color;
|
|
|
|
|
2015-10-29 20:22:14 -07:00
|
|
|
import lombok.Getter;
|
|
|
|
import net.minecraft.block.material.Material;
|
2016-05-27 22:55:40 -07:00
|
|
|
import net.minecraft.block.state.IBlockState;
|
2015-10-29 20:22:14 -07:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2016-05-27 22:55:40 -07:00
|
|
|
import net.minecraft.util.math.AxisAlignedBB;
|
2016-03-18 13:16:38 -04:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
2015-10-29 20:22:14 -07:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraftforge.fluids.BlockFluidClassic;
|
|
|
|
import net.minecraftforge.fluids.Fluid;
|
|
|
|
import net.minecraftforge.fluids.FluidStack;
|
2016-03-18 13:16:38 -04:00
|
|
|
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
|
|
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
2015-10-29 22:22:08 -07:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
public class BlockLifeEssence extends BlockFluidClassic
|
|
|
|
{
|
2015-10-29 22:22:08 -07:00
|
|
|
@Getter
|
|
|
|
private static Fluid lifeEssence = new FluidLifeEssence();
|
2015-10-29 20:22:14 -07:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
public BlockLifeEssence()
|
|
|
|
{
|
2016-04-24 10:06:28 -07:00
|
|
|
super(lifeEssence, Material.WATER);
|
2015-10-29 20:22:14 -07:00
|
|
|
|
2015-11-28 18:25:46 -08:00
|
|
|
setUnlocalizedName(Constants.Mod.MODID + ".fluid.lifeEssence");
|
2015-10-29 20:22:14 -07:00
|
|
|
lifeEssence.setBlock(this);
|
2015-11-02 12:39:44 -08:00
|
|
|
BloodMagicAPI.setLifeEssence(lifeEssence);
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public boolean canDisplace(IBlockAccess world, BlockPos blockPos)
|
|
|
|
{
|
2016-03-18 13:16:38 -04:00
|
|
|
return !world.getBlockState(blockPos).getBlock().getMaterial(world.getBlockState(blockPos)).isLiquid() && super.canDisplace(world, blockPos);
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public boolean displaceIfPossible(World world, BlockPos blockPos)
|
|
|
|
{
|
2016-03-18 13:16:38 -04:00
|
|
|
return !world.getBlockState(blockPos).getBlock().getMaterial(world.getBlockState(blockPos)).isLiquid() && super.displaceIfPossible(world, blockPos);
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
|
2016-05-27 22:55:40 -07:00
|
|
|
@Override
|
|
|
|
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
public static class FluidLifeEssence extends Fluid
|
|
|
|
{
|
2015-10-29 20:22:14 -07:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
public FluidLifeEssence()
|
|
|
|
{
|
2015-11-28 18:25:46 -08:00
|
|
|
super("lifeEssence", new ResourceLocation(Constants.Mod.DOMAIN + "blocks/lifeEssenceStill"), new ResourceLocation(Constants.Mod.DOMAIN + "blocks/lifeEssenceFlowing"));
|
2015-10-29 20:22:14 -07:00
|
|
|
|
|
|
|
setDensity(2000);
|
|
|
|
setViscosity(2000);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public int getColor()
|
|
|
|
{
|
2016-05-27 22:55:40 -07:00
|
|
|
return Color.RED.getRGB();
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public String getLocalizedName(FluidStack fluidStack)
|
|
|
|
{
|
2016-01-07 15:52:02 -08:00
|
|
|
return TextHelper.localize("tile.BloodMagic.fluid.lifeEssence.name");
|
2015-10-29 20:22:14 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|