2015-11-02 12:39:44 -08:00
|
|
|
package WayofTime.bloodmagic.block;
|
2015-10-29 20:22:14 -07:00
|
|
|
|
2015-11-02 12:39:44 -08:00
|
|
|
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
2015-11-28 18:25:46 -08:00
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
2016-01-07 15:52:02 -08:00
|
|
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
2015-10-29 20:22:14 -07:00
|
|
|
import lombok.Getter;
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.util.BlockPos;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
2015-10-29 22:22:08 -07:00
|
|
|
import net.minecraft.util.StatCollector;
|
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;
|
|
|
|
|
2015-10-29 22:22:08 -07:00
|
|
|
import java.awt.*;
|
|
|
|
|
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()
|
|
|
|
{
|
2015-10-29 20:22:14 -07:00
|
|
|
super(lifeEssence, Material.water);
|
|
|
|
|
2015-11-28 18:25:46 -08:00
|
|
|
setUnlocalizedName(Constants.Mod.MODID + ".fluid.lifeEssence");
|
2015-10-29 22:22:08 -07:00
|
|
|
|
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)
|
|
|
|
{
|
2015-10-29 20:22:14 -07:00
|
|
|
return !world.getBlockState(blockPos).getBlock().getMaterial().isLiquid() && super.canDisplace(world, blockPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-12-30 15:34:40 -05:00
|
|
|
public boolean displaceIfPossible(World world, BlockPos blockPos)
|
|
|
|
{
|
2015-10-29 20:22:14 -07:00
|
|
|
return !world.getBlockState(blockPos).getBlock().getMaterial().isLiquid() && super.displaceIfPossible(world, blockPos);
|
|
|
|
}
|
|
|
|
|
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()
|
|
|
|
{
|
2015-10-29 22:22:08 -07:00
|
|
|
return Color.WHITE.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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|